This example shows connecting to multiple MCP servers via the MCPAggregator interface. An MCP aggregator will combine multiple MCP servers into a single interface allowing users to bypass limitations around the number of MCP servers in use.
┌────────────┐ ┌──────────────┐
│ Aggregator │──┬──▶│ Fetch │
└────────────┘ │ │ MCP Server │
│ └──────────────┘
| ┌──────────────┐
└──▶│ Filesystem │
│ MCP Server │
└──────────────┘
First, clone the repo and navigate to the basic‑agent example:
git clone https://github.com/lastmile-ai/mcp-agent.git
cd mcp-agent/examples/basic/mcp_server_aggregatorInstall uv (if you don’t have it):
pip install uvSync mcp-agent project dependencies:
uv syncInstall requirements specific to this example:
uv pip install -r requirements.txtCopy and configure your env variables:
cp mcp_agent.secrets.yaml.example mcp_agent.secrets.yamlThen open mcp_agent.secrets.yaml and add your api key for your preferred LLM.
Run your MCP Agent app:
uv run main.py