Enterprise·
advanced
·15 min read·Sep 24, 2026·Updated Nov 12, 2026
·Lead AI Systems Architect·Verification Charter

A2A and MCP: Multi-Agent Protocol Federation

Learn how the Agent-to-Agent (A2A) protocol and Model Context Protocol combine into a secure, decentralized multi-agent enterprise federation stack.

a2amcpfederationmulti-agentprotocolenterprisezero-trust
Interactive Tool
1-Click Export

Generate & Validate Multi-Client MCP Config

One-click export with environment variables & path locators for Claude Desktop, Cursor, Windsurf, and OpenAI Codex CLI.

Open in Generator

A2A and MCP: Multi-Agent Protocol Federation

Enterprise software architectures increasingly delegate work across federated multi-agent networks rather than relying on monolithic, single-agent assistants. In real-world enterprise operations, an autonomous agent operating within one corporate security boundary frequently needs to delegate complex subtasks to specialized third-party vendor agents—such as external payment auditing, automated penetration testing, cloud infrastructure cost optimization, or legal regulatory compliance reviews.

However, organizations cannot simply grant third-party vendor agents direct shell access, internal VPN connectivity, or raw database connection strings. Doing so creates massive data leakage vectors and violates strict enterprise compliance mandates such as SOC 2, HIPAA, and GDPR.

Solving this multi-organization coordination problem requires two complementary protocol layers operating in unison:

  1. ▸Agent-to-Agent Protocol (A2A): Governs horizontal peer-to-peer delegation, intent negotiation, cryptographic identity federation, billing handshakes, and Service Level Agreement (SLA) contracts between distinct autonomous agents.
  2. ▸Model Context Protocol (MCP): Governs vertical integration, enabling an agent runtime to discover and invoke tools, query structured resources, and inject context from local or remote backend systems.

Together, A2A and MCP establish the standardized protocol stack for enterprise agent federation, coupling cryptographic capability delegation with zero-trust tool execution.


1. The Two-Layer Protocol Stack

While MCP operates as the standardized "USB-C port" connecting an AI reasoning engine to its operational tools, A2A operates as the "BGP and HTTPS networking fabric" enabling autonomous agents to discover, negotiate with, and delegate work to one another across organizational boundaries:

code
┌────────────────────────────────────────────────────────┐
│ PRIMARY ENTERPRISE HOST (Acme Corp)                   │
│ Lead Agent (Claude Desktop / Cursor / Codex CLI)       │
└──────────────────────────┬─────────────────────────────┘
                           │
             A2A Protocol Negotiation Layer
             (W3C DID Identity, Task SLA, Scoped JWT)
                           │
                           ▼
┌────────────────────────────────────────────────────────┐
│ SPECIALIZED VENDOR AGENT CLUSTER (Security Vendor)     │
│ Subagent Inspector (e.g. Vulnerability Auditor)        │
└──────────────────────────┬─────────────────────────────┘
                           │
             Model Context Protocol (MCP) Transports
             (SSE / mTLS with Cryptographic Scoping)
                           │
       ┌───────────────────┼───────────────────┐
       ▼                   ▼                   ▼
┌──────────────┐    ┌──────────────┐    ┌──────────────┐
│  MCP Server  │    │  MCP Server  │    │  MCP Server  │
│  Git / Code  │    │  Sentry Logs │    │  PostgreSQL  │
└──────────────┘    └──────────────┘    └──────────────┘

When an enterprise lead agent encounters a task outside its core domain, it initiates an A2A handshake with an authorized external agent. Rather than transmitting broad database credentials, the lead agent provisions a dynamic, scoped MCP gateway endpoint backed by an ephemeral JSON Web Token (JWT). The external vendor agent connects to this delegated gateway, executing strictly approved read-only tools without ever gaining access to the enterprise's private network.


2. Prerequisites and Environment Matrix

Before establishing an A2A and MCP federated bridge, verify your runtime and cryptographic dependency requirements:

ComponentMinimum VersionRecommendedPurpose
Node.js>= 20.0.0 LTSv22.12.0 LTSCore gateway runtime
@modelcontextprotocol/sdk1.6.01.7.0MCP client and server library
jose5.0.05.9.6Cryptographic JWT capability signing
TypeScript5.4.05.7.2Type-safe schema validation

Ensure your edge reverse proxy (such as Envoy, NGINX, or Cloudflare) supports HTTP Server-Sent Events (SSE) streaming with TLS 1.3 termination.


3. Multi-Host Configuration Snippets

Configure your AI assistant host to connect with the local federation gateway for orchestrating delegated tasks.

Claude Desktop Configuration

Configure Claude Desktop to route delegated federation requests through your local A2A bridge daemon:

json
{
  "mcpServers": {
    "a2a-federation-bridge": {
      "command": "node",
      "args": ["./dist/a2a-bridge-server.js"],
      "env": {
        "A2A_ORGANIZATION_DID": "did:web:internal.acme.example.com",
        "MCP_GATEWAY_URL": "https://mcp-gateway.internal.example.com/sse"
      }
    }
  }
}

Cursor IDE Configuration (.cursor/mcp.json)

Inside Cursor, declare the federation agent bridge:

json
{
  "mcpServers": {
    "a2a-bridge": {
      "command": "node",
      "args": ["./dist/a2a-bridge-server.js"],
      "env": {
        "A2A_MODE": "development"
      }
    }
  }
}

OpenAI Codex CLI Configuration (~/.codex/config.toml)

For terminal automation via the OpenAI Codex CLI:

toml
[mcp.servers.a2a_bridge]
command = "node"
args = ["./dist/a2a-bridge-server.js"]

[mcp.servers.a2a_bridge.env]
A2A_ORGANIZATION_DID = "did:web:internal.acme.example.com"

4. Step-by-Step Federation Protocol Lifecycle

Step 1: Constructing the A2A Task Delegation Envelope

When delegating a subtask, the initiating agent constructs a cryptographically signed A2A task envelope. This envelope defines the task intent, Service Level Agreement constraints, and a scoped MCP access token:

json
{
  "a2a_version": "1.0",
  "task_id": "task_audit_98412",
  "sender_did": "did:web:internal.acme.example.com:agent:lead",
  "recipient_did": "did:web:vendor.security.example.com:agent:scanner",
  "intent": {
    "action": "audit_code_vulnerabilities",
    "parameters": {
      "repository_name": "payment-gateway",
      "target_commit": "e814bf9"
    }
  },
  "delegated_mcp_capabilities": {
    "gateway_endpoint": "https://mcp-gateway.internal.example.com/sse",
    "capability_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.scoped_mcp_session",
    "allowed_tools": [
      "git_read_file",
      "git_list_commits",
      "sentry_query_errors"
    ],
    "max_tool_invocations": 30
  },
  "sla": {
    "timeout_seconds": 120,
    "max_cost_usd": 2.50
  }
}

Step 2: Vendor Agent Connecting to Delegated Gateway

Upon receiving the A2A envelope, the vendor agent uses the Model Context Protocol SDK to establish an authenticated connection to the delegating party's SSE gateway:

typescript
// a2a_vendor_connector.ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";

export async function connectToDelegatedMcp(envelope: any) {
  const { gateway_endpoint, capability_token, allowed_tools } = envelope.delegated_mcp_capabilities;

  // Initialize SSE Transport with scoped JWT authorization header
  const transport = new SSEClientTransport(new URL(gateway_endpoint), {
    headers: {
      Authorization: `Bearer ${capability_token}`,
      "X-A2A-Task-ID": envelope.task_id
    }
  });

  const client = new Client(
    { name: "VendorSecurityAgent", version: "1.0.0" },
    { capabilities: { tools: {} } }
  );

  await client.connect(transport);

  // Discover published tools and filter to contractually approved subset
  const response = await client.listTools();
  const authorizedTools = response.tools.filter(tool => allowed_tools.includes(tool.name));

  console.log(`Connected to federated MCP gateway. ${authorizedTools.length} tools available.`);
  return { client, authorizedTools };
}

Step 3: Tool Execution and Audit Ledgering

When the vendor agent invokes an authorized tool over MCP, the gateway verifies the invocation count and writes an immutable audit record:

json
{
  "jsonrpc": "2.0",
  "id": 101,
  "method": "tools/call",
  "params": {
    "name": "git_read_file",
    "arguments": {
      "path": "src/security/authenticator.ts"
    }
  }
}

The gateway confirms that git_read_file is present in allowed_tools, increments the session invocation counter (1 of 30), and returns the file contents.


5. Common Errors and Production Troubleshooting

Error 1: Capability Token Expiration During Long Execution Loops

  • ▸Symptom: Subagent tool invocations fail after 5 minutes with 401 Unauthorized: Capability Token Expired.
  • ▸Root Cause: To enforce zero-trust security, delegated JWTs are short-lived (5-minute TTL). Complex analysis jobs that exceed this duration are abruptly severed.
  • ▸Resolution: Implement an A2A heartbeat lease extension. The subagent emits an extend_lease signal over A2A prior to token expiration, allowing the delegator to issue a fresh short-lived token without restarting the entire task.

Error 2: Privilege Escalation Across Delegated Gateways

  • ▸Symptom: A compromised subagent attempts to invoke unlisted administrative tools (such as db_drop_table).
  • ▸Root Cause: The gateway relied on client-side tool filtering rather than enforcing server-side authorization checks on every incoming JSON-RPC frame.
  • ▸Resolution: Enforce mandatory gateway-level authorization middleware. If an incoming tools/call method requests a tool not explicitly listed in the session token's allowed_tools claim, immediately reject the call with JSON-RPC error code -32601 Method not found and terminate the session.

Error 3: Network Connection Severance in Long-Lived SSE Streams

  • ▸Symptom: Cloud firewalls or load balancers drop idle SSE connections after 60 seconds of inactivity.
  • ▸Root Cause: Intermediary HTTP proxies terminate streaming connections that do not transmit periodic data packets.
  • ▸Resolution: Configure the MCP SSE gateway to transmit periodic keep-alive comment frames (: ping\n\n) every 15 seconds.

6. External Citations and Security Guardrails

Official Specifications and References

Security and Isolation Guardrails

When federating agents across organizational boundaries:

  1. ▸Never Issue Long-Lived Access Tokens: Capability tokens must never exceed a 5-minute time-to-live window. Always enforce single-use or task-bounded revocation.
  2. ▸Enforce Read-Only Defaults: Ensure delegated MCP gateways block all mutating verbs (POST, PUT, DELETE, DROP, UPDATE) unless explicit cryptographic authorization and human approval are provided.
Ready to Deploy?

Build your full agent toolstack in the Visual Generator

Combine verified MCP servers with databases, search APIs, and memory graphs in a single configuration file.

Customize in Generator
Developer Verification & Feedback
0 reports

Did this setup guide work with your AI host?

Help test this configuration across Claude, Cursor, and Codex CLI. Be the first to report:

RT✓

Written by Rad Tome

Lead AI Systems Architect & Maintainer, MCP Codex

Specializing in Model Context Protocol (MCP) integrations, autonomous AI agent orchestration, and distributed developer toolchains. Researches and benchmarks production MCP client-server architectures across OpenAI Codex, Claude, and Cursor.

Editorial Integrity: Package names verified via npm registry API. Repositories verified via GitHub REST API.
Verification Charter →

Related Guides