Chapter 6

MCP & A2A

Tools (vertical) & agents (horizontal)

Scroll: course-full-protocols.html

Why

Why protocols?

Without MCP: N apps × N custom integrations

Without A2A: agents cannot delegate across vendors

MCP

Architecture

Host → Client → Server

tools · resources · prompts

MCP

Build a server

Python mcp + list_tools / call_tool

MCP

Server code

@app.list_tools()
async def list_tools():
    return [Tool(name="get_policy", ...)]

@app.call_tool()
async def call_tool(name, arguments):
    return [TextContent(type="text", text="30 days")]
MCP

Desktop config

"mcpServers": {
  "filesystem": {
    "command": "npx",
    "args": ["-y", "@modelcontextprotocol/server-filesystem", "C:/demo"]
  }
}
MCP

Demo steps

  1. Add config → quit & reopen Claude Desktop
  2. Settings → Developer → server green
  3. Ask: summarize README in demo folder
MCP

Transport

stdioSSE/HTTP
Child processRemote URL
Desktop devTeam / Docker
MCP

vs in-app tools

In-app = this codebase only

MCP = Cursor + Claude Desktop + any host

MCP

Troubleshoot

Restart host after config change

Absolute paths · validate inputSchema · narrow allowlist

A2A

Agent Card + Task

Discover agent → POST Task → poll Artifact

Like openapi.json for agents

A2A

HTTP example

POST /a2a/tasks
{"skill_id":"book_hotel","input":{...}}
→ {"state":"completed","artifacts":[...]}
Compare

MCP vs A2A

NeedUse
DB / files / APIMCP
Remote specialist agentA2A
Lab

MCP + mock A2A

  1. Filesystem MCP in Claude Desktop
  2. Custom get_policy server
  3. Sketch Weather Agent Card
  4. Diagram MCP vs A2A for your product

Chapter 6 done

Scroll lab: course-full-protocols.html#lab

Next: ⑦ OpenClaw & Hermes

Intro
1 / 1 Hub Space F