MCP Tool Poisoning: Tool Metadata Is Untrusted Input
Content reflects the state as of October 2026. AI tooling and model capabilities in this area change frequently.
An MCP server’s tools/list response is not passive API documentation—it is an instruction-bearing payload injected directly into your model’s prompt before a user ever calls the tool.
TL;DR
- Problem: LLMs treat MCP tool descriptions, parameter schemas, and annotations as trusted operational context, enabling tool poisoning, silent post-approval rug pulls, and cross-server shadowing.
- Answer: Treat every MCP server as a supply-chain dependency: compare vendor-hosted, open-source, and self-hosted options by update control, enforce SHA-256 manifest pinning and Git-reviewed diffs, and ignore self-reported
ToolAnnotationsas security guarantees.- Watch out: Running
npx -yoruvxagainst@latestpackages—or trustingreadOnlyHint: truefrom a remote server—lets an upstream update turn a benign helper into a credential thief overnight.
Situation
In Post 1 and Post 2, we examined how untrusted user inputs and poisoned retrieval chunks hijack agent sessions. The Model Context Protocol (MCP) introduces a third, often overlooked injection surface: the tool metadata layer itself.
When an AI client or agent runtime connects to an MCP server, it calls tools/list to discover available capabilities. Each tool returns a name, an inputSchema, a free-text description, and optional annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint). While human users in an IDE or chat UI typically see only a concise tool name or summary, the underlying LLM receives the entire description and schema verbatim inside its system or tool-definition context.
In early 2025, Invariant Labs (later acquired by Snyk) formally characterized three attack classes against this mechanism: tool poisoning (hidden directives embedded in descriptions), rug pulls (servers that serve clean definitions during initial user approval and swap in malicious ones later), and cross-server shadowing (a malicious server in a multi-server session registering metadata that hijacks calls meant for a separate, trusted server). The OWASP MCP Top 10 classifies these under MCP03:2025 (Tool Poisoning) and MCP04:2025 (Software Supply Chain Attacks), aligning with OWASP LLM03 (Supply Chain).
The Problem
MCP tool metadata breaks traditional API security assumptions because discovery is dynamic and the consumer of the metadata is a language model rather than a strongly typed compiler.
Four concrete constraints govern why unpinned MCP integrations fail in production environments:
- Tool descriptions execute at discovery time, not invocation time (TB-2). A user never has to click “run” on a poisoned tool for the attack to succeed. As soon as the agent loads
tools/listinto context, hidden instructions insideformat_sqlorcalculate_sumcan coerce the model to read sensitive local files or pass database tokens into innocuous string parameters of another tool. Invariant Labs and subsequent security evaluations observed mainstream LLMs falling for tool poisoning and cross-server manipulation at rates frequently exceeding 60% when auto-approval or permissive contexts are present. - MCP
ToolAnnotationsare explicitly untrusted hints (TB-2). The Model Context Protocol specification definesreadOnlyHint(defaultfalse) anddestructiveHint(defaulttrue) insidetools/list. Crucially, the specification warns that all tool annotations are untrusted hints unless they come from a trusted, verified server. A malicious server can label a table-dropping tool withreadOnlyHint: trueanddestructiveHint: falseto trick permissive clients into skipping Human-in-the-Loop (HITL) confirmation prompts. - Unpinned registries and remote endpoints enable silent rug pulls (TB-1 to TB-2). Many quickstart guides instruct engineers to configure local MCP clients with
npx -y some-mcp-serveroruvx some-mcp-server@latest, or to point clients at a vendor-hosted SSE/HTTP endpoint. Without digest pinning or manifest hashing, a compromised npm/PyPI release or a silent server-side deployment changes thetools/listpayload on the next session start without triggering re-review. Even worse, MCP supports dynamic tool updates vianotifications/tools/list_changed, allowing a remote server to pass an initial inspection at connection time and swap in a poisoned description mid-session. - Multi-server contexts lack native cross-server isolation (TB-2 to TB-3). When an agent mounts a trusted internal PostgreSQL MCP server alongside a third-party utility MCP server in the same context window, both servers’ descriptions share the same attention space. Across TB-2, a single compromised utility server can instruct the model to redirect or exfiltrate outputs produced by the PostgreSQL server across TB-3. Because the model cannot cryptographically verify which server owns a given instruction, a poisoned description in a low-privilege server can hijack calls to a high-privilege database server even if the user never invokes the malicious tool directly.
- Local
stdioservers inherit host environment authority by default (TB-3). When a developer runs a third-party MCP server locally overstdio, the spawned child process inherits environment variables, working directory access, and file descriptors unless explicitly stripped by the host—giving any compromised package immediate read access to~/.ssh,~/.aws, or.envfiles on the host.
How do you adopt MCP servers across vendor-hosted, open-source, and self-hosted deployments without letting unreviewed metadata changes hijack your agents and data platforms?
Options Considered: Vendor-Hosted, Open-Source, and Self-Hosted MCP
Not all MCP servers carry the same operational or supply-chain profile. Platform teams must evaluate deployment models across four criteria: identity, scope, update control, and auditability.
How the Options Compare
| Criterion | Vendor-Hosted Remote MCP | Open-Source Third-Party (stdio / Container) | Self-Hosted Internal MCP |
|---|---|---|---|
| Identity | OAuth 2.1 with explicit user consent; requires audience (aud) binding per MCP spec | Often inherits local developer env vars, ~/.ssh, or static API keys over stdio | Enterprise OIDC/IAM token exchange; zero ambient developer secrets |
| Scope | Controlled by vendor’s OAuth scopes; often coarse-grained across SaaS workspaces | Arbitrary local process access unless sandboxed; can read host filesystem if unisolated | Tightly scoped to specific database roles, read replicas, and parameterized tools |
| Update Control | Low: Vendor pushes silent server-side updates to tools/list at any time | Medium: High rug-pull risk if run via @latest; controllable if pinned to container digest | High: Updates flow through internal Git PRs, code review, and CI/CD gates |
| Audit | Vendor-side telemetry only; limited visibility into upstream tool logic | Zero centralized audit unless wrapped by a local or enterprise MCP gateway | Full correlation from OIDC principal to manifest hash to SQL/API execution |
| Best Fit | Approved SaaS integrations behind a manifest-pinning gateway | Vetted utilities compiled into digest-pinned, network-isolated containers | Default for all production databases, vector stores, and internal control planes |
Relying solely on local client popups (“Allow tool X to run?”) fails because users approve tools once and cannot inspect dynamic description diffs on every subsequent session. Conversely, banning all external MCP servers slows developer velocity and pushes teams toward shadow integrations. The durable solution is to route every MCP server—vendor-hosted, open-source, or internal—through a pin-and-diff gateway that treats tool metadata as immutable, versioned code. Under this model, vendor-hosted servers are isolated to non-sensitive sessions, open-source stdio servers run inside digest-pinned containers, and self-hosted internal servers remain the default for production data platforms.
Pin-and-Diff Gateway Architecture
The target architecture places an enforcing MCP Policy Gateway between the agent runtime and all upstream MCP servers, ensuring no unreviewed metadata or unpinned package ever enters the model’s context window.
Core Architectural Controls
- Manifest Lockfile (Git-Reviewed): Every approved MCP server has a canonical JSON lockfile checked into Git, recording the exact
name,description,inputSchema,annotations, and a SHA-256 digest of each tool definition. - Gateway Hash & Namespace Gate: At runtime, the gateway fetches
tools/listfrom the upstream server, normalizes key ordering via canonical JSON serialization (so benign key-order changes do not cause false positives), computes the SHA-256 hash per tool, and compares it against the lockfile. If a single character indescriptionorinputSchemahas changed, the gateway fails closed, drops the tool, and emits a high-severity drift alert. Similarly,inputSchemavalidation rejects unconstrainedadditionalProperties: trueobjects that attackers use to smuggle exfiltrated secrets inside unused arguments. - Deterministic Namespacing: To defeat cross-server shadowing, the gateway prefixes every tool exposed to the model with its verified server identifier (
pg_prod__query_metrics,github_ro__get_pr). Servers cannot register colliding names or reference tools outside their own namespace. - Annotation-Independent Authorization: Per the MCP specification, the gateway never uses server-supplied
readOnlyHintordestructiveHintflags to relax security policy. Read/write classification and HITL requirements are defined exclusively in the gateway’s own lockfile policy, owned by the platform team. - Process and Network Sandboxing: For open-source
stdioservers, the gateway runs each server inside a digest-pinned container (image@sha256:...) with dropped Linux capabilities, minimal file descriptors (per MCPstdiotransport guidance), read-only root filesystem, and zero ambient environment variables outside explicitly injected, scoped tokens.
{
"server_id": "pg-diagnostics-ro",
"transport": "streamable-http",
"pinned_image_digest": "sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
"tools": [
{
"name": "pg-diagnostics-ro__explain_query",
"manifest_sha256": "sha256:4b227777d4dd1fc61c6f884f48641d02b4d121d3fd328cb08b5531fcacdabf8a",
"policy_read_only": true,
"require_hitl": false,
"ignore_server_annotations": true
}
]
}
Attacker and Defender Threat Matrix
| Threat Vector | Trust Boundary Crossed | Attacker Objective (OWASP / ATLAS) | Defender Control (Deterministic) | Verification Signal |
|---|---|---|---|---|
| Tool description poisoning | TB-2 (MCP Server → Agent) | Embed hidden prompt injection in description or parameter docs (MCP03) | Static metadata scan in CI + human PR review of tools/list diff | Scanner flags imperative verbs/URLs in metadata; PR blocked |
| Post-approval rug pull | TB-1 / TB-2 (Upstream → Agent) | Mutate tool definition after initial user approval to steal data | Gateway computes live SHA-256 of tools/list and fails closed on mismatch | Mutated server response triggers HTTP 403 / tool drop + alert |
| Cross-server shadowing | TB-2 → TB-3 (Server A → Server B) | Register instructions mimicking a trusted DB tool to intercept calls | Enforce server_id__tool namespacing + split sensitive DB sessions | Shadowing attempt cannot override or invoke another server’s namespace |
Spoofed readOnlyHint: true | TB-2 (Server → Client UI) | Bypass HITL confirmation on a mutating or destructive tool | Ignore server ToolAnnotations for authz; enforce gateway policy_read_only | Gateway forces HITL token even when server sets readOnlyHint: true |
Unpinned npx / uvx supply chain | TB-1 (Registry → Runtime) | Compromise upstream package or typosquat @latest (MCP04) | Ban npx -y / uvx @latest; require digest-pinned containers | Policy check rejects any MCP config referencing unpinned tags |
Ambient credential theft via stdio | TB-3 (Local Host → Server) | Read ~/.ssh, ~/.aws, or .env from developer laptop via local MCP process | Run stdio servers in isolated containers with minimal FDs and empty env | Containerized server cannot read host home directory or env vars |
| Shadow MCP server sprawl | TB-1 / TB-2 (Developer → Prod) | Developers connect unapproved external MCP servers to prod data (MCP09) | Egress proxy allowlists approved MCP endpoints; client config MDM-locked | Unapproved MCP endpoint connection blocked at network proxy |
How It Rolls Out
Replacing ad-hoc MCP installation with a pin-and-diff lifecycle ensures every metadata change is inspected like a schema migration or library upgrade.
The Pin-and-Diff Upgrade Flow
- 01 Stage and Extract: When a team wants to onboard a new MCP server or upgrade an existing one, CI pulls the exact container digest (or vendor endpoint) inside an offline, credential-free staging sandbox and invokes
tools/listto dump the canonical JSON manifest. - 02 Diff Metadata: A Git pull request is generated showing the line-by-line diff of every
name,description,inputSchema, andannotationsfield against the previous lockfile. Automated lint rules flag suspicious patterns—imperative instructions (IMPORTANT:,ALWAYS,IGNORE), hidden Unicode characters, references to~/.sshor environment variables, or external URLs. - 03 Sign Lockfile: Once reviewed by a platform or security engineer, merging the PR updates the lockfile’s
manifest_sha256andpinned_image_digest. - 04 Enforce Live: In production, the MCP Policy Gateway verifies the upstream
tools/listpayload against the signed lockfile hash on every session initialization (and periodically for long-lived connections). Any mismatch immediately quarantines the server.
Phased Rollout and Rollback Gates
- Phase 1 — Discovery and
npx/uvxElimination: Audit developer workstations and agent runtimes for unpinnedstdiocommands (npx -y,uvx) and unapproved remote MCP URLs. Gate: Zero production or staging agents running unpinned package tags. Rollback: N/A (inventory and policy baseline). - Phase 2 — Lockfile Generation and Static Linting: Generate baseline JSON lockfiles for all approved MCP servers and enable CI diffing on
tools/listoutputs. Gate: 100% of approved MCP servers have a committed SHA-256 manifest in Git. Rollback: Run gateway in audit-only mode (log hash mismatches without blocking) for 48 hours if benign formatting drift occurs in vendor-hosted servers. - Phase 3 — Fail-Closed Gateway Enforcement: Switch the MCP Policy Gateway to fail-closed mode on manifest hash mismatches, enforce
server_id__toolnamespacing, and disable annotation-based HITL bypasses. Gate: Simulated rug-pull test (mutating 1 word indescription) is blocked within 1 request. Rollback: Pin back to the previous known-good container digest (image@sha256:...) in Git; never disable hash verification. - Phase 4 — Containerized
stdioIsolation: Move all open-source localstdioservers into rootless, network-restricted containers with explicit secret injection. Gate:stdioserver process has zero access to host filesystem or ambient cloud credentials. Rollback: Temporarily disable the specific third-party tool until its containerized build passes integration tests.
In Practice
I have not audited every commercial MCP client’s internal sandbox personally, so the controls in this post are grounded in published security research, the MCP specification, and OWASP standards:
- Tool poisoning, rug pulls, and cross-server shadowing (Pattern A — Security Research): Invariant Labs (early 2025) published the foundational disclosures demonstrating how hidden instructions in MCP
tools/listdescriptions, post-approval schema mutations, and multi-server shadowing exploit mainstream LLMs, and documented hash pinning and metadata scanning (MCP-Scan) as primary mitigations. - Untrusted
ToolAnnotationsandstdioisolation (Pattern A — Protocol Specification): The Model Context Protocol specification states thatToolAnnotations(readOnlyHint,destructiveHint) are hints that clients should not use for tool-use decisions when the server is untrusted. Its security best practices recommend running local servers in a sandbox with minimal default privileges (containers, chroot, or application sandboxes) and warning users that a local server runs with the client’s privileges. - Supply-chain classification (Pattern A — Standard): The OWASP MCP Top 10 (a 2025 project that is still a beta list; MCP03:2025 Tool Poisoning, MCP04:2025 Software Supply Chain Attacks, MCP09:2025 Shadow MCP Servers) formalizes why unpinned MCP servers and unreviewed metadata updates must be governed through the same software supply-chain controls as production application dependencies.
Where It Breaks
| Condition | Breaks How | Detect | Mitigate |
|---|---|---|---|
| Vendor-hosted server rotates descriptions frequently | Vendor A/B tests prompt wording in tools/list, causing constant SHA-256 hash mismatches and outages | High rate of false-positive lockfile mismatch alerts on vendor endpoints | Prefer self-hosted/containerized servers for critical paths; for vendor MCPs, pin to versioned API endpoints or isolate to Profile C |
| Invisible Unicode or zero-width characters in diff | Malicious description uses homoglyphs or zero-width spaces that look clean to a human PR reviewer | CI linter detects non-ASCII / bidirectional control characters in manifest JSON | Add automated CI gate rejecting non-printable Unicode, BiDi overrides, and base64 blobs in tool metadata |
| Long-lived SSE/HTTP session mutates mid-flight | Server passes initial tools/list check, then sends notifications/tools/list_changed with a poisoned schema | Gateway logs unexpected list_changed notification during active session | Reject dynamic tools/list reloads mid-session; require full session teardown and hash re-verification |
| Developer bypasses gateway with local IDE config | Engineer pastes an unapproved npx server directly into local IDE settings with prod DB credentials | Endpoint MDM or egress proxy detects unapproved MCP package downloads or DB connections | Lock IDE MCP allowlists via MDM and enforce private VPC / OIDC auth on databases so local static keys do not exist |
Over-permissive inputSchema strings | A tool accepts an unconstrained query: string or extra_params: object, letting injected instructions smuggle data out | Schema linter flags additionalProperties: true or unbounded string fields on sensitive tools | Require strict JSON schemas (additionalProperties: false, enum/regex bounds, maxLength) in the lockfile |
Key Takeaways
- Tool metadata is untrusted input: Treat
tools/listdescriptions, parameter docs, and schemas with the same suspicion as user-submitted HTML or external SQL strings. - Never trust
ToolAnnotationsfor security decisions:readOnlyHint: trueis an advisory hint from the server, not a verified capability guarantee; enforce read/write policy in your gateway. - Ban
@latestand unpinnedstdiocommands: Runningnpx -yoruvxagainst live registries turns every session start into an unreviewed supply-chain pull. - Pin and diff every manifest in Git: Hash-pin
tools/listoutputs by SHA-256, diff metadata changes in PRs, and fail closed at the gateway on any unapproved drift. - Namespace tools and isolate server sessions: Prefix every tool with its verified server ID to prevent cross-server shadowing across shared LLM contexts.
What to Do Next
- Problem: Unpinned MCP servers and unreviewed
tools/listmetadata expose agents to tool poisoning, silent rug pulls, and cross-server shadowing. - Solution: Route all vendor-hosted, open-source, and internal MCP servers through a gateway that enforces SHA-256 manifest lockfiles, Git-reviewed metadata diffs, and strict server namespacing.
- Proof: Modify a single character in a staging MCP server’s tool
descriptionand verify that your gateway blocks the connection and emits a drift alert before the model seestools/list. - Action: Audit your team’s MCP client configs this week, replace any
npx -yor@latestreferences with digest-pinned containers, and commit a baselinetools/listlockfile for every production server.