Skip to content

RFC: MCP Server Integration via A2A Protocol Bridge #756

@anivar

Description

@anivar

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:

  1. Protocol Interoperability: MCP tools become accessible to A2A agents
  2. Gradual Migration: Teams can transition between protocols without rewriting tools
  3. Enterprise Integration: Connect local MCP tools with cloud-based A2A systems
  4. Unified Tool Access: Use tools regardless of their underlying protocol

Implementation Approach

Core Components

  1. MCP-to-A2A Bridge

    • Translates A2A requests to MCP tool calls
    • Handles protocol-specific differences
    • Manages connection lifecycle
  2. 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)
  3. 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

  1. Immediate Value: Use existing MCP tools with A2A agents today
  2. No Tool Rewrites: Bridge protocols without changing tool implementations
  3. Flexibility: Run multiple bridges for different tools
  4. 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions