Skip to content

Giao thức AI Agent (MCP & A2A)

Câu hỏi cốt lõi

AI Agent "giao tiếp" với thế giới bên ngoài như thế nào? Giống như Internet cần giao thức HTTP, AI Agent cũng cần giao thức truyền thông được chuẩn hóa. Chương này giới thiệu hai giao thức Agent phổ biến nhất: MCP và A2A, tương ứng giải quyết vấn đề truyền thông giữa AI và công cụ, cũng như giữa Agent với Agent.


0. Giao thức là gì?

Trong lĩnh vực máy tính, Giao thức (Protocol) là một tập hợp các quy tắc và quy ước được chuẩn hóa, cho phép các hệ thống và chương trình khác nhau "hiểu" và "giao tiếp" lẫn nhau.

0.1 Tại sao cần giao thức?

Hãy tưởng tượng một tình huống: bạn gửi hàng cho bạn bè và cần điền địa chỉ. Nếu mỗi người viết địa chỉ theo định dạng khác nhau, người giao hàng sẽ không thể giao được. Giao thức chính là tiêu chuẩn quy định "cách viết địa chỉ" — tỉnh/thành, quận/huyện, phường/xã, đường, số nhà, viết theo định dạng này thì ai cũng có thể hiểu.

Máy tính cũng vậy. Hai chương trình muốn giao tiếp phải thỏa thuận:

  • Định dạng dữ liệu là gì? (JSON? Nhị phân?)
  • Cách thiết lập kết nối? (Quy trình bắt tay)
  • Lỗi thì xử lý thế nào? (Xử lý lỗi)

0.2 Các giao thức phổ biến trong máy tính

Giao thứcTác dụngBạn sử dụng mỗi ngày
HTTPGiao thức truyền tải webTrình duyệt mở trang web
HTTPSHTTP được mã hóaNgân hàng trực tuyến, trang thanh toán
TCP/IPGiao thức nền tảng InternetTất cả truyền thông mạng
DNSGiao thức phân giải tên miềnChuyển google.com thành địa chỉ IP
SMTPGiao thức gửi thưGửi email
WebSocketTruyền thông hai chiều thời gian thựcPhần mềm chat, trò chơi trực tuyến
SSHĐăng nhập từ xa an toànKết nối máy chủ
FTPGiao thức truyền tệpTải lên/tải xuống tệp

Các giao thức này tạo nên nền tảng của Internet. Không có chúng, bạn không thể duyệt web, gửi email hay xem video.

0.3 Giá trị của giao thức

Giá trị cốt lõi của giao thức là tiêu chuẩn hóakhả năng tương tác:

  • Tiêu chuẩn hóa: Tất cả làm việc theo cùng một bộ quy tắc, giảm chi phí giao tiếp
  • Khả năng tương tác: Các hệ thống từ nhà cung cấp khác nhau, stack công nghệ khác nhau có thể kết nối liền mạch

Ví dụ, giao thức HTTP cho phép trình duyệt Chrome truy cập máy chủ Nginx, cho phép crawler Python thu thập dữ liệu từ trang web Java. Chrome và Nginx không cần "biết" nhau, chỉ cần tuân thủ giao thức HTTP.

0.4 AI Agent cũng cần giao thức

Để AI Agent thực sự "làm việc", cần:

  • Gọi công cụ bên ngoài (xem thời tiết, gửi email, thao tác cơ sở dữ liệu)
  • Hợp tác với Agent khác (phân công công việc hoàn thành nhiệm vụ phức tạp)

Điều này đòi hỏi giao thức chuẩn hóa để quy định "AI gọi công cụ như thế nào", "Agent giao tiếp với nhau ra sao". Đây chính là nguồn gốc của MCPA2A.


1. Các tầng giao thức Agent

Trước khi tìm hiểu chi tiết các giao thức cụ thể, hãy xem các tầng truyền thông trong hệ sinh thái Agent:

TầngGiao thứcVấn đề giải quyếtSo sánh
1Function CallAI gọi hàm cục bộ như thế nàoNão bộ phát lệnh
2MCPAI kết nối công cụ và nguồn dữ liệu bên ngoài như thế nàoCổng USB-C
3A2AAgent giao tiếp và hợp tác với nhau như thế nàoWeChat doanh nghiệp

Giải thích từng dòng trong bảng

Tầng 1 (Function Call): Đây là khả năng cơ bản nhất của mô hình lớn — kích hoạt thực thi hàm thông qua việc tạo dữ liệu có cấu trúc (JSON). Nó là nền tảng của "giao thức", nhưng bản thân nó giống một khả năng hơn là giao thức chuẩn.

Tầng 2 (MCP): Model Context Protocol, do Anthropic phát hành tháng 11 năm 2024. Nó chuẩn hóa cách AI kết nối với công cụ và nguồn dữ liệu bên ngoài, giống như USB-C đã thống nhất cổng sạc của nhiều thiết bị.

Tầng 3 (A2A): Agent-to-Agent Protocol, do Google phát hành tháng 4 năm 2025. Nó cho phép các Agent khác nhau khám phá, giao tiếp và hợp tác lẫn nhau, giống như WeChat doanh nghiệp cho phép đồng nghiệp giao việc và trò chuyện.

Chương này tập trung vào hai giao thức chính thức ở tầng 2 và 3: MCP và A2A.


2. MCP (Model Context Protocol)

2.1 Thông tin cơ bản về giao thức

MụcNội dung
Tên đầy đủModel Context Protocol
Đơn vị khởi xướngAnthropic
Thời gian phát hành25 tháng 11 năm 2024
Tài liệu chính thứcmodelcontextprotocol.io
Giấy phép nguồn mởMIT License
GitHubgithub.com/modelcontextprotocol

Tại sao gọi là "Context Protocol"?

Context (Ngữ cảnh) là yếu tố then chốt để mô hình lớn hiểu nhiệm vụ. Ý tưởng cốt lõi của MCP là: cho phép AI dynamically lấy thông tin ngữ cảnh cần thiết, thay vì nhét tất cả thông tin vào Prompt.

Ví dụ, khi AI cần đọc một tệp, bạn không cần sao chép dán nội dung tệp, mà thông qua MCP truy cập trực tiếp hệ thống tệp.

2.2 Bối cảnh phát hành

Năm 2024, với việc phát hành Claude 3.5 Sonnet, Anthropic phát hiện một vấn đề: mỗi công cụ đều phải tích hợp riêng.

Hãy tưởng tượng:

  • Bạn muốn AI đọc kho mã GitHub → phải viết code tích hợp GitHub
  • Bạn muốn AI truy vấn cơ sở dữ liệu → phải viết code tích hợp cơ sở dữ liệu
  • Bạn muốn AI thao tác hệ thống tệp → phải viết code tích hợp hệ thống tệp

Mỗi tích hợp đều phải viết lại code tương tự: xác thực, xử lý lỗi, chuyển đổi dữ liệu...

Anthropic đã viết trên blog chính thức:

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

Mục tiêu cốt lõi: Cho phép nhà phát triển công cụ viết code một lần, tất cả ứng dụng AI hỗ trợ MCP đều có thể sử dụng.

2.3 MCP là gì?

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.

Ba năng lực cốt lõi:

Năng lựcTiếng AnhTác dụngVí dụ
Công cụToolsChức năng AI có thể gọiTruy vấn thời tiết, gửi email
Tài nguyênResourcesDữ liệu AI có thể đọcNội dung tệp, bản ghi cơ sở dữ liệu
PromptPromptsMẫu prompt được định nghĩa trướcMẫu review code, mẫu viết

2.4 Triển khai nội bộ của 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 So sánh: Cổng USB-C

MCP giống như cổng USB-C:

  • Trước đây: Mỗi thiết bị có cổng sạc riêng (tròn, dẹt, từ tính...)
  • Bây giờ: USB-C đã thống nhất cổng sạc và truyền dữ liệu của tất cả thiết bị
  • MCP: Thống nhất cách AI kết nối với tất cả công cụ

Nhà phát triển công cụ chỉ cần triển khai một MCP Server, tất cả ứng dụng AI hỗ trợ MCP (Claude, Cursor, Windsurf, v.v.) đều có thể sử dụng trực tiếp.

2.6 Kịch bản ứng dụng điển hình của MCP

Kịch bảnMô tảVí dụ
Thao tác tệp cục bộCho phép AI đọc/sửa tệp cục bộĐọc kho mã, phân tích tệp log
Truy vấn cơ sở dữ liệuCho phép AI truy vấn trực tiếp cơ sở dữ liệuTruy vấn SQL, phân tích dữ liệu
Gọi APICho phép AI gọi dịch vụ bên thứ baGitHub API, Slack, email
Tích hợp công cụ phát triểnCho phép AI sử dụng công cụ phát triểnThao tác Git, lệnh terminal

Trường hợp thực tế:

  • Cursor/Windsurf: Kết nối hệ thống tệp, Git, terminal qua MCP
  • Claude Desktop: Kết nối phần mềm ghi chú, email client qua MCP
  • Script tự động: Cho phép AI thực thi tác vụ tự động (sao lưu, triển khai, đồng bộ dữ liệu)

3. A2A (Agent-to-Agent Protocol)

3.1 Thông tin cơ bản về giao thức

MụcNội dung
Tên đầy đủAgent-to-Agent Protocol
Đơn vị khởi xướngGoogle
Thời gian phát hành9 tháng 4 năm 2025
Tài liệu chính thứcgoogle.github.io/A2A
Giấy phép nguồn mởApache 2.0
GitHubgithub.com/google/A2A

Tại sao Google khởi xướng?

Google phát hành A2A tại hội nghị Cloud Next 2025, liên quan chặt chẽ đến chiến lược AI doanh nghiệp.

Google tin rằng: AI doanh nghiệp trong tương lai không phải là một siêu Agent đơn lẻ, mà là nhiều Agent chuyên môn hợp tác — có Agent phụ trách phân tích dữ liệu, có Agent phụ trách tạo mã, có Agent phụ trách xử lý tài liệu.

Các Agent này cần một cách chuẩn hóa để giao tiếp với nhau, A2A ra đời cho mục đích này.

3.2 Bối cảnh phát hành

MCP đã giải quyết vấn đề "AI kết nối công cụ như thế nào", nhưng còn một vấn đề: nhiều Agent hợp tác như thế nào?

Hãy tưởng tượng kịch bản:

  • Agent A là "chuyên gia phân tích yêu cầu"
  • Agent B là "chuyên gia tạo mã"
  • Agent C là "chuyên gia kiểm thử"

Người dùng nói: "Giúp tôi phát triển chức năng đăng nhập"

Agent A phân tích yêu cầu, cần giao việc cho Agent B; Agent B viết xong mã, cần Agent C kiểm thử. Chúng giao tiếp với nhau thế nào?

Google đã viết trên blog chính thức:

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

Mục tiêu cốt lõi: Cho phép các Agent do nhà cung cấp và framework khác nhau phát triển hợp tác liền mạch.

3.3 A2A là gì?

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.

Ba khái niệm cốt lõi:

Khái niệmTiếng AnhTác dụngSo sánh
Agent CardDanh thiếp AgentMô tả khả năng của AgentThẻ nhân viên
TaskNhiệm vụĐơn vị công việc cần thực hiệnPhiếu công việc
MessageTin nhắnNội dung giao tiếp giữa các AgentLịch sử trò chuyện

3.4 Triển khai nội bộ của 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 So sánh: WeChat Doanh nghiệp

A2A giống như WeChat Doanh nghiệp:

  • Agent Card: Danh thiếp của mỗi người, hiển thị tên, phòng ban, trách nhiệm
  • Giao việc: @ai đó, phân công một nhiệm vụ
  • Chat giao tiếp: Có thể trò chuyện bất cứ lúc nào trong quá trình thực thi nhiệm vụ
  • Theo dõi nhiệm vụ: Có thể xem tiến độ và trạng thái nhiệm vụ

Các Agent khác nhau giống như các đồng nghiệp khác nhau, A2A cho phép họ hợp tác hoàn thành dự án phức tạp.

3.6 Kịch bản ứng dụng điển hình của A2A

Kịch bảnMô tảVí dụ
Phát triển phần mềmNhiều Agent hợp tác hoàn thành nhiệm vụ phát triểnPhân tích yêu cầu→Mã→Kiểm thử→Triển khai
Quy trình công việc doanh nghiệpAgent các phòng ban khác nhau hợp tác xử lý nghiệp vụAgent HR + Agent Tài chính + Agent Pháp chế
Chăm sóc khách hàng thông minhNhiều Agent chuyên môn phân công xử lýTiếp nhận→Giải đáp→Chuyển tiếp→Ghi nhận
Phân tích dữ liệuNhiều Agent hợp tác phân tích dữ liệuThu thập→Làm sạch→Phân tích→Trực quan→Báo cáo

Trường hợp thực tế:

  • Google Agent Space: Nhiều Agent trong doanh nghiệp hợp tác xử lý tài liệu, email, lịch trình
  • Đội phát triển phần mềm: Agent Yêu cầu → Agent Mã → Agent Kiểm thử → Agent Triển khai
  • Hệ thống chăm sóc khách hàng thông minh: Agent Tiếp nhận → Agent Giải đáp Chuyên môn → Agent Chuyển tiếp Nhân viên

4. MCP vs A2A: So sánh và Mối quan hệ

4.1 Khác biệt cốt lõi

ChiềuMCPA2A
Đơn vị khởi xướngAnthropic (2024.11)Google (2025.04)
Định vịKết nối giữa AI và công cụHợp tác giữa Agent và Agent
Phạm vi truyền thôngClient-ServerPeer-to-Peer
Định dạng dữ liệuJSON-RPC 2.0HTTP + JSON
So sánhCổng USB-CWeChat doanh nghiệp

4.2 Mối quan hệ giữa hai giao thức

MCP và A2A không cạnh tranh mà bổ sung cho nhau:

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 Cách lựa chọn?

Kịch bảnLựa chọn
Cho AI gọi hàm hoặc công cụ cục bộFunction Call
Sử dụng công cụ bên thứ ba (cơ sở dữ liệu, API, hệ thống tệp)MCP
Xây dựng hệ thống hợp tác đa AgentA2A
Cần cả tích hợp công cụ và hợp tác đa AgentMCP + A2A

5. Xu hướng tương lai của giao thức

5.1 Phát triển hệ sinh thái

Hệ sinh thái MCP (đầu năm 2025):

  • Server chính thức cung cấp: hệ thống tệp, SQLite, Git, PostgreSQL, v.v.
  • Server do cộng đồng đóng góp: Slack, Notion, Figma, Stripe, v.v.
  • Ứng dụng hỗ trợ MCP: Claude Desktop, Cursor, Windsurf, Zed, v.v.

Hệ sinh thái A2A (vừa phát hành):

  • Sản phẩm Agent của Google率先 hỗ trợ
  • Cộng đồng nguồn mở đang phát triển SDK cho nhiều ngôn ngữ
  • Ứng dụng doanh nghiệp đang trong giai đoạn khám phá

5.2 Quá trình tiêu chuẩn hóa

Hiện tại giao thức Agent vẫn đang trong "thời kỳ Chiến quốc":

  • MCP và A2A là hai giao thức phổ biến nhất
  • Còn có các giao thức mới nổi như ANP, AGP, v.v.
  • Tương lai có thể hợp nhất hoặc thống nhất

So sánh với sự phát triển của Internet:

  • Giai đoạn đầu: Nhiều giao thức mạng cục bộ cùng tồn tại
  • Giai đoạn sau: TCP/IP trở thành tiêu chuẩn
  • Hiện tại: Giao thức Agent cũng có thể tiến tới thống nhất

6. Tổng kết

Điểm chính

Giao thứcHiểu trong một câuThời gian phát hànhĐơn vị khởi xướngKịch bản áp dụng
MCP"USB-C" kết nối AI với công cụ2024.11AnthropicTích hợp công cụ, kết nối nguồn dữ liệu
A2A"WeChat doanh nghiệp" của hợp tác Agent2025.04GoogleHợp tác đa Agent, ủy thác nhiệm vụ

Nhận định chính:

  1. MCP giải quyết vấn đề "AI lấy năng lực bên ngoài như thế nào"
  2. A2A giải quyết vấn đề "nhiều AI hợp tác với nhau như thế nào"
  3. Cả hai bổ sung cho nhau, tương lai có thể sử dụng kết hợp
  4. Chọn giao thức theo kịch bản cụ thể, không có giải pháp hoàn hảo cho mọi trường hợp

Tài liệu tham khảo

  1. Tài liệu chính thức MCP: modelcontextprotocol.io
  2. GitHub MCP: github.com/modelcontextprotocol
  3. Blog phát hành Anthropic: "Introducing the Model Context Protocol" (2024-11-25)
  4. Tài liệu chính thức A2A: google.github.io/A2A
  5. GitHub A2A: github.com/google/A2A
  6. Google CloudBlog: "Announcing the Agent-to-Agent Protocol" (2025-04-09)