This example shows how to use a Supervisor to manage agents powered by different MCP tool servers:
- A weather info agent (using MCP stdio transport)
- An addition/math agent (using MCP SSE transport)
add_server.py— MCP SSE server providing anadd(a, b)tool on port 8000.weather_server.py— MCP stdio server providing weather tools (get_alerts,get_forecast).example_multi_mcp.py— Main supervisor/agent orchestrator and chat frontend.README.md— This info.
-
Start the Addition SSE Server
In one terminal:
python add_server.py -
(Nothing to run for Weather Stdio! The agent code will launch weather_server.py as needed.)
-
Start the Supervisor Chat
In another terminal:
python example_multi_mcp.py- Ask:
What are the weather alerts for NY? - Ask:
What is 2 plus 4? - Mix weather and math prompts; the supervisor will route queries!
- Ask:
- The agent graph will be displayed before chat.
- No need to run
weather_server.pymanually; agent launches it via stdio as a subprocess. - You can extend with more agents and tool servers, using either MCP transport.