A2A MCP Server

by gongrzhe

Not rated
GitHub

About

A bridge server connecting Model Context Protocol (MCP) with Agent-to-Agent (A2A) protocol.

Details

Author
gongrzhe
Categories
Communication, AI, Automation, Community, Other

Method 1 Pypi Installation Recommended

Add the following to themcpServerssection of yourclaude_desktop_config.json:

"a2a": { "command": "uvx", "args": ](https://smithery.ai/server/@GongRzhe/A2A-MCP-Server)[ "a2a-mcp-server" ] }

Note that for Claude Desktop, you must use"MCP_TRANSPORT": "stdio"since Claude requires stdio communication with MCP servers.

If you've cloned the repository and want to run the server from your local installation:

"a2a": { "command": "C:\\path\\to\\python.exe", "args": [ "C:\\path\\to\\A2A-MCP-Server\\a2a_mcp_server.py" ], "env": { "MCP_TRANSPORT": "stdio", "PYTHONPATH": "C:\\path\\to\\A2A-MCP-Server" } }

ReplaceC:\\path\\to\\with the actual paths on your system.

This repository includes aconfig_creator.pyscript to help you generate the configuration:

# If using local installation python config_creator.py

- Automatically detect Python, script, and repository paths when possible
- Configure stdio transport which is required for Claude Desktop
- Let you add any additional environment variables if needed
- Create or update your Claude Desktop configuration file

Here's an example of a completeclaude_desktop_config.jsonfile with the A2A-MCP-Server configured:

{ "mcpServers": { "a2a": { "command": "uvx", "args": [ "a2a-mcp-server" ] } } }

Claude can use A2A agents through the MCP tools provided by this server. Here's how to set it up:
-

For Claude Web: Start the MCP server with the streamable-http transport:

MCP_TRANSPORT=streamable-http MCP_HOST=127.0.0.1 MCP_PORT=8000 uvx a2a-mcp-server

For Claude Web: In Claude web interface, enable the MCP URL connection in your Tools menu.

For Claude Desktop: Add the configuration to yourclaude_desktop_config.jsonfile as described above. The easiest way is to use the providedconfig_creator.pyscript which will automatically detect paths and create the proper configuration.

In Claude, you can now use the following functions:

I need to register a new agent. Can you help me with that? (Agent URL: http://localhost:41242)
Ask the agent at http://localhost:41242 what it can do.
Can you get the results for task ID: 550e8400-e29b-41d4-a716-446655440000?

Cursor IDE can connect to MCP servers to add tools to its AI assistant:
-

Run your A2A MCP server with the streamable-http transport:

MCP_TRANSPORT=streamable-http MCP_HOST=127.0.0.1 MCP_PORT=8000 uvx a2a-mcp-server

In Cursor IDE, go to Settings > AI > MCP Servers

- Add a new MCP Server with URL:http://127.0.0.1:8000/mcp
- Enable the server

Now you can use the A2A tools from within Cursor's AI assistant.

Windsurf is a browser with built-in MCP support:
-

Run your A2A MCP server with the streamable-http transport:

MCP_TRANSPORT=streamable-http MCP_HOST=127.0.0.1 MCP_PORT=8000 uvx a2a-mcp-server

In Windsurf browser, go to Settings > MCP Connections

- Add a new MCP connection with URL:http://127.0.0.1:8000/mcp
- Enable the connection

You can now use A2A tools from within Windsurf's AI assistant.

The server exposes the following MCP tools for integration with LLMs like Claude:

-

register_agent: Register an A2A agent with the bridge server

{ "name": "register_agent", "arguments": { "url": "http://localhost:41242" } }

list_agents: Get a list of all registered agents

{ "name": "list_agents", "arguments": {} }

unregister_agent: Remove an A2A agent from the bridge server

{ "name": "unregister_agent", "arguments": { "url": "http://localhost:41242" } }

-

send_message: Send a message to an agent and get a task_id for the response

{ "name": "send_message", "arguments": { "agent_url": "http://localhost:41242", "message": "What's the exchange rate from USD to EUR?", "session_id": "optional-session-id" } }

send_message_stream: Send a message and stream the response

{ "name": "send_message_stream", "arguments": { "agent_url": "http://localhost:41242", "message": "Tell me a story about AI agents.", "session_id": "optional-session-id" } }

-

get_task_result: Retrieve a task's result using its ID

{ "name": "get_task_result", "arguments": { "task_id": "b30f3297-e7ab-4dd9-8ff1-877bd7cfb6b1", "history_length": null } }
{ "name": "cancel_task", "arguments": { "task_id": "b30f3297-e7ab-4dd9-8ff1-877bd7cfb6b1" } }
1. Client registers an A2A agent ↓ 2. Client sends a message to the agent (gets task_id) ↓ 3. Client retrieves the task result using task_id
User: Register an agent at http://localhost:41242 Claude uses: register_agent(url="http://localhost:41242") Claude: Successfully registered agent: ReimbursementAgent User: Ask the agent what it can do Claude uses: send_message(agent_url="http://localhost:41242", message="What can you do?") Claude: I've sent your message. Here's the task_id: b30f3297-e7ab-4dd9-8ff1-877bd7cfb6b1 User: Get the answer to my question Claude uses: get_task_result(task_id="b30f3297-e7ab-4dd9-8ff1-877bd7cfb6b1") Claude: The agent replied: "I can help you process reimbursement requests. Just tell me what you need to be reimbursed for, including the date, amount, and purpose."

The A2A MCP server consists of several key components:
- FastMCP Server: Exposes tools to MCP clients
- A2A Client: Communicates with registered A2A agents
- Task Manager: Handles task forwarding and management
- Agent Card Fetcher: Retrieves information about A2A agents

MCP Client → FastMCP Server → A2A Client → A2A Agent ↑ ↓ └──── Response ──┘

A mcp server that bridges the Model Context Protocol (MCP) with the Agent-to-Agent (A2A) protocol, enabling MCP-compatible AI assistants (like Claude) to seamlessly interact with A2A agents.

This project serves as an integration layer between two cutting-edge AI agent protocols:

-

Model Context Protocol (MCP): Developed by Anthropic, MCP allows AI assistants to connect to external tools and data sources. It standardizes how AI applications and large language models connect to external resources in a secure, composable way.

Agent-to-Agent Protocol (A2A): Developed by Google, A2A enables communication and interoperability between different AI agents through a standardized JSON-RPC interface.

By bridging these protocols, this server allows MCP clients (like Claude) to discover, register, communicate with, and manage tasks on A2A agents through a unified interface.

2, Use Claude to Register the Currency Agent

3, Use Claude to Send a task to the Currency Agent and get the result

- Register A2A agents with the bridge server
- List all registered agents
- Unregister agents when no longer needed

- Send messages to A2A agents and receive responses
- Stream responses from A2A agents in real-time

- Track which A2A agent handles which task
- Retrieve task results using task IDs
- Cancel running tasks

- Multiple transport types: stdio, streamable-http, SSE
- Configure transport type using MCP_TRANSPORT environment variable

To install A2A Bridge Server for Claude Desktop automatically viaSmithery:

npx -y @smithery/cli install @GongRzhe/A2A-MCP-Server --client claude
git clone https://github.com/GongRzhe/A2A-MCP-Server.git cd A2A-MCP-Server
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate

Configure how the MCP server runs using these environment variables:

# Transport type: stdio, streamable-http, or sse export MCP_TRANSPORT="streamable-http" # Host for the MCP server export MCP_HOST="0.0.0.0" # Port for the MCP server (when using HTTP transports) export MCP_PORT="8000" # Path for the MCP server endpoint (when using HTTP transports) export MCP_PATH="/mcp" # Path for SSE endpoint (when using SSE transport) export MCP_SSE_PATH="/sse" # Enable debug logging export MCP_DEBUG="true"

The A2A MCP Server supports multiple transport types:
-

stdio(default): Uses standard input/output for communication

- Ideal for command-line usage and testing
- No HTTP server is started
- Required for Claude Desktop

streamable-http(recommended for web clients): HTTP transport with streaming support

- Recommended for production deployments
- Starts an HTTP server to handle MCP requests
- Enables streaming of large responses

- Provides real-time event streaming
- Useful for real-time updates

# Using environment variable export MCP_TRANSPORT="streamable-http" uvx a2a-mcp-server # Or directly in the command MCP_TRANSPORT=streamable-http uvx a2a-mcp-server
# Using default settings (stdio transport) uvx a2a-mcp-server # Using HTTP transport on specific host and port MCP_TRANSPORT=streamable-http MCP_HOST=127.0.0.1 MCP_PORT=8080 uvx a2a-mcp-server

Claude Desktop allows you to configure MCP servers in theclaude_desktop_config.jsonfile. This file is typically located at:

- Windows:%APPDATA%\Claude\claude_desktop_config.json
- macOS:~/Library/Application Support/Claude/claude_desktop_config.json
- Linux:~/.config/Claude/claude_desktop_config.json

Method 1: PyPI Installation (Recommended)

Add the following to themcpServerssection of yourclaude_desktop_config.json:

"a2a": { "command": "uvx", "args": [ "a2a-mcp-server" ] }

Note that for Claude Desktop, you must use"MCP_TRANSPORT": "stdio"since Claude requires stdio communication with MCP servers.

If you've cloned the repository and want to run the server from your local installation:

"a2a": { "command": "C:\\path\\to\\python.exe", "args": [ "C:\\path\\to\\A2A-MCP-Server\\a2a_mcp_server.py" ], "env": { "MCP_TRANSPORT": "stdio", "PYTHONPATH": "C:\\path\\to\\A2A-MCP-Server" } }

ReplaceC:\\path\\to\\with the actual paths on your system.

This repository includes aconfig_creator.pyscript to help you generate the configuration:

# If using local installation python config_creator.py

- Automatically detect Python, script, and repository paths when possible
- Configure stdio transport which is required for Claude Desktop
- Let you add any additional environment variables if needed
- Create or update your Claude Desktop configuration file

Here's an example of a completeclaude_desktop_config.jsonfile with the A2A-MCP-Server configured:

{ "mcpServers": { "a2a": { "command": "uvx", "args": [ "a2a-mcp-server" ] } } }

Claude can use A2A agents through the MCP tools provided by this server. Here's how to set it up:
-

For Claude Web: Start the MCP server with the streamable-http transport:

MCP_TRANSPORT=streamable-http MCP_HOST=127.0.0.1 MCP_PORT=8000 uvx a2a-mcp-server

For Claude Web: In Claude web interface, enable the MCP URL connection in your Tools menu.

For Claude Desktop: Add the configuration to yourclaude_desktop_config.jsonfile as described above. The easiest way is to use the providedconfig_creator.pyscript which will automatically detect paths and create the proper configuration.

In Claude, you can now use the following functions:

I need to register a new agent. Can you help me with that? (Agent URL: http://localhost:41242)
Ask the agent at http://localhost:41242 what it can do.
Can you get the results for task ID: 550e8400-e29b-41d4-a716-446655440000?

Cursor IDE can connect to MCP servers to add tools to its AI assistant:
-

Run your A2A MCP server with the streamable-http transport:

MCP_TRANSPORT=streamable-http MCP_HOST=127.0.0.1 MCP_PORT=8000 uvx a2a-mcp-server

In Cursor IDE, go to Settings > AI > MCP Servers

- Add a new MCP Server with URL:http://127.0.0.1:8000/mcp
- Enable the server

Now you can use the A2A tools from within Cursor's AI assistant.

Windsurf is a browser with built-in MCP support:
-

Run your A2A MCP server with the streamable-http transport:

MCP_TRANSPORT=streamable-http MCP_HOST=127.0.0.1 MCP_PORT=8000 uvx a2a-mcp-server

In Windsurf browser, go to Settings > MCP Connections

- Add a new MCP connection with URL:http://127.0.0.1:8000/mcp
- Enable the connection

You can now use A2A tools from within Windsurf's AI assistant.

The server exposes the following MCP tools for integration with LLMs like Claude:

-

register_agent: Register an A2A agent with the bridge server

{ "name": "register_agent", "arguments": { "url": "http://localhost:41242" } }

list_agents: Get a list of all registered agents

{ "name": "list_agents", "arguments": {} }

unregister_agent: Remove an A2A agent from the bridge server

{ "name": "unregister_agent", "arguments": { "url": "http://localhost:41242" } }

-

send_message: Send a message to an agent and get a task_id for the response

{ "name": "send_message", "arguments": { "agent_url": "http://localhost:41242", "message": "What's the exchange rate from USD to EUR?", "session_id": "optional-session-id" } }

send_message_stream: Send a message and stream the response

{ "name": "send_message_stream", "arguments": { "agent_url": "http://localhost:41242", "message": "Tell me a story about AI agents.", "session_id": "optional-session-id" } }

-

get_task_result: Retrieve a task's result using its ID

{ "name": "get_task_result", "arguments": { "task_id": "b30f3297-e7ab-4dd9-8ff1-877bd7cfb6b1", "history_length": null } }
{ "name": "cancel_task", "arguments": { "task_id": "b30f3297-e7ab-4dd9-8ff1-877bd7cfb6b1" } }
1. Client registers an A2A agent ↓ 2. Client sends a message to the agent (gets task_id) ↓ 3. Client retrieves the task result using task_id
User: Register an agent at http://localhost:41242 Claude uses: register_agent(url="http://localhost:41242") Claude: Successfully registered agent: ReimbursementAgent User: Ask the agent what it can do Claude uses: send_message(agent_url="http://localhost:41242", message="What can you do?") Claude: I've sent your message. Here's the task_id: b30f3297-e7ab-4dd9-8ff1-877bd7cfb6b1 User: Get the answer to my question Claude uses: get_task_result(task_id="b30f3297-e7ab-4dd9-8ff1-877bd7cfb6b1") Claude: The agent replied: "I can help you process reimbursement requests. Just tell me what you need to be reimbursed for, including the date, amount, and purpose."

The A2A MCP server consists of several key components:
- FastMCP Server: Exposes tools to MCP clients
- A2A Client: Communicates with registered A2A agents
- Task Manager: Handles task forwarding and management
- Agent Card Fetcher: Retrieves information about A2A agents

MCP Client → FastMCP Server → A2A Client → A2A Agent ↑ ↓ └──── Response ──┘
No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.