A2A-MCP-Agent-Framework
A modular Python/FastAPI framework combining A2A (agent-to-agent) communication with the MCP pattern - a minimal skeleton for wiring both protocols together.
View source on GitHubKey takeaways
- 01
A2A for agent peers, MCP for tools: complementary protocols
Flows built on this research
From the archive
Verbatim excerpts mined from our local archive of this repository — the prompts, schemas, and patterns worth stealing.
Orchestrator wraps MCP tools as agent functions
class OrchestratorAgent:
SUPPORTED_CONTENT_TYPES = ["text", "text/plain"]
def __init__(self, agent_cards: list[AgentCard]):
self.connectors = {}
for card in agent_cards:
self.connectors[card.name] = AgentConnector(card.name, card.url)
self.mcp = MCPConnector(config_file="utilities/mcp/mcp_config.json")
mcp_tools = self.mcp.get_tools()
def make_wrapper(tool):
async def wrapper(args: dict) -> str:
return await tool.run(args)
wrapper.__name__ = tool.name
return wrapper
for tool in mcp_tools:
fn = make_wrapper(tool) A host agent that bridges two protocols: A2A connectors for peer agents and MCP tools wrapped as plain async functions.
a2a_mutli_agent_mcp/agents/host_agent/orchestrator.py
A2A agent card served at a well-known URL
@app.get("/.well-known/agent.json")
async def agent_card():
return {
"name": "WritePoemAgent",
"description": "Write a beautiful poem in Shakespeare's style, with no more than 14 lines",
"url": "http://localhost:8000",
"version": "1.0",
"capabilities": {
"streaming": False,
"pushNotifications": False
}
} The A2A discovery pattern: agents advertise identity and capabilities at /.well-known/agent.json, mirroring how MCP servers advertise tools.
Basic_A2A/server/poem_server.py