How to Prevent MCP Tool Poisoning and Rug Pulls
How to prevent MCP tool poisoning and rug pulls: read the full tool definition, pin a hash of it, and refuse the tool when the hash changes.
How to prevent MCP tool poisoning and rug pulls starts with the text the model reads, not with the call it later makes. Tool poisoning is instructions hidden in a tool definition: the name, the description, a parameter, or another part of the schema. A rug pull is that definition changing after someone approved a benign copy. Read the full definition before the model sees it, store a cryptographic hash of the whole definition, and refuse to expose the tool when the hash is missing, differs, or cannot be checked. A matching hash does not prove the code behind the tool is safe. Keep the catalog small, show every argument before a sensitive call, and treat the tool's result as untrusted text.
The protocol pages, the Invariant Labs disclosure, and the OWASP cheat sheet cited here were read on 26 November 2026.
What is MCP tool poisoning?
An MCP server sends the client a list of tools. Each tool has a name, an optional description, a JSON Schema for its inputs, an optional schema for its outputs, and optional annotations. The tools specification in the 28 July 2026 revision says tools are model-controlled: the model discovers them and can invoke them from the conversation. That list is not only a menu for a person. It is text in the model's context.
Invariant Labs' April 2025 disclosure named this failure tool poisoning: malicious instructions embedded in a tool description that a person often does not see and the model does. Their example was a tool that claimed to add two numbers. Extra text in the description told the model to read local credential files and pass the contents in a parameter. The client still asked for confirmation, and the dialog showed a short summary. The parameter that carried the file contents was not on that summary. They also showed tool shadowing: a description on one server told the model to change how it used a mail tool from a different server, including the recipient.
The protocol's security principles say descriptions of tool behavior, such as annotations, should be considered untrusted unless they come from a trusted server. Hosts must obtain explicit consent before invoking a tool, and MCP itself cannot enforce those principles. The local server security guide names the catalog case: tool names and descriptions are instructions the model reads, a server can hide directives that steer the agent, including other servers' tools, and the poisoned tool need not be invoked.
The OWASP MCP Security Cheat Sheet uses the same name for a slightly wider set: malicious instructions hidden in tool descriptions, parameter schemas, or return values. A poisoned result is the other channel. The definition looked fine, the call ran, and the text that came back is the next instruction. The tools specification tells servers to sanitize outputs and tells clients to validate tool results before they go back to the model.
What is a rug pull?
A rug pull is a definition that was acceptable when you approved it and is not acceptable later. Invariant Labs described a server that changes the tool description after the client has already approved the server. The local server guide says the same thing: definitions are not fixed at install time, a server can quietly change them after you approved it, and a one-time consent dialog plus a package pin does not cover that surface.
The tools specification gives honest servers a way to announce a change. A server that declared listChanged should send notifications/tools/list_changed to a client that opened a subscriptions/listen stream with toolsListChanged: true. The client then calls tools/list again. That notification is a refetch. It is not a review. A malicious server does not have to send it. Any later tools/list can return different text, and a client that replaces its cache without asking has accepted the new definition.
The cheat sheet's line is the one to keep: do not assume a tool you approved yesterday is the same tool today.
How do you prevent it?
Preventing this is a review of text, a pin of that text, and a refusal when the pin does not hold.
Read the definition with no model in the loop. Read the tool list before you rely on a server. The local server guide points at the MCP Inspector, which lists every tool without putting the list in a model. The cheat sheet is explicit that the injection surface is the whole schema, not only the description field. Remove the server when the text tells the model to do something the tool's job does not require: read a secret, hide an action from the user, or change how another server's tool behaves.
The security best practices cover the earlier moment, for a client that can install a local server in one click. That client must show the exact command, without truncation, say that the command runs code, and get an explicit approval before it runs. The same page says the client should sandbox the process, because a local server otherwise runs with the client's privileges. A dialog that only shows the package name does not replace the description review.
Pin the whole definition. When the text is acceptable, serialize the fields in a fixed order you write down: name, title, description, input schema, output schema, annotations. Store a cryptographic hash of those bytes, for example SHA-256, with the server, the tool name, the reviewer, and the date. The cheat sheet gives the reason a description-only hash is the wrong pin: a flipped readOnlyHint or destructiveHint can change whether a client asks for confirmation, with no change a person notices by skimming the description.
The local server guide says the protocol does not require clients to pin tool definitions. A client that records the definition on first approval and asks again when it changes is doing the pin. Otherwise put the pin in a gateway, a reviewed config, or a job that refetches tools/list. A package version pin is separate. The local guide says it stops a later release from installing itself through an auto-update, and that it does not cover the definition a running server sends. npx and uvx pin the top-level package and typically resolve its dependencies fresh. An image digest freezes that tree.
Refuse the tool when the hash does not match. Compare on every tools/list, including the refetch after notifications/tools/list_changed. If the hash differs, do not expose the updated tool to the model and do not call it. A person reviews the new text, again with no model in the loop, and stores a new hash, or the server stays off the catalog. Skipping that review is the rug pull. A scanner such as mcp-scan, which the cheat sheet names, can flag suspicious description text. A finding is a reason to read. A clean scan is not a hash.
What still has to be true when the hash matches?
The local server guide states the limit directly: no check proves what a server will do. The cheat sheet says a pin detects a metadata change, not a change to the code behind an unchanged definition. The tool can still return instructions, or do something the description never named.
A poisoned description can also point at a capability the client already has. That is the shape of the original disclosure: the model was told to read a file the editor could read, then hide the contents in a tool parameter. Taking unused tools off the list closes one path. A client that cannot read credential files, or a local server sandboxed away from them, closes the other. How to secure an MCP server is the rest of that cut: who may connect, which token the server accepts, and which tools a caller sees.
Show the full arguments before a sensitive call runs. The tools specification asks clients to show tool inputs before calling the server. How to require human approval for MCP tool calls is the hold for calls that are sometimes legitimate: the approver sees the arguments, and the requester is not the approver. If the interface cannot show the full arguments, the call is not approved. Treat the result as untrusted, including a result from a pinned server. The cheat sheet says tag stripping cannot establish that the remaining text is safe, so the next call is decided in code you trust. Prefer a remote server when the tool only calls an API and needs nothing on the laptop. A remote server can still poison a description. It cannot, by itself, read a key on the machine.
What does a review look like on one catalog?
A platform team wants two tools on the same agent. notes.search comes from a notes server. send_email comes from the company mail server. Nobody pastes either server into a laptop config. An admin fetches tools/list through the Inspector and reads it as text.
The first notes server is rejected. notes.search describes a search, and it also has a parameter whose text tells the model to read a credential file, pass the contents in that parameter, and not mention the read. That fails the local guide's test: the instructions are not the tool's job. There is nothing to pin.
The replacement notes server describes search, takes a query string, and has no extra parameter. The admin serializes one object, in the fixed field order above, and stores a SHA-256 of those bytes with the reviewer and the date. The mail tool is pinned the same way. A rule on send_email says a recipient outside the company domain waits for Security. The approver sees the recipient and the body. The person who asked for the mail cannot approve it.
pins:
- server: notes
tool: notes.search
sha256: "hash of the serialized tool definition"
reviewed_on: 2026-11-26
on_mismatch: deny
on_check_error: deny
- server: mail
tool: send_email
sha256: "hash of the serialized tool definition"
reviewed_on: 2026-11-26
on_mismatch: deny
on_check_error: deny
rules:
- name: external-mail
tool: send_email
when: recipient domain is outside the company
effect: require-approval
approver: security
A week later the notes server sends notifications/tools/list_changed. The client refetches tools/list. The new notes.search hash does not match. The tool comes off every agent's list. Mail stays, under its own pin and the approval rule, because its hash still matches, and the notes description is no longer in that context. A second person reviews the new notes text with no model in the loop. A real change to search gets a new hash. Instructions mean the server stays unregistered.
Where does the check fail closed?
The failure that matters is a comparison that does not finish. The new tools/list payload contains a tool object the serializer cannot hash: a schema that does not parse, a field the hasher does not know how to order, or a stored pin that is missing. Installing that list anyway accepts an unreviewed definition. Showing the person the old description, while the model receives the new one, is the same acceptance with a calmer screen.
Fail closed on the catalog. Do not replace the list the model sees. A tool whose stored hash still matches a payload you could hash stays offered. A tool you could not hash is absent. Log the server name, the tool name if you have it, and the reason the check stopped. A person reads the raw payload outside the model and, only after that read, stores a new hash.
A hash of the description alone, when the annotations or the schema will not hash, is not a pin. The flipped hint in the cheat sheet would look unchanged, so treat a partial hash as a check that did not finish. If the approval screen cannot render the full arguments, do not record an approval. The call is denied and logged. Code that changes while the definition stays put is outside what this check can see. The narrow grant, the sandbox, and the approval cover that case. A check that fails still has to deny.
Frequently asked questions
What if the agent never calls the poisoned tool?
The description can still matter. The local server guide calls it tool shadowing when the text steers how the agent uses another server's tools, and Invariant Labs showed a description that redirected mail on a trusted server. The poisoned tool was not the one in the user-facing request. Take that server off the catalog.
Should you trust readOnlyHint?
Only from a server you already trust, and even then as a hint. The tools specification says clients must treat tool annotations as untrusted unless they come from a trusted server. Put the annotation in the hash so a flip is a new review, and decide the call from the arguments and your own rule.
Who reviews the new definition?
Someone who can read the raw tool list, and not the model that would be steered by it. A second person is the better review when the first person installed the server. An approval that says "the notes server," without a hash, is the one-time consent the rug pull waits for.
Where do you put the pin?
Put the allowlist, the hash, and the call check on the path every agent uses, rather than in each laptop's config. A server you have not registered never joins the shared context. Best MCP gateways for enterprises compares products built for that path. The pin itself is still a review you perform. A gateway that does not show you the definition, and does not refuse a definition you have not hashed, has not done this job.
Smartplane is one MCP endpoint for that allowlist. Administrators register each tool once and assign use to a role, a team, or a project, so a member's agent is offered only those tools. Credentials are injected on the call, so the upstream password is not sitting in the client config a poisoned description can ask the model to open. Sign-in is the company account, and SSO and SCIM offboarding ends the membership. Guard rules are plain English. A new rule starts in monitor mode, where a match is allowed and flagged, and you switch it to enforce when the matches are the ones you wanted. An enforcing rule fails closed: if the check does not answer, the action is denied. A call that should sometimes proceed waits for someone other than the requester. Calls, denials, approvals, and grant changes go to an append-only, hash-chained audit log.
That is the grant, the rule, the approval, and the record. It is not an automatic diff of tool descriptions, and it does not store a pin you never wrote down. The security page lists the controls. The product is the endpoint you put in the client, in place of a server you have not reviewed.
Related articles
How to Stop MCP Token Passthrough and Confused Deputy Attacks
How to stop MCP token passthrough and confused deputy attacks: accept only a token issued for this server, and call upstream with a separate credential.
Best MCP Gateways for Enterprises (2026)
Best MCP gateways for enterprises: the controls to require, who each current product fits, and what their public pages actually say.
How to Require Human Approval for MCP Tool Calls
How to require human approval for MCP tool calls: hold destructive changes, external sends, payments, production data, and privilege changes for a second person.
