Skip to content

AI Agent Protocols (MCP & A2A)

The Core Question

How do AI Agents "talk" to the external world? Just as the internet needs the HTTP protocol, AI Agents also need standardized communication protocols. This chapter introduces the two most mainstream Agent protocols: MCP and A2A, which respectively solve the problems of AI-to-tool and Agent-to-Agent communication.


0. What Is a Protocol?

In computing, a protocol is a set of standardized rules and conventions that enable different systems and programs to "understand" and "communicate" with each other.

0.1 Why Do We Need Protocols?

Imagine this scenario: you send a package to a friend and need to write the address. If everyone wrote addresses in a different format, the courier wouldn't be able to deliver anything. A protocol is the standard that defines "how to write an address" — province, city, district, street, house number. Write it this way, and anyone can understand it.

The same goes for computers. For two programs to communicate, they must agree on:

  • What is the data format? (JSON? Binary?)
  • How to establish a connection? (Handshake process)
  • What to do when errors occur? (Error handling)

0.2 Common Protocols in Computing

ProtocolPurposeYou Use It Every Day
HTTPWeb page transfer protocolOpening web pages in a browser
HTTPSEncrypted HTTPOnline banking, payment pages
TCP/IPInternet foundation protocolAll network communication
DNSDomain name resolutionTranslating google.com into an IP address
SMTPEmail sending protocolSending emails
WebSocketBidirectional real-time communicationChat apps, online games
SSHSecure remote loginConnecting to servers
FTPFile transfer protocolUploading/downloading files

These protocols form the cornerstone of the internet. Without them, you couldn't browse the web, send emails, or watch videos.

0.3 The Value of Protocols

The core value of protocols lies in standardization and interoperability:

  • Standardization: Everyone follows the same set of rules, reducing communication overhead
  • Interoperability: Systems from different vendors and tech stacks can integrate seamlessly

For example, the HTTP protocol allows Chrome to access Nginx servers, and enables a Python crawler to fetch data from a Java website. Chrome and Nginx don't need to "know" each other — they just need to both follow the HTTP protocol.

0.4 AI Agents Need Protocols Too

For AI Agents to actually "get work done," they need to:

  • Call external tools (check the weather, send emails, query databases)
  • Collaborate with other Agents (divide work to complete complex tasks)

This requires standardized protocols that define "how AI invokes tools" and "how Agents communicate with each other." This is where MCP and A2A come from.


1. The Layers of Agent Protocols

Before diving into specific protocols, let's look at the communication layers in the Agent ecosystem:

LayerProtocolProblem SolvedAnalogy
1Function CallHow AI calls local functionsThe brain issuing commands
2MCPHow AI connects to external tools and data sourcesUSB-C connector
3A2AHow Agents collaborate and communicateWeChat Work

Reading This Table Line by Line

Layer 1 (Function Call): This is the most fundamental capability of large models — triggering function execution by outputting structured data (JSON). It's the foundation of "protocols," but is more of a capability than a formal standard.

Layer 2 (MCP): Model Context Protocol, released by Anthropic in November 2024. It standardizes how AI connects to external tools and data sources, just as USB-C unified charging ports across all kinds of devices.

Layer 3 (A2A): Agent-to-Agent Protocol, released by Google in April 2025. It enables different Agents to discover, communicate with, and collaborate with each other, just as WeChat Work lets colleagues send tasks and chat.

This chapter focuses on the two formal protocols at layers 2 and 3: MCP and A2A.


2. MCP (Model Context Protocol)

2.1 Basic Protocol Information

ItemDetails
Full NameModel Context Protocol
Proposed ByAnthropic
Release DateNovember 25, 2024
Official Documentationmodelcontextprotocol.io
LicenseMIT License
GitHubgithub.com/modelcontextprotocol

Why Is It Called "Context Protocol"?

Context is key to how large models understand tasks. The core idea behind MCP is: enabling AI to dynamically obtain the context information it needs, rather than stuffing everything into the Prompt.

For example, when AI needs to read a file, you don't need to copy and paste the file content — it can access the file system directly through MCP.

2.2 Background of Its Release

In 2024, with the release of Claude 3.5 Sonnet, Anthropic identified a problem: every tool required separate integration.

Imagine:

  • You want AI to read a GitHub repo → write GitHub integration code
  • You want AI to query a database → write database integration code
  • You want AI to operate on the file system → write file system integration code

Each integration requires writing similar code repeatedly: authentication, error handling, data transformation…

Anthropic wrote in their official blog:

"We're introducing the Model Context Protocol (MCP), an open protocol that standardizes how applications provide context to LLMs."

Core goal: Let tool developers write code once, and have it usable by all MCP-compatible AI applications.

2.3 What Is MCP?

What is MCP?
MCP (Model Context Protocol) is a unified standard introduced by Anthropic in November 2024 for connecting AI with external tools. It lets AI applications call tools, read resources, and use predefined prompts, giving AI practical "hands" and "eyes".
Three Core Capabilities
Capability
English
Role
Example
Tools
Tools
Functions AI can call
Check weather, send email, call APIs
Resources
Resources
Data AI can read
File content, database records, configuration
Prompts
Prompts
Predefined prompt templates
Code review templates, writing templates
When should you use MCP?
When AI needs to perform real actions
AI should not only answer questions, but also send emails, operate files, and call third-party APIs.
When AI needs access to private data
Read local files, query databases, or access internal business systems.
When tool integration should be standardized
Build once and reuse across AI applications such as Claude, Cursor, and Windsurf.
How do you use MCP?
1
Develop an MCP Server
Implement a server that provides tools, resources, and prompts according to the MCP spec.
2
Configure the AI app connection
Add the MCP Server configuration to your AI app, either local or remote.
3
Let AI call it automatically
AI discovers and calls suitable tools or reads resources based on the task.

Three Core Capabilities:

CapabilityDescriptionExample
ToolsFunctions AI can invokeCheck weather, send email
ResourcesData AI can readFile contents, database records
PromptsPredefined prompt templatesCode review template, writing template

2.4 Internal Implementation of MCP

MCP InternalsCommunication details of the client-server architecture
Why is MCP so popular?

Before MCP, AI could only read and respond. With MCP, AI can finally take action by operating programs and helping with real work.

How do you use MCP?

Using MCP is simple: configure an mcp.json file, then your IDE can use MCP tools.

1
Find an MCP Server
Find the MCP Server you need from an MCP directory or GitHub.
2
Configure mcp.json
Find the MCP config location in your AI editor, such as Cursor or Claude Desktop, and add the server configuration.
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/home/user/projects"
      ]
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_TOKEN": "your-token-here"
      }
    },
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres"],
      "env": {
        "DATABASE_URL": "postgresql://user:pass@localhost/db"
      }
    }
  }
}
3
Restart the IDE
After restart, AI discovers and loads MCP tools automatically, so you can ask it to use them.
Are Skills replacing MCP?
As Skills become more common, many scenarios are starting to use Skills instead of the MCP protocol. Skills are lighter and easier to write for common tasks. MCP remains better for complex tool integrations and reuse across multiple clients. For simple operations, consider Skills first.
Common mcp.json locations
Cursor~/.cursor/mcp.json
Claude Desktop~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
Windsurf~/.windsurf/mcp.json
How do you implement an MCP Server?

Suppose you have a weather API and want to wrap it as an MCP Server that AI can call. This Node.js example shows the shape:

weather-mcp-server.js
import { Server } from '@modelcontextprotocol/sdk/server/index.js'
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'

// 1. Create MCP Server
const server = new Server({
  name: 'weather-server',
  version: '1.0.0'
}, {
  capabilities: { tools: {} }
})

// 2. Define tool list
server.setRequestHandler('tools/list', async () => ({
  tools: [{
    name: 'get_weather',
    description: 'Get weather for a city',
    inputSchema: {
      type: 'object',
      properties: {
        city: { type: 'string', description: 'City name' }
      },
      required: ['city']
    }
  }]
}))

// 3. Implement tool call logic
server.setRequestHandler('tools/call', async (request) => {
  const { name, arguments: args } = request.params

  if (name === 'get_weather') {
    // Call your weather API
    const response = await fetch(
      `https://api.weather.com/v1/current?city=${args.city}`
    )
    const data = await response.json()

    return {
      content: [{
        type: 'text',
        text: JSON.stringify(data)
      }]
    }
  }
})

// 4. Start service through stdio
const transport = new StdioServerTransport()
await server.connect(transport)
stdio vs HTTP+SSE transport
stdio (local process)

The MCP Server runs as a child process and communicates through standard input and output.

Pros: simple, secure, and suitable for local tools.

Cons: local only; no remote access.

HTTP + SSE (remote service)

The MCP Server runs as an HTTP service and supports SSE pushes.

Pros: remote access and sharing across multiple clients.

Cons: requires server deployment and authentication.

Communication Flow (4 Steps)
1Handshake (initialize)
When the MCP Server starts, it sends an initialize request to the client and declares protocol version and capabilities.
Server → Client
// Server sends an initialize request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "initialize",
  "params": {
    "protocolVersion": "2024-11-05",
    "capabilities": {
      "tools": {},
      "resources": {},
      "prompts": {}
    },
    "serverInfo": {
      "name": "filesystem",
      "version": "1.0.0"
    }
  }
}
2List tools (tools/list)
3Call tool (tools/call)
4Return result
Deep Dive: JSON-RPC 2.0 Message Format
Request Message Structure
{
  "jsonrpc": "2.0",           // protocol version
  "id": 1,                     // request ID used to match response
  "method": "tools/call",      // method name
  "params": { ... }            // parameter object
}
Response Message Structure
// Successful response
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": { ... }
}

// Error response
{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32600,
    "message": "Invalid Request"
  }
}
JSON-RPC 2.0 is stateless. Every request includes an id so the client can match the response.
Deep Dive: Two Transport Modes
stdio (local process)
Used for local tools through standard input and output.
// Start MCP Server as a child process
npx @modelcontextprotocol/server-filesystem ./project

// Communicate through stdio
// stdin: receive requests
// stdout: send responses
HTTP + SSE (remote)
Used for remote services with long-lived push connections.
// HTTP transport with Server-Sent Events
POST /mcp HTTP/1.1
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": { ... }
}

// SSE long connection for push updates
GET /mcp/sse HTTP/1.1
// Continuously receive server updates
Deep Dive: MCP Core APIs
initializeInitialize
Server declares protocol version and capabilities to the client.
tools/listTool list
Get all available tools provided by the server.
tools/callCall tool
Call a specific tool and receive the result.
resources/listResource list
Get accessible resources such as files and databases.
resources/readRead resource
Read content from a specific resource.
prompts/listPrompt templates
Get predefined prompt templates.

2.5 An Analogy: The USB-C Connector

MCP is like the USB-C connector:

  • Before: Every device had its own charging port (round, flat, magnetic…)
  • Now: USB-C unifies charging and data transfer across all devices
  • MCP: Unifies how AI connects to all tools

Tool developers only need to implement an MCP Server once, and all MCP-compatible AI applications (Claude, Cursor, Windsurf, etc.) can use it directly.

2.6 Typical MCP Use Cases

ScenarioDescriptionExample
Local File OperationsLet AI read/modify local filesRead codebases, analyze log files
Database QueriesLet AI query databases directlySQL queries, data analysis
API CallsLet AI call third-party servicesGitHub API, Slack, email
Dev Tool IntegrationLet AI use development toolsGit operations, terminal commands

Real-World Examples:

  • Cursor/Windsurf: Connect to file system, Git, and terminal via MCP
  • Claude Desktop: Connect to note-taking apps and email clients via MCP
  • Automation Scripts: Let AI execute automated tasks (backups, deployments, data sync)

3. A2A (Agent-to-Agent Protocol)

3.1 Basic Protocol Information

ItemDetails
Full NameAgent-to-Agent Protocol
Proposed ByGoogle
Release DateApril 9, 2025
Official Documentationgoogle.github.io/A2A
LicenseApache 2.0
GitHubgithub.com/google/A2A

Why Was It Proposed by Google?

Google announced A2A at Cloud Next 2025, closely tied to its enterprise AI strategy.

Google believes that the future of enterprise AI is not a single super Agent, but multiple specialized Agents collaborating — some responsible for data analysis, some for code generation, some for document processing.

These Agents need a standardized way to communicate with each other, and A2A was born.

3.2 Background of Its Release

MCP solved the problem of "how AI connects to tools," but another question remained: how do multiple Agents collaborate?

Imagine this scenario:

  • Agent A is a "requirements analysis expert"
  • Agent B is a "code generation expert"
  • Agent C is a "testing expert"

A user says: "Help me develop a login feature"

Agent A analyzes the requirements and needs to delegate the task to Agent B; Agent B writes the code and needs Agent C to test it. How do they communicate with each other?

Google wrote in their official blog:

"A2A is an open protocol that enables AI agents to communicate with each other, facilitating collaboration across different frameworks and vendors."

Core goal: Enable Agents built by different vendors and frameworks to collaborate seamlessly.

3.3 What Is A2A?

What is A2A?
A2A (Agent-to-Agent Protocol) is a communication standard introduced by Google in April 2025 for collaboration between agents. It lets agents from different vendors and frameworks discover each other, assign tasks, and exchange information, like an intercom for the AI world.
Core Concepts
Agent Card
Public metadata for each agent, including capability descriptions, version, and endpoint.
Task
A work unit passed between agents. It can include multi-turn dialogue and file attachments.
Message
Communication content between agents, supporting text, files, audio, and other modalities.
SSE (Server-Sent Events)
A server push mechanism used for real-time task progress updates.
When should you use A2A?
When multiple agents need to complete a complex task
One agent analyzes requirements, another writes code, and another tests the result.
When integrating agents from different vendors
Agents from Google, Anthropic, OpenAI, and others need to collaborate.
When task delegation and progress tracking are needed
A main agent assigns work to expert agents and receives live progress updates.
How do you use A2A?
1
Publish an Agent Card
Expose the agent capability description at /.well-known/agent.json.
2
Discover agents
Use the agents/get API to fetch another agent card and inspect capabilities.
3
Send a task
Use the tasks/send API to send work, optionally receiving progress through SSE.
4
Fetch the result
After completion, use the tasks/get API to retrieve the final result.

Three Core Concepts:

ConceptDescriptionAnalogy
Agent CardDescribes an Agent's capabilitiesEmployee badge
TaskA unit of work to be executedWork ticket
MessageCommunication content between AgentsChat history

3.4 Internal Implementation of A2A

A2A InternalsCommunication details of the peer-to-peer architecture
What can A2A do?

A2A lets multiple AI agents collaborate instead of working alone. A complex task can be assigned to specialized agents, each doing what it is best at.

How do you use A2A?

A2A is still early and mainly driven by Google. To try it, you need to develop an agent service that supports the A2A protocol.

1
Implement the Agent Card endpoint
Expose /.well-known/agent.json in your agent service and declare capabilities and version.
2
Implement A2A APIs
Implement core APIs such as agents/get, tasks/send, and tasks/get.
3
Deploy and register the agent
Deploy the agent to a server and register it so other agents can discover it.
Current Status
A2A was released in April 2025 and is still evolving quickly. Google provides reference implementations, while the ecosystem is still being built. Follow the official docs for current progress.
Communication Flow (5 Steps)
1Discovery (agents/get)
Agents fetch each other Agent Cards over HTTP to understand capabilities and versions.
HTTP request
// Agent A fetches Agent B's Agent Card
GET /.well-known/agent.json HTTP/1.1
Host: agent-b.company.com

// Response
{
  "name": "Code Agent",
  "description": "Professional code generation agent",
  "url": "https://agent-b.company.com",
  "version": "1.0.0",
  "capabilities": {
    "streaming": true,
    "pushNotifications": true
  },
  "skills": [
    {"id": "code-gen", "name": "Code generation"},
    {"id": "code-review", "name": "Code review"}
  ]
}
2Send task (tasks/send)
3Process task
4Push updates (SSE)
5Return result (tasks/get)
Deep Dive: Agent Card Format
An Agent Card is a JSON file, usually hosted at /.well-known/agent.json.
Agent Card Example
{
  "name": "Code Generation Agent",
  "description": "Professional frontend and backend code generation agent",
  "url": "https://code-agent.company.com",
  "version": "1.0.0",
  "capabilities": {
    "streaming": true,
    "pushNotifications": true
  },
  "skills": [
    {
      "id": "frontend",
      "name": "Frontend development",
      "description": "React/Vue/Angular"
    },
    {
      "id": "backend",
      "name": "Backend development",
      "description": "Node/Python/Go"
    }
  ],
  "authentication": {
    "schemes": ["Bearer", "OAuth2"]
  }
}
With Agent Cards, agents can discover each other, understand capabilities and versions, and interoperate.
Deep Dive: HTTP + SSE Communication
Task Send (HTTP POST)
POST /tasks/send HTTP/1.1
Host: agent-b.company.com
Content-Type: application/json
Authorization: Bearer {token}

{
  "id": "task-001",
  "message": {
    "role": "user",
    "parts": [{ "type": "text", "text": "Write a login endpoint" }]
  }
}
Real-time Push (SSE)
GET /tasks/task-001/sse HTTP/1.1
Authorization: Bearer {token}

event: progress
data: {"status": "processing", "progress": 50}

event: completed
data: {"status": "completed", "result": {...}}
SSE (Server-Sent Events) lets the server push messages, which works well for long-running task status updates.
Deep Dive: A2A Core APIs
GETagents/get
Fetch the target agent Agent Card and inspect capabilities.
POSTtasks/send
Send a task to the target agent and wait synchronously for the result.
POSTtasks/sendSubscribe
Send a task and subscribe to SSE progress updates.
GETtasks/get
Fetch task status and result by task ID.
GETtasks/cancel
Cancel a running task.
Deep Dive: Authentication
API Key
Simple authentication for internal agent communication.
Authorization: Bearer sk-xxxxx
# or
Authorization: ApiKey sk-xxxxx
OAuth 2.0
Enterprise authentication with token refresh and permission control.
Authorization: Bearer {access_token}
# refresh token supported
POST /oauth/token
{
  "grant_type": "refresh_token",
  "refresh_token": "xxx"
}

3.5 An Analogy: WeChat Work

A2A is like WeChat Work:

  • Agent Card: Everyone's business card, showing name, department, and responsibilities
  • Assigning Tasks: @someone, delegating a task
  • Chat Communication: Communicate anytime during task execution
  • Task Tracking: See the progress and status of tasks

Different Agents are like different colleagues — A2A enables them to collaborate on complex projects.

3.6 Typical A2A Use Cases

ScenarioDescriptionExample
Software DevelopmentMulti-Agent collaboration on development tasksRequirements → Code → Testing → Deployment
Enterprise WorkflowsAgents from different departments collaboratingHR Agent + Finance Agent + Legal Agent
Intelligent Customer ServiceMultiple specialized Agents dividing workReception → Answers → Transfer → Records
Data AnalysisMultiple Agents collaborating on data analysisCollection → Cleaning → Analysis → Visualization → Reporting

Real-World Examples:

  • Google Agent Space: Multiple Agents within an enterprise collaborating on documents, emails, and schedules
  • Software Dev Team: Requirements Agent → Code Agent → Testing Agent → Deployment Agent
  • Intelligent Customer Service: Reception Agent → Specialist Agent → Human Transfer Agent

4. MCP vs A2A: Comparison and Relationship

4.1 Core Differences

DimensionMCPA2A
Proposed ByAnthropic (2024.11)Google (2025.04)
PositioningAI-to-tool connectionAgent-to-Agent collaboration
Communication ScopeClient-ServerPeer-to-Peer
Data FormatJSON-RPC 2.0HTTP + JSON
AnalogyUSB-C connectorWeChat Work

4.2 Relationship Between the Two

MCP and A2A are not competitors, but complements:

MCP vs A2APositioning differences between two major AI Agent protocols
Imagine a large shopping mall: MCP is like a unified outlet standard, so every tool can plug in; A2A is like an internal intercom system, so different agents can coordinate with each other.
MCPTool connection
Model Context Protocol
A protocol that connects AI applications with external tools and data sources, so tool builders can write once and support many AI apps.
InitiatorAnthropic
Released2024.11
ArchitectureClient-Server
Data formatJSON-RPC 2.0
AnalogyUSB-C: one interface for many devices
A2AAgent collaboration
Agent-to-Agent Protocol
A communication protocol that lets agents from different vendors and frameworks collaborate smoothly.
InitiatorGoogle
Released2025.04
ArchitecturePeer-to-Peer
Data formatHTTP + JSON
AnalogyWork chat: coworkers can assign tasks and talk
Core idea:MCP and A2A are complementary, not competing. MCP answers "how can AI access external capabilities"; A2A answers "how can multiple AI agents collaborate".

4.3 How to Choose?

ScenarioChoice
Let AI call local functions or toolsFunction Call
Use third-party tools (databases, APIs, file systems)MCP
Build a multi-Agent collaboration systemA2A
Need both tool integration and multi-Agent collaborationMCP + A2A

5.1 Ecosystem Development

MCP Ecosystem (as of early 2025):

  • Official servers provided: File System, SQLite, Git, PostgreSQL, etc.
  • Community-contributed servers: Slack, Notion, Figma, Stripe, etc.
  • Applications supporting MCP: Claude Desktop, Cursor, Windsurf, Zed, etc.

A2A Ecosystem (newly released):

  • Google's own Agent products are the first to support it
  • The open-source community is developing SDKs in various languages
  • Enterprise applications are under exploration

5.2 The Standardization Process

Agent protocols are currently in a "Warring States" period:

  • MCP and A2A are the two most mainstream
  • There are other emerging protocols like ANP, AGP, etc.
  • They may converge or unify in the future

An analogy to the development of the internet:

  • Early days: various LAN protocols coexisted
  • Later: TCP/IP became the standard
  • Now: Agent protocols may also move toward unification

6. Summary

Key Takeaways

ProtocolOne-Line TakeawayRelease DateProposed ByUse Case
MCPThe "USB-C" for AI connecting to tools2024.11AnthropicTool integration, data source connection
A2AThe "WeChat Work" for Agent collaboration2025.04GoogleMulti-Agent collaboration, task delegation

Key Insights:

  1. MCP solves the problem of "how AI acquires external capabilities"
  2. A2A solves the problem of "how multiple AIs collaborate"
  3. The two are complementary and may be used together in the future
  4. Choose the protocol based on the specific scenario — there is no silver bullet

References

  1. MCP Official Documentation: modelcontextprotocol.io
  2. MCP GitHub: github.com/modelcontextprotocol
  3. Anthropic Announcement Blog: "Introducing the Model Context Protocol" (2024-11-25)
  4. A2A Official Documentation: google.github.io/A2A
  5. A2A GitHub: github.com/google/A2A
  6. Google Cloud Blog: "Announcing the Agent-to-Agent Protocol" (2025-04-09)