Agents and tools, 2 of 3, about 2 h 37 min of reading
Model Context Protocol (MCP)
About 2 h 27 min left
Concept. The Model Context Protocol (MCP) is the open protocol that lets an agent discover and call external tools, read data sources, and pull in prompt templates. It is the wiring that turns a chat model into an agent that can act. Anthropic introduced it and donated it to the Linux Foundation in December 2025, and Claude, ChatGPT, VS Code, Cursor and more now support it (MCP docs). This is a foundation week. You learn the protocol's trust model first, because MCP is also the most actively attacked surface in 2026. This week teaches the architecture and where it breaks; Workflow & Protocol Hijacking: MCP Deep DiveAgent identity and control, 1 of 3, about 11.4 h is the offensive CVE deep-dive that builds on it.
๐ฏ Objectives
By the end of this unit you can:
- Explain MCP's three primitives (tools, resources, prompts), the host, client and server model, and the two transports (stdio and streamable HTTP).
- Trace the tool discovery and dispatch flow, and name the two things the protocol trusts that it should not: the descriptions a server advertises, and the transport.
- Distinguish tool poisoning from ordinary indirect prompt injection. In tool poisoning the payload rides in tool metadata that the agent loads and trusts, so it can steer the agent before any tool runs; in ordinary injection the payload sits in a tool's output.
- List the poisoning variants: sidenote exfiltration, tool shadowing, rug pull, advanced tool poisoning attacks (ATPA, which CyberArk files under poisoning though the payload rides in a tool's output), and implicit (metadata-only) poisoning.
- Apply a layered defense: cryptographic tool verification (ETDI), decision-level detection (MindGuard), intent gating (Tool Attention), and the zero-trust checklist.
- Build a minimal MCP server with the Python SDK and audit it against the Vulnerable MCP catalog.
- (Go deeper) Verify DPoP proofs (RFC 9449) and validate client ID metadata documents on a local target, and say what each stops and what it leaves to the consent screen and the client.
The big picture
Suppose you plug a new tool server into your coding assistant. Before you call anything, the assistant has already asked the server what it offers and read the answer. That exchange is how MCP works, and it is where this week's attacks start.
MCP is a client-server protocol spoken over JSON-RPC. A host (Claude Code, Cursor, a desktop app) runs one or more clients, and each client connects to a server that exposes capabilities. Think of USB-C: you build a tool once and plug it into any MCP-aware agent (MCP docs). Servers offer three primitives, and who controls each one is the first security fact worth memorizing (Anthropic: Intro to MCP).
| Primitive | Controlled by | What it is | Risk lens |
|---|---|---|---|
| Tools | model | Functions the language model decides to call (with user approval) | They execute actions, so they are the remote code execution (RCE) and exfiltration surface |
| Resources | application | File-like data the client reads (files, API responses) | Untrusted content, so indirect prompt injection |
| Prompts | user | Pre-written templates the user invokes | Lowest risk, because the user starts them |
Two transports carry the JSON-RPC. With stdio, the server is a local subprocess:
the host hands it a command and args and pipes messages to it. With streamable
HTTP, the server is remote. Discovery works by the client asking the server which
tools it has. The server returns each tool's name, description, and JSON input
schema, and the model reads those descriptions in full to decide what to call. That
single design choice is the root of the week.
๐ Frame for the week: the agent trusts two things the protocol does not verify, the descriptions a server advertises and the transport that carries its commands. Treat every message a server sends (description, tool output, error) as untrusted input until proven otherwise.
The trust model and why it leaks
The MCP Tax: performance is a security property
Defenses: a layered stack
The spec is catching up
๐งช Hands-on this week
Offensive depth: attacking MCP orchestration and tool surfaces
Go deeper: sender-constrained tokens and client ID metadata documents
โ Check yourself
๐ Tool-poisoning variant reference
๐ OWASP MCP Top 10: the community taxonomy this chapter maps to
Finish Model Context Protocol (MCP)
About 2 h 27 min left in this unit.
From memory first
Write the main points of this unit, in your own words.
What you set out to be able to do
Check each one against what you can do now.
- Explain MCP's three primitives (tools, resources, prompts), the host, client and server model, and the two transports (stdio and streamable HTTP).
- Trace the tool discovery and dispatch flow, and name the two things the protocol trusts that it should not: the descriptions a server advertises, and the transport.
- Distinguish tool poisoning from ordinary indirect prompt injection. In tool poisoning the payload rides in tool metadata that the agent loads and trusts, so it can steer the agent before any tool runs; in ordinary injection the payload sits in a tool's output.
- List the poisoning variants: sidenote exfiltration, tool shadowing, rug pull, advanced tool poisoning attacks (ATPA, which CyberArk files under poisoning though the payload rides in a tool's output), and implicit (metadata-only) poisoning.
- Apply a layered defense: cryptographic tool verification (ETDI), decision-level detection (MindGuard), intent gating (Tool Attention), and the zero-trust checklist.
- Build a minimal MCP server with the Python SDK and audit it against the Vulnerable MCP catalog.
- (Go deeper) Verify DPoP proofs (RFC 9449) and validate client ID metadata documents on a local target, and say what each stops and what it leaves to the consent screen and the client.
The unit is done when you have answered the check and marked the required sources.
1 Check yourself
Do the check2 Required sources
Go to the sources
Sources in this unit
- MCP Specification
- MCP Python SDK: Quickstart
- Invariant Labs: MCP Tool Poisoning
- Vulnerable MCP Project
- MCPTox Benchmark (arXiv 2508.14925)
- MCP Security Best Practices (official spec)
- Prompt Engineering: MCP Security is Still Broken
- Vulnerable MCP: MCP Security Best Practices
- Tool Attention: arXiv 2604.21816
- MCP-ITP: Implicit Tool Poisoning (arXiv 2601.07395)
- MindGuard (arXiv 2508.20412)
- CyberArk: Poison Everywhere: No Output from Your MCP Server is Safe
- ETDI: Enhanced Tool Definition Interface
- Trail of Bits: Jumping the Line: MCP servers attack you before you use them
- OWASP MCP Top 10
- SlowMist MCP Security Checklist
- MCP specification 2026-07-28
Checklist
It does not count toward done.
- Build a minimal Model Context Protocol (MCP) server with the Python SDK (
@mcp.tool(), stdio transport) and see its tool listed in a host. - Name the three MCP primitives (tools, resources, prompts) and write down who controls each.
- Draw MCP's trust model and its discovery-to-dispatch flow, and mark the two unverified trust points (descriptions and transport).
- Explain how tool poisoning differs from indirect prompt injection, and list its five variants (sidenote, shadowing, rug pull, output-triggered ATPA, implicit).
- Write a poisoned tool docstring on your own server and confirm the host obeys the hidden instructions.
- Audit one MCP integration against the Vulnerable MCP Project checklist and record each gap you find.
- Read the Tool Attention paper (arXiv 2604.21816) and write down how intent gating cuts both token overhead and the tool-poisoning surface.
- Map the defense stack (ETDI for signing and versioning, MindGuard for decision-level detection, the zero-trust checklist) to the attack each layer stops.
- Note what the 2026-07-28 spec revision hardens (a stateless core, OAuth 2.1
issvalidation). - Map each attack you learned onto the OWASP MCP Top 10 (MCP01 to MCP10) and name the trust leak that those rows share.
Catch a tool description that changes after you approve it
Attack: Hide a sidenote past the approval screen, then change an approved tool without a new question. Defend: Pin each tool to its exact definition and server; keep one server's text from steering another's tools.
Nothing to do here yet; the unit is complete without it.
Practise this in the lab, Spot a spoofed agent card.15 to 25 min estimate
Practise this in the lab, Turn model output into an action, then fence every place it lands.50 min to 1 h 10 min estimate
Practise this in the lab, Bind a credential to its issuer, then refuse it anywhere else.50 min to 1 h 10 min estimate
Practise this in the lab, Capstone: one engagement, replayable findings and a scope log.1 h 40 min estimate
Study notes
None yet
Sign in to take notes.
Your additions
None yet
More for this unit
11 readings
Readings no section cites. They do not count toward the unit.
MCP Security10 readings
- youtube.comvideo
A demo-driven walkthrough of tool poisoning, rug pulls and permission escalation. Watch it for a quick look at the attacks running before you read the papers.
Sign in to mark it done, keep it for later and open its questions.
- vulnerablemcp.infopaper
A zero-trust implementation guide that covers just-in-time credentials, cryptographic server verification, per-tool permissions, sandboxing, and input and output validation. Use it as the checklist for the defense section of the chapter.
Sign in to mark it done, keep it for later and open its questions.
- arxiv.orgpaper
The paper measures the "MCP Tax" (10K to 60K tokens a turn). Intent gating with lazy schema loading cuts per-turn tool tokens from 47.3K to 2.4K and also shrinks the tool-poisoning surface. Read it to see why less context means less attack surface.
Sign in to mark it done, keep it for later and open its questions.
- arxiv.orgpaper
In this attack the poisoned tool is never invoked; its metadata tricks the agent into misusing legitimate high-privilege tools. The authors report an 84.2% ASR with only 0.3% of attacks detected. Read it for the implicit variant in the chapter's reference table.
Sign in to mark it done, keep it for later and open its questions.
- arxiv.orgpaper
A decision-level guardrail that builds a Decision Dependence Graph from the model's attention. It reaches 94% to 99% precision in under a second with no extra tokens, and it catches poisoning that never executes. Read it for the detection layer of the defense stack.
Sign in to mark it done, keep it for later and open its questions.
- web.archive.orgpaper
Introduces ATPA (advanced tool poisoning attacks), which exploit dynamic tool outputs such as fake errors and follow-up prompts. The attack stays invisible in development and triggers in production. Read it for the output-triggered variant.
Sign in to mark it done, keep it for later and open its questions.
- vulnerablemcp.infopaper
Combines signed tool definitions, OAuth provider verification, and immutable versioning with content hashing. Any change forces re-approval, which stops rug pulls. Read it for the identity and integrity layers of the defense stack.
Sign in to mark it done, keep it for later and open its questions.
- blog.trailofbits.compaper
Describes line jumping. Tool descriptions run at connect time with no invocation and no consent, they contaminate other servers' tools, and the context keeps no provenance. Read it with the line-jumping part of the chapter.
Sign in to mark it done, keep it for later and open its questions.
- owasp.orgreference
A community taxonomy (version 0.1 beta, led by Vandana Verma Sehgal) with ten IDs, MCP01 to MCP10: token and secret exposure, privilege escalation through scope creep, tool poisoning, supply chain, command injection, intent-flow subversion, weak authorization, missing audit, shadow servers, and context over-sharing. The chapter's ๐ reference maps this week's attacks onto it. Read it last, to file what you learned under the industry's names.
Sign in to mark it done, keep it for later and open its questions.
- github.compaper
A checklist for servers, clients and cross-system setups. It covers authentication, keychain credentials, TLS 1.2 or later with identity verification, and controls against function hijacking across several MCP servers, in Low, Medium and High priority tiers. Use it to audit a real integration.
Sign in to mark it done, keep it for later and open its questions.
Spec and protocol evolution1 reading
- modelcontextprotocol.iotool
The released revision makes the core stateless (no
initializehandshake and noMcp-Session-Id), hardens authorization (issvalidation under RFC 9207 and client credentials bound to their issuer), and moves Tasks into an official extension beside MCP Apps. Read its Key Changes page to see which attacks the protocol now closes.Sign in to mark it done, keep it for later and open its questions.
This unit's library holds 18 more readings for readers with access.