MCP Security: Tool Poisoning, Auth and Safe Defaults
MCP security comes down to four risk classes: poisoned tool descriptions that steer the model, proxy servers tricked into acting as a confused deputy, tokens passed through to systems they were never issued for, and scopes far broader than the task needs. The specification's OAuth 2.1 rules address the last three. Tool poisoning is left to hosts and the teams that operate them.
The Model Context Protocol makes it easy to connect an AI application to real systems, which is exactly why it deserves a security review before anything else. This post walks through the risk classes using the specification's own security pages (revision 2026-07-28, current as of late 2026) and the original research on tool poisoning. If the protocol itself is new to you, start with what MCP is.
Why is MCP security different from ordinary API security?
MCP security differs from API security because the caller is a language model that reads tool descriptions and tool results as text and then decides what to do. A normal API client runs code a developer wrote. An MCP host runs whatever the model chooses, based partly on words supplied by the server.
The specification is frank about this. It says tools "represent arbitrary code execution and must be treated with appropriate caution", that descriptions of tool behaviour should be considered untrusted unless they come from a trusted server, and that MCP "cannot enforce these security principles at the protocol level". Enforcement is the job of whoever builds the host and the server.
The OWASP MCP Top 10, a beta project as of late 2026, reflects the same split. Its list includes classic problems such as token mismanagement, scope creep and missing audit logs next to model-specific ones such as tool poisoning and prompt injection through context.
What is tool poisoning?
Tool poisoning is an attack in which malicious instructions are hidden inside an MCP tool's description, where the model reads them and the user usually does not. Invariant Labs named the attack in research published on 1 April 2025, describing instructions "embedded within MCP tool descriptions that are invisible to users but visible to AI models".
The same research describes two variants that matter in practice:
- Rug pull. A server changes a tool's description after the client has already approved it. The tool you reviewed last month is not necessarily the tool running today.
- Shadowing. A malicious server's description changes how the agent uses a different, trusted server, for example by redirecting where emails are sent, without the malicious tool ever being called.
Poisoning is a form of prompt injection, so no single filter removes it. I cover the general problem in prompt injection explained. The MCP-specific defences are about the supply chain: know which servers are connected, pin them, and notice when their tool text changes. OpenAI's guide to MCP servers in its API gives the same advice from a vendor's side: prefer official servers run by the service provider, expect that a malicious server may include hidden instructions, and remember that servers can change tool behaviour unexpectedly.
What is the confused deputy problem in MCP?
The confused deputy problem in MCP arises when a proxy server that holds real authority is tricked into using it for an attacker. The specification's security best practices page describes the conditions precisely: an MCP proxy uses one static client ID with a third-party authorization server, lets MCP clients register dynamically, and the third party remembers consent with a cookie.
An attacker registers a client with their own redirect address and sends the user a link. The user's browser still carries the consent cookie, so the third party skips the consent screen and the authorization code ends up with the attacker.
The fix is a rule, not a suggestion: MCP proxy servers must implement per-client consent before forwarding to the third-party authorization flow, match redirect URIs exactly, and validate the OAuth state parameter.
Why does the MCP specification forbid token passthrough?
Token passthrough is forbidden because it lets a token issued for one service be used against another, with nobody checking. The specification calls it an anti-pattern in which a server accepts a token from a client without validating that the token was issued to that server, then forwards it to a downstream API.
The damage is practical. Rate limits and monitoring that depend on token audience are bypassed, audit logs show the wrong identity, and a stolen token turns the server into a proxy for data theft. The rule is one sentence: MCP servers "MUST NOT accept any tokens that were not explicitly issued for the MCP server". When a server calls an upstream API, it uses a separate token issued by that API's own authorization server.
How do over-broad scopes make an MCP breach worse?
Over-broad scopes turn a single leaked token into access to everything a server exposes. The specification's scope minimization section describes the usual cause: the server lists every scope it supports, the client requests them all up front, and the resulting token carries wildcard access such as files:* or admin:*.
The recommended model is progressive. Start with a minimal scope set that covers low-risk discovery and read operations, and have the server issue a targeted challenge the first time a privileged operation is attempted. The specification lists wildcard scopes, bundling unrelated privileges and trusting a token's claimed scopes without server-side checks as common mistakes.
What does the MCP authorization model require?
The MCP authorization model is OAuth 2.1 applied to HTTP transports, with the MCP server acting as a resource server. Authorization is optional, and a local stdio server should not use this flow at all: it reads credentials from its environment. Where authorization is used, the main requirements are:
| Area | What the specification requires |
|---|---|
| Discovery | Servers must publish OAuth 2.0 Protected Resource Metadata (RFC 9728) and clients must use it to find the authorization server |
| Audience | Clients must send a resource parameter (RFC 8707); servers must accept only tokens issued specifically for them |
| Code protection | Clients must use PKCE, with the S256 method where technically capable, and must refuse to proceed if PKCE support is not advertised |
| Token handling | Tokens go in the Authorization header on every request and must not appear in the URL query string |
| Registration | Client ID Metadata Documents are preferred; Dynamic Client Registration is deprecated as of 2026-07-28 |
| Transport | Authorization server endpoints must use HTTPS; redirect URIs must be localhost or HTTPS |
| Token lifetime | Authorization servers should issue short-lived access tokens and must rotate refresh tokens for public clients |
The 2026-07-28 revision also removed protocol-level sessions, which changed one risk. Servers that need state now hand out explicit handles, and the specification warns against "state handle hijacking": a server must not treat possession of a handle as authentication, and should bind each handle to the authenticated user.
Two further risks sit outside OAuth. A local server is a program running with your privileges, so a malicious startup command or package is arbitrary code execution; the specification requires clients with one-click installation to show the exact command and ask for consent. And under the Streamable HTTP transport rules, a server must validate the Origin header, or a website can reach a locally running server through DNS rebinding.
What does a sensible MCP hardening checklist look like?
A sensible MCP hardening checklist treats every server as third-party code with access to your data, and works through the steps below in order. This is the list I apply when I build or review a server on client projects.
- Inventory the servers. List every MCP server in use, who runs it and what it can reach. OWASP lists unapproved "shadow" servers as a risk of their own.
- Prefer first-party servers. Use the server published by the service provider where one exists, and review third-party aggregators with extra care.
- Pin and compare. Pin server versions and hash tool descriptions, so a changed description triggers a review instead of running silently.
- Keep a human able to say no. The specification says there should always be a human in the loop who can deny tool calls. Keep approval on for anything that writes, sends or deletes, and show the tool inputs. My post on human-in-the-loop approvals covers the design.
- Validate audience, never pass tokens through. Reject any token not issued for your server, and call upstream systems with separate credentials.
- Start with minimal scopes. Grant read and discovery first, and step up per operation.
- Contain local servers. Use stdio, read the full startup command before running it, and sandbox file and network access.
- Lock down HTTP. Validate
Origin, bind local servers to 127.0.0.1, and authenticate every connection. - Bind state to the user. Generate random handles and check on every call that the handle belongs to the caller.
- Log every tool call. Record inputs, outputs and scope elevations, and review them. Without logs you cannot investigate an incident.
For the design decisions that come before this list, such as which tools to expose at all, see MCP server for your internal tools.
Work with me
I design and build MCP servers with authorization, scoped access and audit logging from the first version, and I review existing servers against the specification. See MCP server development and AI agent development, or browse my work and book a scoping call. This post is general technical information, not a security audit of your system.
Frequently asked
Is MCP safe to use in production?
It can be, but not by default. The protocol defines an authorization model and security guidance, and states that it cannot enforce them at the protocol level. Safety depends on the host's approval controls, the server's token and scope handling, and which servers you choose to connect.
Does OAuth stop tool poisoning?
No. OAuth controls who may call a server and with which permissions. Tool poisoning works through text the model reads, so an authenticated, correctly scoped server can still carry hidden instructions. The defences are different: trusted sources, pinned versions, change detection and human approval for sensitive actions.
Are local MCP servers safer than remote ones?
Not automatically. A local stdio server avoids network exposure, but it runs on your machine with your privileges, so a malicious package or startup command can read files and credentials. A remote server cannot touch your machine directly, but it receives whatever data the model sends it.
What changed for MCP security in the 2026-07-28 specification?
The revision removed protocol-level sessions, so session hijacking guidance was replaced by guidance on state handles. It also deprecated Dynamic Client Registration in favour of Client ID Metadata Documents, and added validation of the issuer in authorization responses to counter mix-up attacks.
Who is responsible for MCP security, the client or the server?
Both. The specification puts consent, approval prompts and safe handling of server-supplied URLs on the client side, and token validation, input validation, access control and rate limiting on the server side. A weakness on either side is enough for an attack to succeed.
Sources
- specification (modelcontextprotocol.io)
- OWASP MCP Top 10 (owasp.org)
- research published on 1 April 2025 (invariantlabs.ai)
- guide to MCP servers in its API (developers.openai.com)
- security best practices page (modelcontextprotocol.io)
- Authorization is optional (modelcontextprotocol.io)
- Streamable HTTP transport rules (modelcontextprotocol.io)
Related services
Building something like this?
Naman Gundaniya takes on full-stack and AI projects: fixed quote after a free 30-minute scoping call, replies within 24 hours.
Get in touch