diff --git a/README.md b/README.md index 8dd3787fd..15356516e 100644 --- a/README.md +++ b/README.md @@ -253,6 +253,29 @@ async def main(): # ... use the client ``` +FastMCP also supports connecting to multiple servers through a single unified client using the standard MCP configuration format: + +```python +from fastmcp import Client + +# Standard MCP configuration with multiple servers +config = { + "mcpServers": { + "weather": {"url": "https://weather-api.example.com/mcp"}, + "assistant": {"command": "python", "args": ["./assistant_server.py"]} + } +} + +# Create a client that connects to all servers +client = Client(config) + +async def main(): + async with client: + # Access tools and resources with server prefixes + forecast = await client.call_tool("weather_get_forecast", {"city": "London"}) + answer = await client.call_tool("assistant_answer_question", {"query": "What is MCP?"}) +``` + Learn more in the [**Client Documentation**](https://gofastmcp.com/clients/client) and [**Transports Documentation**](https://gofastmcp.com/clients/transports). ## Advanced Features diff --git a/docs/clients/client.mdx b/docs/clients/client.mdx index fddc77b73..422bac4cf 100644 --- a/docs/clients/client.mdx +++ b/docs/clients/client.mdx @@ -95,7 +95,6 @@ When you create a client with an `MCPConfig` containing multiple servers: ```python from fastmcp import Client -from fastmcp.utilities.mcp_config import MCPConfig # Create a standard MCP configuration with multiple servers config = { diff --git a/docs/clients/transports.mdx b/docs/clients/transports.mdx index da74a2619..958cafcae 100644 --- a/docs/clients/transports.mdx +++ b/docs/clients/transports.mdx @@ -333,7 +333,6 @@ MCPConfig follows an emerging standard for MCP server configuration but is subje ```python from fastmcp import Client -from fastmcp.utilities.mcp_config import MCPConfig # Configuration for multiple MCP servers (both local and remote) config = { diff --git a/src/fastmcp/utilities/exceptions.py b/src/fastmcp/utilities/exceptions.py index 8cbd4b7f5..e50dc57b0 100644 --- a/src/fastmcp/utilities/exceptions.py +++ b/src/fastmcp/utilities/exceptions.py @@ -18,7 +18,6 @@ def iter_exc(group: BaseExceptionGroup): def _exception_handler(group: BaseExceptionGroup): - print(list(iter_exc(group))) for leaf in iter_exc(group): if isinstance(leaf, httpx.ConnectTimeout): raise McpError(