-
Notifications
You must be signed in to change notification settings - Fork 66
Open
Description
Background
Currently, any-agent supports both MCP (Model Context Protocol) and A2A (Agent-to-Agent) protocols for serving agents. However, there's no way to bridge between these protocols. This creates silos where MCP tools can't be used by A2A agents and vice versa.
Proposal
Add a bridge capability to any-agent that allows MCP servers to be exposed as A2A-compatible services. This would enable:
- Protocol Interoperability: MCP tools become accessible to A2A agents
- Gradual Migration: Teams can transition between protocols without rewriting tools
- Enterprise Integration: Connect local MCP tools with cloud-based A2A systems
- Unified Tool Access: Use tools regardless of their underlying protocol
Implementation Approach
Core Components
-
MCP-to-A2A Bridge
- Translates A2A requests to MCP tool calls
- Handles protocol-specific differences
- Manages connection lifecycle
-
Configuration
- Simple config to specify which MCP server to bridge
- Port and endpoint settings for the A2A interface
- Identity configuration field (stored but not used)
-
Integration Points
- Follows existing any-agent patterns
- No custom rules or behaviors
- Clean separation from native implementations
Example Usage
from any_agent.config import MCPStdio
from any_agent.serving import serve_mcp_as_a2a_async, MCPToA2ABridgeConfig
# Configure MCP server
mcp_config = MCPStdio(
command="uvx",
args=["mcp-server-time"],
tools=["get_current_time"],
)
# Bridge to A2A
bridge_config = MCPToA2ABridgeConfig(
mcp_config=mcp_config,
port=8080,
endpoint="/time-bridge",
)
bridge_handle = await serve_mcp_as_a2a_async(mcp_config, bridge_config)
Benefits
- Immediate Value: Use existing MCP tools with A2A agents today
- No Tool Rewrites: Bridge protocols without changing tool implementations
- Flexibility: Run multiple bridges for different tools
- Standards-Based: Works with standard MCP and A2A protocols
Considerations
- A2A's AgentCard doesn't support arbitrary metadata, so some MCP features may not translate
- Performance overhead of protocol translation (expected to be minimal)
- Each bridge handles one MCP server (by design, for simplicity)
Implementation Status
Implemented in PR #757
The implementation includes:
- Full protocol bridge with error handling
- Identity configuration field (stored internally, not used in A2A protocol)
- Comprehensive tests and documentation
- Cookbook example with practical usage patterns
Metadata
Metadata
Assignees
Labels
No labels