Skip to main content

MCPServerConfig

Each MCP server is defined with an MCPServerConfig:

Connection Parameters

str
required
Unique identifier for this server. Used in tool name prefixes and logs.
str
default:"stdio"
Transport type: "stdio", "sse", or "http".

stdio Transport

str
Command to launch the server process (e.g., "npx", "python", "node").
List[str]
Command-line arguments for the server process.

SSE / HTTP Transport

str
Server URL for SSE or HTTP transports.
Dict[str, str]
Custom HTTP headers (e.g., authentication tokens).

Timeouts

float
default:"30.0"
Maximum time in seconds to establish the initial connection.
float
default:"60.0"
Maximum time in seconds for individual requests (tool calls, resource reads).

Reliability

bool
default:"true"
Automatically reconnect if the connection drops.
int
default:"3"
Maximum number of reconnection attempts.

Tool Filtering

List[str]
Whitelist of tool names. Only these tools will be exposed to the agent.
List[str]
Blacklist of tool names. These tools will be hidden from the agent.

MCPConfig

Group multiple servers into a single configuration:
List[MCPServerConfig]
required
List of server configurations.
bool
default:"true"
Automatically connect to all servers on initialization.
bool
default:"true"
Global reconnection setting (can be overridden per server).

Loading from a File

Store configuration in a JSON file and load it:
Save configuration back to a file:

Managing Servers

Add or remove servers dynamically:

Transport-Specific Examples