agent-mcp
An MCP facade server that aggregates multiple downstream MCP servers and exposes them as high-level tools, using autonomous agents to handle natural-language instructions and complex multi-step operations.
README
agent-mcp
An MCP (Model Context Protocol) facade server that exposes high-level tools backed by autonomous agent loops. This project acts as a bridge between client applications and multiple downstream MCP servers, using an LLM to intelligently delegate tasks as natural-language instructions.
Overview
agent-mcp is a meta-MCP server that:
- Aggregates multiple MCP servers - Connects to any number of downstream MCP servers
- Exposes unified tools - Each downstream server becomes a single high-level tool
- Powers tools with agents - When a tool is invoked, an autonomous agent (powered by Google ADK) runs to fulfill the instruction using the downstream server's capabilities
- Handles complexity internally - Clients stay simple; agents handle tool selection, error recovery, and multi-step operations
Use Case
Instead of a client needing to:
- Know which MCP server has which tools
- Understand tool parameters and schemas
- Handle tool call sequences and errors
Clients can say:
Tool: "my-server"
Input: "Create a task 'Buy groceries' and add it to the Groceries project"
And the agent handles the complexity of looking up projects, calling the right tools, and returning results.
Architecture
┌──────────────────┐
│ Client (e.g. │
│ Claude Code) │
└────────┬─────────┘
│ MCP Protocol
▼
┌─────────────────────┐
│ agent-mcp Server │
├─────────────────────┤
│ Tool 1: server-a ├──→ ADK Agent ─→ LLM (via LiteLLM)
│ Tool 2: server-b ├──→ ADK Agent ─→ LLM (via LiteLLM)
│ Tool 3: server-c ├──→ ADK Agent ─→ LLM (via LiteLLM)
│ ... │
└─────────┬───────────┘
│
│ MCP Protocol (stdio/http)
▼
┌─────────────┐
│ Downstream │
│ MCP Servers │
└─────────────┘
Installation
Prerequisites
- Python 3.10+
- uv (optional, but recommended)
- API keys for the LLM provider you want to use (e.g.
ANTHROPIC_API_KEY) - API tokens for any downstream MCP servers you configure (optional)
Setup
- Clone the repository:
git clone https://github.com/yourusername/agent-mcp.git
cd agent-mcp
- Install dependencies:
# Using uv (recommended)
uv sync
# Or using pip
pip install -e .
- Create configuration files:
# Create .mcp.json from the example
cp .mcp.json.example .mcp.json
# Edit with your API keys and paths
nano .mcp.json
- Configure downstream MCP servers in
config.yaml:
model: anthropic/claude-sonnet-4-20250514
max_tokens: 8096
max_llm_calls: 20
servers:
my-server:
description: "Description of what this server does"
transport: stdio
command: uv
args:
- run
- --directory
- /path/to/my-mcp-server
- my-mcp-server
env:
MY_API_TOKEN: ${MY_API_TOKEN}
The model field uses LiteLLM format (provider/model-name), so you can use any supported LLM provider.
Configuration
.mcp.json
The .mcp.json file configures how Claude Code (or other MCP clients) launches agent-mcp:
{
"mcpServers": {
"agent-mcp": {
"command": "uv",
"args": ["run", "--directory", "/path/to/agent-mcp", "agent-mcp"],
"env": {
"ANTHROPIC_API_KEY": "your-key",
"MY_API_TOKEN": "your-token"
}
}
}
}
Important: Never commit .mcp.json to git. Use .mcp.json.example as a template.
config.yaml
The config.yaml file defines:
- Agent settings - Model (LiteLLM format), max tokens, LLM call limits
- Downstream servers - MCP servers to aggregate
- Transport type (stdio, http)
- How to launch them (command + args for stdio, url for http)
- Environment variables (supports
${VAR}substitution) - Authentication (static headers or OAuth browser flow)
Usage
As an MCP Server
Once agent-mcp is running, clients connect via MCP and call tools:
# Pseudocode example
response = await client.call_tool("my-server", {
"instruction": "List all my projects and tasks due today"
})
Running Standalone
uv run agent-mcp
The server listens on stdin/stdout for MCP protocol messages.
With Claude Code
- Copy your
.mcp.jsonconfiguration to~/.config/Claude/claude_desktop_config.json - Restart Claude Code
- Your configured downstream server tools become available in conversations
How It Works
- Initialization -
agent-mcploadsconfig.yamland registers tools for each downstream server - Tool Registration - Each downstream server becomes a tool with its configured name
- Request Handling - When a tool is invoked with a natural-language instruction:
agent-mcpcreates an ADKMcpToolsetconnected to the downstream server- An ADK
LlmAgentruns with the downstream server's tools - The agent reads the instruction and decides which tools to call
- The agent handles tool calls, errors, and retries
- Results are returned to the client, and the toolset is closed
- Per-invocation lifecycle - Each tool call gets a fresh MCP connection, avoiding stale connection state
Project Structure
agent-mcp/
├── README.md # This file
├── .gitignore # Git exclusions
├── .mcp.json.example # Template for .mcp.json
├── config.yaml # Downstream server configuration
├── pyproject.toml # Python project metadata
├── uv.lock # Locked dependencies
├── src/
│ └── agent_mcp/
│ ├── __init__.py
│ ├── server.py # MCP server entrypoint
│ ├── agent.py # ADK agent orchestration
│ ├── oauth.py # OAuth browser-based authentication
│ └── config.py # Configuration loading and parsing
└── tests/
├── test_agent.py # Agent unit tests
├── test_config.py # Config parsing tests
├── test_oauth.py # OAuth flow tests
├── test_server.py # Server CLI tests
└── test_e2e_oauth.py # End-to-end OAuth tests (require cached tokens)
Module Overview
- server.py - FastMCP server implementation, handles MCP protocol
- agent.py - ADK-based agent orchestration using
LlmAgent,Runner, andMcpToolset - oauth.py - OAuth browser-based authentication for downstream MCP servers
- config.py - YAML parsing, environment variable substitution, validation
Development
Running Tests
uv run pytest -m "not e2e"
Running End-to-End Tests
E2E tests require cached OAuth tokens (run the OAuth flow manually first):
uv run pytest -m e2e
Code Style
- Python 3.10+
- Async-first (asyncio)
- Type hints throughout
- Minimal dependencies
Limitations & Future Work
- Only supports stdio and http transports
- No caching of tool schemas (reloaded on every call)
- Error messages are agent-generated (could be inconsistent)
Contributing
Contributions welcome! Areas of interest:
- Tool schema caching for performance
- Better error recovery strategies
- Additional test coverage
License
MIT
Acknowledgments
Built with:
- Google ADK - Agent Development Kit
- LiteLLM - Multi-provider LLM gateway
- mcp-python
- FastMCP
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。