Learn / Model Context Protocol security: servers, tool poisoning, auth
Model Context Protocol security: servers, tool poisoning, auth
Securing the client-server protocol that lets AI agents discover and call external tools, including malicious or compromised tool servers.
Before the exercises: Understand client-server communication, HTTP and tool-using agents. Read the OAuth concepts before modifying an authorisation flow. Start with Step 0 if needed.
Researched on 2026-09-26 with AI assistance. Links and summaries can change; verify details with the original source. Not yet reviewed by a person.
What it is
The Model Context Protocol connects an AI host application to external tools and data through three parts: the host, an MCP client inside it, and MCP servers that expose tools over the protocol. The trust relationship is asymmetric: the host trusts the server to scope its tool effects, and the server trusts that call parameters came from an authorised host with vetted inputs, and both assumptions are often wrong.9
MCP security work covers the whole life of a server, from creation and deployment to operation and maintenance, with threats grouped by attacker type including malicious developers, external attackers, malicious users and plain implementation flaws.6
Two problem families dominate. One is content the model reads and obeys: tool descriptions, server instructions and tool output. The other is classic protocol and identity work: OAuth 2.1 authorization, audience and consent handling, and input validation inside the server itself.139
OWASP's MCP Top 10 beta names the recurring risks as token mismanagement, scope creep, tool poisoning, supply chain tampering, command injection, prompt injection via context, weak authentication and authorization, missing audit and telemetry, shadow MCP servers, and context over-sharing.5
In the job-posting sample
Counts describe 48 postings collected on 24 September 2026. Small role samples do not establish market-wide requirements or explain employer decisions.
11 of 48 postings (23%) ask for it, and the weight sits with builders and designers: 57% of the 7 AI Security Architect postings and 38% of the 16 AI/Agent Security Engineer postings, against 0% in research, red team and GRC.P
The architect and engineer postings that ask for it describe deciding which servers an agent may connect to, pinning what a server is allowed to say to the model, and making a remote server behave as a proper OAuth 2.1 resource server with per-client consent rather than a token forwarder.P12
Consulting asks in 20% of 5 postings, a denominator too small to read as a trend. The review work itself is concrete: server inventory and registry vetting, given one study of 67,057 servers across six public registries that reported 833 vulnerable servers and 18 with suspicious descriptions.P7
Key terms and concepts
Start with the meaning, then connect it to an example. Use these notes while learning or revising; explaining a term is one part of applying it.
An MCP deployment has a host (the AI application), a client inside it that speaks the protocol and routes calls, and servers that expose tools. Tool call parameters come out of LLM reasoning, so a server must treat every parameter as untrusted input. The host in turn cannot assume a server keeps its tool effects inside the scope its description claims.9
Tool descriptions are read in full by the model but usually shown to the user in simplified form. An attacker who controls a server can hide instructions in a description, for example telling the model to read ~/.cursor/mcp.json and ~/.ssh/id_rsa and pass the contents in a spare parameter while explaining maths to the user. Invariant showed this against a popular MCP client and found a malicious server can also override instructions from other, trusted servers.3
Poisoned content reaches the model during connection and tool listing, before any tool is actually invoked, so approval prompts on individual calls arrive too late. Trail of Bits calls this line jumping and treats server instructions, tool descriptions and input schemas as the surface to review and freeze. The same wrapper also strips ANSI control characters used to deceive the user in terminal output.8
The tools themselves can be honest and the flow still be malicious. With the GitHub MCP server connected, a prompt injection planted in a public issue turned a benign request to review issues into the agent pulling private repository data into context and publishing it in a pull request on the public repo. This needs no compromised tool, only an agent that mixes untrusted content with privileged reach, and it gets worse when users switch on always-allow.4
A server can present clean tools at install time and change them later, including via a tools/list_changed notification. The countermeasure is pinning: record the approved server instructions, tool descriptions and input schemas, compare on every connection and on change notifications, and block downstream calls until a human approves the new configuration. Servers are identified by their launch command or URL, so any change to that string counts as a new server.8
Authorization is optional in the spec, but HTTP-based servers that use it act as OAuth 2.1 resource servers and must implement OAuth 2.0 Protected Resource Metadata (RFC 9728), returning WWW-Authenticate on a 401 so clients can find the authorization server, whose metadata (RFC 8414) the client must then use. Dynamic client registration (RFC 7591) is only a SHOULD, so a client cannot assume it is available; registration support is not by itself what makes client identity strong or weak. The identity problem to worry about is the mix described below, where a server holds one static client ID for its outbound calls while registering inbound MCP clients dynamically. STDIO servers should not use this flow and take credentials from the environment instead.2
A server that proxies to a third-party API with one static client ID, while letting MCP clients register dynamically, can be tricked once the third-party authorization server has set a consent cookie: a crafted link with a new client ID and attacker redirect_uri skips the consent screen and the authorization code lands with the attacker. The spec requires per-client consent stored server side, exact redirect_uri matching, CSRF protection, framing protection, and consent bound to a specific client_id rather than to the user.1
Servers arrive through public registries whose vetting and ownership checks are weak, so hijacked or adversarial servers can enter a host, and once integrated the attacker-controlled metadata shapes model reasoning while the host executes without independent verification. A study of 67,057 servers over six registries found widespread conditions for server hijacking and invocation manipulation, plus 833 servers with exploitable code. Pre-integration analysis of metadata and code is the control point.7
Use fictional data and authorised sandboxes. Remove employer details and secrets from any portfolio write-up. Time estimates exclude setup. Check model and cloud costs before running tests, set spending limits, and delete lab resources afterwards.
Three exercises
Work through these in order. Open-source code can still incur model, cloud or hardware costs. Record your setup, results and limitations.
You can show a poisoned tool description, what the client displayed, and what the model actually did with it.39
- Write a local stdio MCP server with one harmless tool (add two numbers) plus a spare string parameter.
- Put hidden instructions in the docstring, modelled on the Invariant example, telling the model to read a decoy file you created and pass its contents in the spare parameter.
- Connect it to any MCP-capable client you already run and issue a normal arithmetic request.
- Record what the user-visible UI showed versus the full description the model received, and where the decoy file contents ended up.
- Write five review questions you would now ask of any third-party tool description.
Tools: Python, an MCP server SDK, a local MCP client, a text editor
Check your work
- You can place the user-visible tool label and the full docstring the model received side by side and point at the text present only in the model's copy.
- Your server log shows exactly what arrived in the spare parameter for each call, including the case where nothing arrived, and the decoy file's path and contents are reproducible from your notes.
You can demonstrate detection of a silent tool description change and explain what pinning does and does not cover.8
- Clone and install mcp-context-protector with uv, then reconfigure your client to launch your server through the wrapper.
- Approve the initial configuration through the wrapper CLI and confirm tool calls work.
- Edit a tool description to add hidden instructions, restart, and record the block and the approval prompt.
- Repeat by emitting a tools/list_changed notification instead of restarting, and note the difference.
- Change the server launch command trivially and explain why the wrapper treats it as a new server.
Tools: git, uv, mcp-context-protector, your local MCP server from exercise 1
Check your work
- With the wrapper in place, an unapproved configuration stops the tool call and the wrapper CLI lists a pending approval naming the changed description.
- You can state, for each of the four changes you made (description edit, restart, tools/list_changed notification, launch-command change), whether the wrapper treated it as a new configuration, with the wrapper output quoted for each.
You can produce a findings table for an HTTP MCP server covering authorization, consent, parameter trust and logging, mapped to named risks.125910
- Stand up or pick an HTTP MCP server you control and check whether it publishes protected resource metadata and returns WWW-Authenticate on 401 per RFC 9728.
- Model the confused deputy conditions: static third-party client ID, dynamic client registration, consent cookie, missing per-client consent, and note which apply.
- On a server you run yourself, never a third-party hosted one, add a tool that fetches a URL, then test whether it can be steered at 169.254.169.254, 127.0.0.1 and a redirect chain, and note DNS rebinding as a bypass of literal IP blocklists.
- Check what the server logs for each tool invocation and whether an investigator could reconstruct a session.
- Map each finding to an OWASP MCP Top 10 item and propose one control per finding, including which containment pattern limits blast radius.
Tools: curl, Python, a local OAuth-capable test identity provider, a notes file
Check your work
- For the server you control you can paste the 401 response headers and the protected resource metadata document, or record that either is missing, against the RFC 9728 requirement.
- Every findings row names an OWASP MCP Top 10 item, one control, and the evidence captured (curl output, log line or config setting), and the SSRF targets you tested are listed with their results whether or not any reached an internal address.
Practice questions
Written from the concepts above, not collected from a named employer. Open one, answer it out loud, then tick the points you covered; the score stays in this browser.
Walk me through tool poisoning and why per-call user approval does not stop it.Tool poisoning, Line jumping and server instructions
Say your answer out loud or write it down, then tick what you covered:
0 of 4 covered
An agent with a fully trusted tool set still leaked private data. How?Toxic agent flows
Say your answer out loud or write it down, then tick what you covered:
0 of 4 covered
What does the MCP authorization spec actually require of an HTTP MCP server?Authorization (MCP specification 2025-06-18)
Say your answer out loud or write it down, then tick what you covered:
0 of 4 covered
Explain the confused deputy problem for a server that proxies a third-party API.Confused deputy in MCP proxy servers
Say your answer out loud or write it down, then tick what you covered:
0 of 4 covered
How would you vet a third-party MCP server before it reaches production?Registry vetting and server supply chain
Say your answer out loud or write it down, then tick what you covered:
0 of 4 covered
What server-side input validation issues do you expect in an MCP server, ignoring the model entirely?Security Considerations for Model Context Protocol (MCP) Implementations in AI Agent Systems (draft-mohiuddin-mcp-security-considerations-00)
Say your answer out loud or write it down, then tick what you covered:
0 of 4 covered
Which OWASP MCP Top 10 risks would you put on a first-pass checklist for an internal MCP rollout, and why those?OWASP MCP Top 10 (beta)
Say your answer out loud or write it down, then tick what you covered:
0 of 4 covered
Design a control set for an agent that must use two third-party MCP servers. Where do you spend effort first?s8, s10
Say your answer out loud or write it down, then tick what you covered:
0 of 4 covered
Sources
Every numbered claim above links here. P = the platform's own coding of 48 job postings.
- MCP Security Best Practices Model Context Protocol
- Authorization (MCP specification 2025-06-18) Model Context Protocol
- MCP Security Notification: Tool Poisoning Attacks Invariant Labs
- GitHub MCP Exploited: Accessing private repositories via MCP Invariant Labs
- OWASP MCP Top 10 (beta) OWASP Foundation
- Model Context Protocol (MCP): Landscape, Security Threats, and Future Research Directions arXiv
- A First Look at the Security Issues in the Model Context Protocol Ecosystem arXiv
- mcp-context-protector: MCP security wrapper Trail of Bits
- Security Considerations for Model Context Protocol (MCP) Implementations in AI Agent Systems (draft-mohiuddin-mcp-security-considerations-00) IETF Internet-Draft
- Design Patterns for Securing LLM Agents against Prompt Injections arXiv
Resources
Free first. Levels: intro means no prior knowledge of this skill; working means you can apply it on a project; advanced means research depth or specialist tooling.
- introModel Context Protocol (MCP) overview Anthropic, Guide freeUnderstand clients, servers, transports, tools and resources so you can name the trust boundaries before you start testing or reviewing them.EngineerArchitectRed teamerGovernanceConsultant
- introOWASP MCP Top 10 (beta) OWASP Foundation, Standard, about 1 h freeGives you the shared vocabulary for MCP risk reviews: token mismanagement, scope creep, tool poisoning, shadow servers, missing telemetry.EngineerArchitectGovernanceConsultantRed teamer
- introHugging Face MCP Course Hugging Face (with Anthropic), Course freeBuild and run your own MCP server and client so tool discovery, transports and message flow stop being abstract during assessments.EngineerArchitectRed teamerConsultant
- introMCP for Beginners (curriculum with labs) Microsoft (open source), Hands-on lab freeHands-on exercises in Python, .NET, Java and TypeScript let you build servers and clients, including lessons on securing them.EngineerArchitectConsultant
- workingMCP Security Best Practices Model Context Protocol (maintainers), Standard, about 2 h freeThe normative reference for confused deputy, token passthrough and session hijacking issues, so you can cite requirements rather than opinions in reviews.EngineerArchitectGovernanceConsultant
- workingVulnerable MCP Servers Lab Appsecco, Hands-on lab freePractise pentesting MCP servers against deliberately broken ones: injection, over-scoped tools, auth gaps, and remote transport abuse.Red teamerEngineerConsultant
- workingMCP Scanner Cisco AI Defense, Tool freeScan MCP servers and tool manifests for threats before approval, and wire the same check into CI or an onboarding gate.EngineerRed teamerConsultant
- workingAI Agent Abuse: Local AI CLI Tools and MCP HackTricks, Guide freeGet concrete abuse paths for MCP-connected coding agents (Claude, Gemini, Codex, Warp) to build test cases for a red team engagement.Red teamerEngineerConsultant
- workingModel Context Protocol (MCP): Landscape, Security Threats, and Future Research Directions arXiv (Hou et al.), Paper, about 3 h freeThe lifecycle survey most later MCP security work cites; use it to structure threat models across server creation, deployment, operation and maintenance.ResearcherArchitectGovernanceEngineer
- workingMCP Safety Audit: LLMs with the Model Context Protocol Allow Major Security Exploits arXiv (Radosevich and Halloran), Paper freeSee demonstrated MCP exploits (malicious code execution, remote access, credential theft) and an auditing approach you can mirror in your own test plan.Red teamerResearcherEngineer
- workingSecuring the Model Context Protocol (MCP): Risks, Controls, and Governance arXiv, Paper freeTranslate MCP-specific adversaries into control and governance language where NIST AI RMF and ISO/IEC 42001 are silent, for policy and audit work.GovernanceArchitectConsultant
- workingOWASP MCP Top 10 Security Guidance for Azure Microsoft, Guide freeTurn OWASP MCP risks into concrete platform controls (identity, network, secrets, logging) when you host or consume MCP servers in a cloud tenant.ArchitectEngineerConsultant
- workingThe Mother of All AI Supply Chains: Technical Deep Dive OX Security, Guide freeTrace one systemic input-validation flaw across 30+ MCP server disclosures, which shows how to hunt the same class in your own inventory.EngineerRed teamerResearcherConsultant
- workingDamn Vulnerable MCP Server harishsg993010 (open source), Hands-on lab freeExploit deliberately broken MCP servers to practise tool poisoning, excessive scope and injection findings you will later report on real servers.Red teamerEngineerConsultant
- workingmcp-context-protector Trail of Bits, Tool freeWrap an MCP client so tool descriptions are pinned and reviewed, giving you a working control against line jumping and silent tool changes.EngineerArchitectRed teamer
- workingBest practices for securing agent interactions with Model Context Protocol Google Cloud documentation, Guide, about 1 h freeConcrete cloud-side controls for letting an agent reach a managed database through MCP: identity, least privilege, and human confirmation points.EngineerArchitectConsultant
- workingAnthropic Academy course catalogue (MCP courses) Anthropic, Course not statedWork through the vendor's own MCP tracks, including advanced transport, sampling and notification behaviour that shapes where security controls can sit.EngineerArchitect
- advancedMCP Authorization specification (2025-06-18) Model Context Protocol (maintainers), Standard, about 3 h freeRead the normative OAuth 2.1 flow, resource server rules and token audience requirements so you can spot passthrough and confused deputy designs.ArchitectEngineerGovernance
- advancedETDI: Mitigating Tool Squatting and Rug Pull Attacks in MCP arXiv, Paper freeEvaluate a concrete defence design (signed, versioned tool definitions plus policy-based access control) when you must stop rug pulls, not just detect them.ArchitectEngineerResearcher
- advancedAutomatic Red Teaming LLM-based Agents with Model Context Protocol Tools arXiv, Paper freeAutomate generation of poisoned MCP tools instead of writing payloads by hand, and reuse the evaluation setup for agent regression testing.Red teamerResearcher
- advancedSecurity Considerations for MCP Implementations in AI Agent Systems (IETF draft) IETF (Internet-Draft), Standard, about 2 h freeClassifies vulnerability classes reported in real MCP servers in standards language, helpful when the MCP spec itself states no normative security requirements.ArchitectEngineerGovernanceResearcher
- advancedPipelock: agent firewall for MCP and agent egress Pipelock (open source), Tool freeMediate MCP, HTTP, A2A and WebSocket agent traffic to block exfiltration and SSRF, and produce signed action receipts usable as audit evidence.EngineerArchitectGovernance
- advancedDesign Patterns for Securing LLM Agents against Prompt Injections arXiv (Beurer-Kellner et al.), Paper, about 3 h freeGives named architecture patterns (action selector, plan-then-execute, dual LLM, context minimisation) you can require when an agent holds MCP tool access.ArchitectResearcherEngineer
- advancedA First Look at the Security Issues in the Model Context Protocol Ecosystem arXiv, Paper, about 3 h freeMeasured evidence that registries admit hijacked servers, which supports arguments for allowlisting and provenance checks rather than open MCP marketplaces.ResearcherRed teamerArchitectGovernance
- advancedEnterprise-Grade Security for the Model Context Protocol: Frameworks and Mitigation Strategies arXiv (Narajala, Habler), Paper, about 3 h freeTranslates MCP threats into enterprise control language, useful when writing agent tool-use policy or a vendor MCP server acceptance standard.GovernanceArchitectConsultant
Gaps the research could not fill with a good free source: No free course dedicated to MCP security (rather than MCP development) with confirmed price and hours; security teaching is scattered across spec pages, blogs and papers.; No MCP-specific guidance found today from NIST, ENISA, CISA or UK NCSC that could anchor GRC arguments in national or regional standards.; No published MCP penetration testing methodology from a standards body or major test house: current labs teach exploitation but not a repeatable assessment procedure.; Maintained MCP scanning tools are scarce; nearly all public scanners found are small single-maintainer repositories with fewer than ten stars.; No free, hosted MCP CTF or sandbox you can use without self-hosting a vulnerable server.; No primary-source mapping from OWASP MCP Top 10 to ISO/IEC 42001 or the NIST AI RMF; only third-party self-assessment mappings were found.
Paid options
These courses and certifications cover parts of this topic. Compare their syllabus and practice format with the free resources. An exam listing is not a training course. Showing 3 of 3: ones postings name first, then the most focused on this skill. All paid options.
- Cost
- not stated on the provider page
- Duration
- 30+ guided exercises, 60 days browser-based lab access, 36 CPE points, one exam attempt included
- Format
- self-paced
- Prerequisite
- not stated
- Provider page checked
- 2026-09-26
- In the 48 postings
- Not named in any of the 48 postings.
Study or assessment format: One of the few paid exams scoped to Model Context Protocol specifically: attacking, assessing and hardening MCP servers including tool poisoning, prompt injection, supply chain and agentic defences.
Related free material: The MCP specification, OWASP agentic security guidance and public MCP tool-poisoning research already describe these attack patterns, and you can run a vulnerable MCP server locally for free.
- Cost
- Paid; the current OnDemand listing shows USD 5,250 before local taxes. Other delivery options differ; confirm price and exam inclusion at booking.
- Duration
- Check the selected delivery option; the page contains differing duration descriptions.
- Format
- mixed
- Prerequisite
- HTTP APIs and web/application security. Verify laptop compatibility: the current guidance excludes Apple Silicon.
- Provider page checked
- 2026-09-27
- In the 48 postings
- Not named in any of the 48 postings.
Study or assessment format: A retained VM with 21 exercises (15 full labs, 5 mini labs, a setup lab) plus Marimo workbooks covering direct and indirect prompt injection, RAG exploitation, agentic systems, MCP server attacks and AI API flaws, with an associated GIAC exam; check whether exam access costs extra.
Related free material: OWASP Top 10 for LLM Applications, MITRE ATLAS and Microsoft's free AI Red Teaming 101 material on Microsoft Learn already list the same attack classes and PyRIT gives you free tooling to try them.
- Cost
- Paid; the current OnDemand listing shows USD 5,250 before local taxes. Other delivery options differ; confirm price and exam inclusion at booking.
- Duration
- Check the selected delivery option; the page contains differing duration descriptions.
- Format
- mixed
- Prerequisite
- HTTP APIs and web/application security. Verify laptop compatibility: the current guidance excludes Apple Silicon.
- Renewal
- Not stated on the course page
- Provider page checked
- 2026-09-27
- In the 48 postings
- Not named in any of the 48 postings.
Study or assessment format: Twenty-one hands-on exercises in a keepable VM covering direct and indirect prompt injection, RAG exploitation, agentic systems, MCP server attacks and AI architectural flaws, with an associated exam; confirm what the selected purchase includes.
Related free material: OWASP GenAI guidance, MITRE ATLAS and public prompt injection research describe the same attack classes, and open MCP servers can be attacked locally for free.