MCPDeployer can serve many targets. Pass a dict and every entry becomes its own tool, named by its key. A client then picks the right specialist per call instead of connecting to four servers.
Prerequisites
Build it
1
Define the team
Two agents, a workflow that chains two agents, and a function. Any object with a Each tool’s description comes from the target:
run(task) method can be served, so a swarm is served the same way as a single agent.team.py
agent_description for an agent, description for the workflow, and the docstring for the function. timeout=300 fails any single call that runs longer than five minutes.2
Serve it and call each tool
Add a client to the bottom of followed by the briefing.
team.py. The with block starts the server on a background thread and stops it on exit, so the whole example is one script.team.py
word_count never touches a model, so it answers at once. write_briefing runs the researcher and then the writer before it returns.3
Let an agent choose the tool
With the server running, a client agent sees all four tools and decides which to call:To keep the server up for a separate client process, call
deployer.run() instead of using the with block.Adding tools later
add_tool registers one more target before the server starts. After start() it raises RuntimeError.
ValueError. That is why several targets are passed as a dict: the keys make every name explicit.
Checking what is served
GET /health lists every tool:
Next
Serve an agent over MCP
The single-agent version, with a separate server and client.
MCPDeployer reference
Custom auth, token verifiers, SSE and stdio transports.