Agent Protocols: MCP & A2A
The agents lesson shows an agent calling tools. The moment you have many agents and many tools, a quadratic problem appears: agents each needing bespoke integrations to tools is one-off connectors. Two open protocols attack this from different directions. MCP (Model Context Protocol) standardizes the vertical edge — how an agent reaches tools and data. A2A (Agent2Agent) standardizes the horizontal edge — how agents talk to each other. They are complementary, not competing: turn into .
The problem in one sentence each
One sentence each
MCP is "USB-C for AI tools": a single way for any LLM app to plug into any tool or data source. A2A is the protocol that lets an agent delegate a task to another agent it has never been hard-coded to know about.
MCP: reaching tools
An open standard (introduced by Anthropic, late 2024) with a client–server architecture spoken over JSON-RPC 2.0 — a minimal request/response format where each message carries a method, params, and an id to match replies to requests:
- Host: the LLM application (e.g. an IDE assistant, a chat app).
- Client: lives inside the host; maintains a 1:1 connection to one server.
- Server: a lightweight process exposing capabilities for a specific system (a database, GitHub, a filesystem, Slack).
The transport is JSON-RPC over stdio (local subprocess) or streamable HTTP / SSE (remote). A server exposes three primitives:
| Primitive | What it is | Controlled by |
|---|---|---|
| Tools | functions the model can invoke (side effects) | model decides |
| Resources | read-only data the host can attach to context (files, rows) | app/user selects |
| Prompts | reusable templated workflows | user invokes |
A session starts with an initialize handshake (capability negotiation), then the client discovers tools with tools/list and invokes them with tools/call:
// client → server
{"jsonrpc":"2.0","id":1,"method":"tools/list"}
// server → client
{"jsonrpc":"2.0","id":1,"result":{"tools":[
{"name":"get_weather","description":"Current weather for a city.",
"inputSchema":{"type":"object","properties":{"city":{"type":"string"}},
"required":["city"]}}]}}
// client → server
{"jsonrpc":"2.0","id":2,"method":"tools/call",
"params":{"name":"get_weather","arguments":{"city":"Paris"}}}
That inputSchema is the same JSON-Schema function-calling contract from the agents lesson — MCP just standardizes discovery and transport so a tool server written once works with any MCP-capable host.
A2A: agents collaborating
An open standard (introduced by Google, 2025) for agent-to-agent collaboration across vendors and frameworks. Where MCP connects an agent down to tools, A2A connects agents across to peers, treating a remote agent as an opaque collaborator rather than a callable function. Core concepts:
- Agent Card: a JSON document (served at a well-known URL) advertising an agent's identity, skills, endpoint, and auth requirements. This is capability discovery: an agent finds out what another can do without prior hard-coding.
- Task: the unit of work, with a lifecycle (
submitted → working → input-required → completed/failed). Long-running tasks stream status updates over SSE. - Message / Part: turns exchanged within a task; a Part carries text, files, or structured data (multi-modal by design).
- Artifact: the produced output of a task.
A client agent discovers a remote agent's card, sends a task, and receives streamed updates and artifacts:
// 1. fetch https://billing.example.com/.well-known/agent.json → Agent Card
// 2. client → remote agent
{"jsonrpc":"2.0","id":1,"method":"message/send",
"params":{"message":{"role":"user",
"parts":[{"kind":"text","text":"refund order #4471"}]}}}
// 3. remote agent streams: working → completed, returning an Artifact
Composing MCP and A2A
┌─────────────┐ A2A (agent ↔ agent) ┌─────────────┐
│ Orchestrator│ ◀───────────────────────────▶ │ Billing │
│ agent │ │ agent │
└──────┬──────┘ └──────┬──────┘
│ MCP (agent ↔ tools/data) │ MCP
┌──────▼──────┐ ┌──────▼──────┐
│ web-search │ │ filesystem │ │ database │ │ Stripe API │
└─────────────┘ servers └─────────────┘
An orchestrator uses MCP to reach its own tools and A2A to delegate a sub-goal (issuing a refund) to a specialist billing agent, which in turn uses its own MCP servers. The protocols stack cleanly.
| MCP | A2A | |
|---|---|---|
| Connects | agent ↔ tools / data | agent ↔ agent |
| Remote side is | a tool/resource provider | an autonomous agent |
| Discovery | tools/list | Agent Card |
| Unit | tool call / resource read | Task (with lifecycle) |
| Transport | JSON-RPC over stdio / HTTP-SSE | JSON-RPC / HTTP + SSE |
| Analogy | USB-C for tools | agents hiring agents |
Widening the attack surface
Both standards move untrusted content and capability across trust boundaries — exactly the risk the agents lesson flagged.
Trust does not come for free
An MCP server can return content containing indirect prompt injection; a malicious or compromised server is a confused-deputy waiting to happen. An A2A peer is an opaque agent you may not fully trust. Apply least privilege (expose only needed tools), authenticate servers and agent cards, validate every tool I/O, and gate irreversible actions behind human approval. A standardized protocol makes integration easy and makes a bad actor's integration easy.
Common mistakes
- Treating MCP and A2A as competitors. They occupy different layers; most real systems use both.
- Trusting tool/agent output blindly. Protocol responses are untrusted input — sanitize and validate before feeding them back to the model.
- Over-granting capability. Connecting every MCP server "just in case" bloats the tool list (hurting selection) and widens the blast radius of a compromise.
- Ignoring task lifecycle in A2A. Long-running tasks emit
input-requiredand intermediate states; a client that only handlescompletedwill hang or drop work.
Related concepts
- Agents & Tool Use: function calling and the reliability/security concerns these protocols inherit
- AI-Engineering Architecture: guardrails, auth, and observability for multi-agent systems
- LangGraph: Agents as State Graphs: an orchestration layer that frequently consumes MCP tools and A2A peers as graph nodes
- Prompt Injection: Attack Taxonomy & Defenses: the full treatment of the risk this page's "Widening the attack surface" section flags