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 ToolAnnotations as security guarantees.
  • Watch out: Running npx -y or uvx against @latest packages—or trusting readOnlyHint: true from a remote server—lets an upstream update turn a benign helper into a credential thief overnight.

Poisoned tool metadata steers the agent before any tool runs

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.

MCP discovery and execution cross three supply-chain boundaries

Four concrete constraints govern why unpinned MCP integrations fail in production environments:

  1. 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/list into context, hidden instructions inside format_sql or calculate_sum can 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.
  2. MCP ToolAnnotations are explicitly untrusted hints (TB-2). The Model Context Protocol specification defines readOnlyHint (default false) and destructiveHint (default true) inside tools/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 with readOnlyHint: true and destructiveHint: false to trick permissive clients into skipping Human-in-the-Loop (HITL) confirmation prompts.
  3. 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-server or uvx 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 the tools/list payload on the next session start without triggering re-review. Even worse, MCP supports dynamic tool updates via notifications/tools/list_changed, allowing a remote server to pass an initial inspection at connection time and swap in a poisoned description mid-session.
  4. 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.
  5. Local stdio servers inherit host environment authority by default (TB-3). When a developer runs a third-party MCP server locally over stdio, 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 .env files 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.

Vendor-hosted, open-source, and self-hosted MCP carry distinct risks

How the Options Compare

CriterionVendor-Hosted Remote MCPOpen-Source Third-Party (stdio / Container)Self-Hosted Internal MCP
IdentityOAuth 2.1 with explicit user consent; requires audience (aud) binding per MCP specOften inherits local developer env vars, ~/.ssh, or static API keys over stdioEnterprise OIDC/IAM token exchange; zero ambient developer secrets
ScopeControlled by vendor’s OAuth scopes; often coarse-grained across SaaS workspacesArbitrary local process access unless sandboxed; can read host filesystem if unisolatedTightly scoped to specific database roles, read replicas, and parameterized tools
Update ControlLow: Vendor pushes silent server-side updates to tools/list at any timeMedium: High rug-pull risk if run via @latest; controllable if pinned to container digestHigh: Updates flow through internal Git PRs, code review, and CI/CD gates
AuditVendor-side telemetry only; limited visibility into upstream tool logicZero centralized audit unless wrapped by a local or enterprise MCP gatewayFull correlation from OIDC principal to manifest hash to SQL/API execution
Best FitApproved SaaS integrations behind a manifest-pinning gatewayVetted utilities compiled into digest-pinned, network-isolated containersDefault 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.

Block unapproved tool metadata before it enters the LLM context

Core Architectural Controls

  1. 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.
  2. Gateway Hash & Namespace Gate: At runtime, the gateway fetches tools/list from 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 in description or inputSchema has changed, the gateway fails closed, drops the tool, and emits a high-severity drift alert. Similarly, inputSchema validation rejects unconstrained additionalProperties: true objects that attackers use to smuggle exfiltrated secrets inside unused arguments.
  3. 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.
  4. Annotation-Independent Authorization: Per the MCP specification, the gateway never uses server-supplied readOnlyHint or destructiveHint flags 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.
  5. Process and Network Sandboxing: For open-source stdio servers, the gateway runs each server inside a digest-pinned container (image@sha256:...) with dropped Linux capabilities, minimal file descriptors (per MCP stdio transport 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 VectorTrust Boundary CrossedAttacker Objective (OWASP / ATLAS)Defender Control (Deterministic)Verification Signal
Tool description poisoningTB-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 diffScanner flags imperative verbs/URLs in metadata; PR blocked
Post-approval rug pullTB-1 / TB-2 (Upstream → Agent)Mutate tool definition after initial user approval to steal dataGateway computes live SHA-256 of tools/list and fails closed on mismatchMutated server response triggers HTTP 403 / tool drop + alert
Cross-server shadowingTB-2 → TB-3 (Server A → Server B)Register instructions mimicking a trusted DB tool to intercept callsEnforce server_id__tool namespacing + split sensitive DB sessionsShadowing attempt cannot override or invoke another server’s namespace
Spoofed readOnlyHint: trueTB-2 (Server → Client UI)Bypass HITL confirmation on a mutating or destructive toolIgnore server ToolAnnotations for authz; enforce gateway policy_read_onlyGateway forces HITL token even when server sets readOnlyHint: true
Unpinned npx / uvx supply chainTB-1 (Registry → Runtime)Compromise upstream package or typosquat @latest (MCP04)Ban npx -y / uvx @latest; require digest-pinned containersPolicy check rejects any MCP config referencing unpinned tags
Ambient credential theft via stdioTB-3 (Local Host → Server)Read ~/.ssh, ~/.aws, or .env from developer laptop via local MCP processRun stdio servers in isolated containers with minimal FDs and empty envContainerized server cannot read host home directory or env vars
Shadow MCP server sprawlTB-1 / TB-2 (Developer → Prod)Developers connect unapproved external MCP servers to prod data (MCP09)Egress proxy allowlists approved MCP endpoints; client config MDM-lockedUnapproved 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.

Treat every MCP update like a production dependency upgrade

The Pin-and-Diff Upgrade Flow

  1. 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/list to dump the canonical JSON manifest.
  2. 02 Diff Metadata: A Git pull request is generated showing the line-by-line diff of every name, description, inputSchema, and annotations field against the previous lockfile. Automated lint rules flag suspicious patterns—imperative instructions (IMPORTANT:, ALWAYS, IGNORE), hidden Unicode characters, references to ~/.ssh or environment variables, or external URLs.
  3. 03 Sign Lockfile: Once reviewed by a platform or security engineer, merging the PR updates the lockfile’s manifest_sha256 and pinned_image_digest.
  4. 04 Enforce Live: In production, the MCP Policy Gateway verifies the upstream tools/list payload 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

  1. Phase 1 — Discovery and npx/uvx Elimination: Audit developer workstations and agent runtimes for unpinned stdio commands (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).
  2. Phase 2 — Lockfile Generation and Static Linting: Generate baseline JSON lockfiles for all approved MCP servers and enable CI diffing on tools/list outputs. 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.
  3. Phase 3 — Fail-Closed Gateway Enforcement: Switch the MCP Policy Gateway to fail-closed mode on manifest hash mismatches, enforce server_id__tool namespacing, and disable annotation-based HITL bypasses. Gate: Simulated rug-pull test (mutating 1 word in description) is blocked within 1 request. Rollback: Pin back to the previous known-good container digest (image@sha256:...) in Git; never disable hash verification.
  4. Phase 4 — Containerized stdio Isolation: Move all open-source local stdio servers into rootless, network-restricted containers with explicit secret injection. Gate: stdio server 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/list descriptions, post-approval schema mutations, and multi-server shadowing exploit mainstream LLMs, and documented hash pinning and metadata scanning (MCP-Scan) as primary mitigations.
  • Untrusted ToolAnnotations and stdio isolation (Pattern A — Protocol Specification): The Model Context Protocol specification states that ToolAnnotations (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

Unpinned MCP servers fail via injection, rug pulls, and shadowing

ConditionBreaks HowDetectMitigate
Vendor-hosted server rotates descriptions frequentlyVendor A/B tests prompt wording in tools/list, causing constant SHA-256 hash mismatches and outagesHigh rate of false-positive lockfile mismatch alerts on vendor endpointsPrefer 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 diffMalicious description uses homoglyphs or zero-width spaces that look clean to a human PR reviewerCI linter detects non-ASCII / bidirectional control characters in manifest JSONAdd automated CI gate rejecting non-printable Unicode, BiDi overrides, and base64 blobs in tool metadata
Long-lived SSE/HTTP session mutates mid-flightServer passes initial tools/list check, then sends notifications/tools/list_changed with a poisoned schemaGateway logs unexpected list_changed notification during active sessionReject dynamic tools/list reloads mid-session; require full session teardown and hash re-verification
Developer bypasses gateway with local IDE configEngineer pastes an unapproved npx server directly into local IDE settings with prod DB credentialsEndpoint MDM or egress proxy detects unapproved MCP package downloads or DB connectionsLock IDE MCP allowlists via MDM and enforce private VPC / OIDC auth on databases so local static keys do not exist
Over-permissive inputSchema stringsA tool accepts an unconstrained query: string or extra_params: object, letting injected instructions smuggle data outSchema linter flags additionalProperties: true or unbounded string fields on sensitive toolsRequire strict JSON schemas (additionalProperties: false, enum/regex bounds, maxLength) in the lockfile

Key Takeaways

  • Tool metadata is untrusted input: Treat tools/list descriptions, parameter docs, and schemas with the same suspicion as user-submitted HTML or external SQL strings.
  • Never trust ToolAnnotations for security decisions: readOnlyHint: true is an advisory hint from the server, not a verified capability guarantee; enforce read/write policy in your gateway.
  • Ban @latest and unpinned stdio commands: Running npx -y or uvx against live registries turns every session start into an unreviewed supply-chain pull.
  • Pin and diff every manifest in Git: Hash-pin tools/list outputs 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/list metadata 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 description and verify that your gateway blocks the connection and emits a drift alert before the model sees tools/list.
  • Action: Audit your team’s MCP client configs this week, replace any npx -y or @latest references with digest-pinned containers, and commit a baseline tools/list lockfile for every production server.