Part 2: Building blocks
MCP: the integration layer
Build, buy and run MCP servers without inheriting someone else's security debt
In short
Build MCP servers like public APIs: one per system, owned, versioned, and secured with OAuth on every call.
Key ideas
- MCP turns N×M integrations into N+M
- 2026-07-28 made the core stateless: state lives in user-bound handles, and gateways never replace per-server token checks
- Prefer official or self-written servers, pin versions, diff descriptions; function calling for one agent, MCP for shared tools, A2A for independent agents
A summary only. The reasoning, examples, checklist and what to do on Monday are in the chapter. Read it in the book
98.7%
fewer tokens in Anthropic's code-execution example (illustrative)
>10,000
active public MCP servers, December 2025 (vendor figure)
Inside the chapter
- 1The problem MCP solves
- 2Architecture: hosts, clients, servers
- 3Transports: stdio vs Streamable HTTP
- 4Authorization
- 5Gateways and registries
- 6Spec timeline and governance
- 7Building a minimal MCP server
- 8Code execution with MCP
- 9Ecosystem reality
- 10MCP vs A2A vs plain function calling
Try it: function calling, MCP or A2A?
Score: 0 / 4
Start with function calling; extract an MCP server on the second consumer.
Item 1 of 4
One app calling 2 internal functions in its own codebase
Show the answers
One app calling 2 internal functions in its own codebase
Answer: Function calling. Only this agent uses the tools: keep them as functions.
The same ticket tools reused by an IDE assistant, a chat app and CI
Answer: MCP server. A tool that serves more than one client belongs in an MCP server.
Delegating a task to a partner's agent with its own planning and identity
Answer: A2A. The callee is an independent agent, not a tool: A2A.
A vendor's client must reach your knowledge-base search
Answer: MCP server. Vendor clients reaching your tool is the MCP case.
Go further: free on this site
Questions readers asked about this chapter, a 5-question self-check with explanations, and every source it cites.
Questions readers ask (3)
3 questions. Open one to read the answer.
Should I expose something as a tool, a resource or a prompt?
Default to tools: every client supports them and the model uses them without user action. Use a resource when a user should attach data on purpose, and a prompt for a user-picked template. Client support varies: Claude's API connector only supports tool calls (Claude docs). Unsure? Ship the tool, add the resource later.
Can my own agent code use MCP servers without a desktop host?
Yes. Run an official SDK client inside your agent, or let the model API call remote servers: Claude's Messages API has an MCP connector (beta, tool calls only) (Claude docs), and OpenAI's Responses API has an mcp tool with allowed_tools and approvals (OpenAI docs). Hosted is faster to start; your own client controls auth, logging and policy.
Who should approve third-party MCP servers, and how fast?
Security owns the policy; the requesting team does the first review with the ten-point checklist, and a security reviewer signs off. Aim for days: a slow process drives unmanaged installs. Record the result in your internal registry or gateway allowlist with a pinned version, owner and review date. Re-review when tools/list changes and on any CVE.
Answered in the book, not repeated here: See Chapter 4, How to pick a third-party MCP server; See Chapter 4, Authorization; See Chapter 4, The problem MCP solves
Self-check (5)
Score: 0 / 5 (0 answered)
Question 1 of 5
Your remote MCP server runs on three instances behind a round-robin load balancer. Under the 2026-07-28 revision, what do you need for routing?
Show the answer
Answer: B.
The stateless core lets any request hit any instance, but handshake-era clients still keep sessions in memory. Session IDs and SSE resumability no longer exist in the current revision.
Question 2 of 5
An export tool returns a handle that the status tool accepts. What must the server also do?
Show the answer
Answer: C.
The security page says servers must not treat possession of a state handle as authentication. An unguessable handle can still leak, so it does not replace the binding.
Question 3 of 5
You put an MCP gateway in front of all your servers, with per-caller allowlists and audit logs. What changes for each server behind it?
Show the answer
Answer: A.
A gateway is a choke point for policy and audit, not a replacement for authorization on the servers. Dropping validation behind it is the mistake the chapter quotes WorkOS warning against.
Question 4 of 5
A server is listed in the official MCP Registry under a verified namespace. What does that tell you?
Show the answer
Answer: D.
The registry verifies namespaces and hosts metadata; scanning is delegated elsewhere, and the registry itself is still in preview. Treat a listing as provenance, then run your own review.
Question 5 of 5
A tool is used only by one agent and lives in the same codebase. Next quarter, the IDE team wants to use it too. What does the chapter recommend?
Show the answer
Answer: B.
Function calling has the lowest overhead for a single consumer, and moving to MCP is cheap if the tool follows Chapter 3. A2A is for an independent agent that plans on its own, not for a tool.
Sources
Sources cited
- Anthropic, Donating the Model Context Protocol and establishing the Agentic AI Foundation, December 2025. anthropic.com
- Google Cloud, Announcing Model Context Protocol (MCP) support for Google services, December 2025. cloud.google.com
- OpenAI, Custom GPT retirement and migration FAQ (OpenAI Help Center), accessed November 2026. help.openai.com
- Model Context Protocol, Specification 2026-07-28: changelog, July 2026. modelcontextprotocol.io
- MCP blog, MCP Apps: Bringing UI Capabilities To MCP Clients, January 2026. blog.modelcontextprotocol.io
- Model Context Protocol, Security Best Practices (2026-07-28 specification), July 2026. modelcontextprotocol.io
- Anthropic, Bringing MCP 2026-07-28 to Claude, July 2026. claude.com
- MCP Python SDK docs, Serving legacy clients, accessed November 2026. py.sdk.modelcontextprotocol.io
- CrewAI docs, Changelog, accessed November 2026 (October 2026 entry). docs.crewai.com
- OX Security, The mother of all AI supply chains: critical systemic vulnerability at the core of the MCP, April 2026 (vendor research). ox.security
- Cloud Security Alliance, Research note: MCP by-design RCE (OX Security), April 2026. labs.cloudsecurityalliance.org
- Model Context Protocol, Authorization (2026-07-28 specification), July 2026. modelcontextprotocol.io
- WorkOS, MCP gateways compared: Cloudflare, Okta, Auth0 and Microsoft, October 2026. workos.com
- MCP blog, Introducing the MCP Registry, September 2025. blog.modelcontextprotocol.io
- Model Context Protocol, The MCP Registry, accessed November 2026. modelcontextprotocol.io
- Socket Threat Research, SANDWORM_MODE: npm worm poisons the AI toolchain, February 2026. socket.dev
- Model Context Protocol, Key Changes (2025-06-18 changelog), June 2025. modelcontextprotocol.io
- Model Context Protocol, Key Changes (2025-11-25 specification changelog), November 2025. modelcontextprotocol.io
- Linux Foundation, Linux Foundation Announces the Formation of the Agentic AI Foundation (AAIF), December 2025. linuxfoundation.org
- Model Context Protocol, The 2026-07-28 Specification (MCP blog), July 2026. blog.modelcontextprotocol.io
- Model Context Protocol Blog, The New MCP Roadmap, August 2026. blog.modelcontextprotocol.io
- Python Package Index, mcp (release 2.3.0), October 2026. pypi.org
- npm, @modelcontextprotocol/server (release 2.4.0), accessed November 2026. npmjs.com
- MCP Python SDK docs, Testing, accessed November 2026. py.sdk.modelcontextprotocol.io
- MCP TypeScript SDK docs, Testing (v2), accessed November 2026. ts.sdk.modelcontextprotocol.io
- Agentic AI Foundation, MCP Is Growing Up, May 2026. aaif.io
- Anthropic, Code execution with MCP: Building more efficient agents, November 2025. anthropic.com
- Bill Doerrfeld (Nordic APIs), 10 Interesting MCP Statistics, June 2026. nordicapis.com
Further reading
- Model Context Protocol, Specification (2026-07-28), July 2026. modelcontextprotocol.io
- Model Context Protocol, Model Context Protocol Blog. blog.modelcontextprotocol.io
- Invariant Labs, MCP Security Notification: Tool Poisoning Attacks, April 2025. invariantlabs.ai
- MCP Python SDK docs. py.sdk.modelcontextprotocol.io