Overview
MCP servers provide tools, resources, and prompts that agents can use to interact with external systems. Fast Agent supports multiple transport types (stdio, SSE, HTTP) and provides flexible configuration options for connecting to MCP servers.Basic Server Configuration
MCP servers are configured in themcp.targets or mcp.servers section of your configuration file:
Target Shorthand
Thetargets array provides a concise way to define servers using a target string that’s automatically parsed:
Transport Types
Fast Agent supports three MCP transport mechanisms:stdio Transport
The default transport for local process-based servers:The command to execute the server (e.g.,
npx, uvx, node, python).Arguments for the server command.
Working directory for the executed server command.
Environment variables to pass to the server process.
SSE Transport
Server-Sent Events transport for remote servers:The SSE endpoint URL.
Timeout in seconds for SSE connection.
HTTP Transport
Streamable HTTP transport for remote servers:The HTTP endpoint URL.
Overall HTTP timeout in seconds. Defaults to MCP SDK default.
HTTP read timeout in seconds. Defaults to MCP SDK default.
Custom HTTP headers for connections.
Server Connection Options
The name of the server, used to reference it in agent configurations.
Human-readable description of the server’s purpose.
Whether to connect to this server automatically when the agent starts.
Whether to include this server’s instructions in the system prompt.
Whether to automatically reconnect when the server session is terminated.When enabled, if a remote StreamableHTTP server returns a 404 indicating the session has been terminated (e.g., due to server restart), the client will automatically attempt to re-initialize the connection and retry the operation.
Timeout in seconds for server operations.
MCP Ping Configuration
Client-side health checking for MCP servers using the MCP ping utility:Interval for MCP ping requests. Set to
0 or negative to disable pinging.Number of consecutive missed ping responses before treating the connection as failed.
Root Directories
For servers that work with filesystems, you can configure root directories to grant access:List of root directory configurations.
The URI identifying the root. Must start with
file://Optional name for the root.
Optional URI alias for presentation to the server (useful for Docker containers).
Docker Example with Roots
- Mounts local
./agent_folderto/mnt/data/in the container - Tells the server about the
file://./agent_folder/root - Uses
server_uri_aliasto translate paths for the containerized environment
MCP Sampling Configuration
Configure which model the MCP server uses for sampling operations:Model to use for MCP sampling requests.
MCP Elicitation Configuration
Control how the client handles elicitation requests from MCP servers:Elicitation mode for interactive forms and user input:
forms: Display forms to users (default UI)auto-cancel: Automatically cancel elicitation requestsnone: No elicitation capability advertised
Authentication
See the OAuth configuration page for detailed authentication setup including OAuth 2.1 support.Using Servers in Agents
Reference configured servers in your agent definitions:Advanced Examples
Multiple Server Types
Custom Headers and Timeouts
Experimental Features
Advertise MCP session test capability in client initialize payload.
Reserved compatibility knob for session test capability advertisement.
Windows Configuration Notes
See Also
- OAuth Configuration - Set up OAuth authentication
- Configuration File - Main configuration options
- Secrets Management - Secure credential storage
