mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-23 05:54:19 +02:00
Clean up
This commit is contained in:
parent
35e20774c0
commit
b2dc2f0473
4 changed files with 23 additions and 3 deletions
23
README.md
23
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
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue