Jeremiah Lowin commited on
Commit
2678311
·
1 Parent(s): da46698
README.md CHANGED
@@ -253,6 +253,29 @@ async def main():
253
  # ... use the client
254
  ```
255
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
256
  Learn more in the [**Client Documentation**](https://gofastmcp.com/clients/client) and [**Transports Documentation**](https://gofastmcp.com/clients/transports).
257
 
258
  ## Advanced Features
 
253
  # ... use the client
254
  ```
255
 
256
+ FastMCP also supports connecting to multiple servers through a single unified client using the standard MCP configuration format:
257
+
258
+ ```python
259
+ from fastmcp import Client
260
+
261
+ # Standard MCP configuration with multiple servers
262
+ config = {
263
+ "mcpServers": {
264
+ "weather": {"url": "https://weather-api.example.com/mcp"},
265
+ "assistant": {"command": "python", "args": ["./assistant_server.py"]}
266
+ }
267
+ }
268
+
269
+ # Create a client that connects to all servers
270
+ client = Client(config)
271
+
272
+ async def main():
273
+ async with client:
274
+ # Access tools and resources with server prefixes
275
+ forecast = await client.call_tool("weather_get_forecast", {"city": "London"})
276
+ answer = await client.call_tool("assistant_answer_question", {"query": "What is MCP?"})
277
+ ```
278
+
279
  Learn more in the [**Client Documentation**](https://gofastmcp.com/clients/client) and [**Transports Documentation**](https://gofastmcp.com/clients/transports).
280
 
281
  ## Advanced Features
docs/clients/client.mdx CHANGED
@@ -95,7 +95,6 @@ When you create a client with an `MCPConfig` containing multiple servers:
95
 
96
  ```python
97
  from fastmcp import Client
98
- from fastmcp.utilities.mcp_config import MCPConfig
99
 
100
  # Create a standard MCP configuration with multiple servers
101
  config = {
 
95
 
96
  ```python
97
  from fastmcp import Client
 
98
 
99
  # Create a standard MCP configuration with multiple servers
100
  config = {
docs/clients/transports.mdx CHANGED
@@ -333,7 +333,6 @@ MCPConfig follows an emerging standard for MCP server configuration but is subje
333
 
334
  ```python
335
  from fastmcp import Client
336
- from fastmcp.utilities.mcp_config import MCPConfig
337
 
338
  # Configuration for multiple MCP servers (both local and remote)
339
  config = {
 
333
 
334
  ```python
335
  from fastmcp import Client
 
336
 
337
  # Configuration for multiple MCP servers (both local and remote)
338
  config = {
src/fastmcp/utilities/exceptions.py CHANGED
@@ -18,7 +18,6 @@ def iter_exc(group: BaseExceptionGroup):
18
 
19
 
20
  def _exception_handler(group: BaseExceptionGroup):
21
- print(list(iter_exc(group)))
22
  for leaf in iter_exc(group):
23
  if isinstance(leaf, httpx.ConnectTimeout):
24
  raise McpError(
 
18
 
19
 
20
  def _exception_handler(group: BaseExceptionGroup):
 
21
  for leaf in iter_exc(group):
22
  if isinstance(leaf, httpx.ConnectTimeout):
23
  raise McpError(