mcp_urls and the agent loads the tools from every server and can use them together in a single run. The model sees the union of both toolsets and decides which to call; each call is routed back to the server that owns it.
Build it
1
Install and set your key
2
Pass a list instead of a string
mcp_urls is the only change from the single-server examples. Routing is handled for you: each call goes back to the server that advertised the tool. If two servers expose a tool with the same name, the first server’s tool is kept and a warning is logged.3
Give it more than one loop
Two servers means at least two rounds of tool calls before the model can answer.
max_loops=1 will cut it off after the first — the run returns, but half the question is unanswered.4
Ask something that needs both
The complete script
Mixing authenticated and open servers
mcp_api_key applies to every server that does not define its own credential. When servers need different keys, give each one a connection object:
MCPConnection objects can be mixed in the same list. See authentication patterns for the full set of credential shapes.