MCPTools instance per server and pass them all to the Agent.
Prerequisites
1
Set up your virtual environment
Using multiple MCPTools instances
multiple_mcp_servers.py
Handling Connection Failures
connect() does not raise when a server is unreachable: it logs the error and leaves the instance uninitialized, so the Agent can still run with the servers that did connect. To fail fast when a server is required, check initialized after connecting:
async with MCPTools(...) as a context manager instead raises on connection failure.
Avoiding tool name collisions
When using multiple MCP servers, you may encounter tool name collisions. This often happens when the same tool is available in multiple of the servers you are using. To avoid this, you can use thetool_name_prefix parameter. This will add the given prefix to all tool names coming from the MCPTools instance.