← All questions
AgentsMedium· Agents & Orchestration

Explain MCP and A2A and when you'd use each.

They’re complementary layers, not competing standards. Model Context Protocol (MCP) standardizes how an agent connects to tools — a consistent interface instead of a bespoke integration per tool. A2A standardizes how one agent delegates work to another agent — the inter-agent equivalent of the same idea.

The part worth naming beyond the definitions is the security framing, because both protocols expand an agent’s attack surface if adopted carelessly:

  • Allowlist which MCP servers an agent can reach — don’t let it discover and connect to arbitrary ones.
  • Give each server its own least-privilege credentials, scoped to only what that tool needs.
  • Treat tool output as untrusted input, not as trusted instructions — a compromised or malicious tool response shouldn’t be able to steer the agent’s next action.
  • Log at the protocol boundary so every tool call and delegation is auditable after the fact.

Code playground (Python)