Skip to content

Get notified

Get an email when a new major security incident drops. No spam, unsubscribe any time.

Only used for pwn.watch incident emails. Protected by Cloudflare Turnstile.

AppSec & Crypto9 min read

MCP Server Security Checklist for Production Teams (2026)

A production checklist for Model Context Protocol (MCP) servers: tool poisoning, schema and description injection, OAuth and token scoping, least-privilege execution, gateway allowlists, and auditing third-party MCP servers before an agent loads them.

// key takeaways

  • A local stdio MCP server is an executable that starts with the agent client and inherits your user account, environment variables, and files. Review it like a dependency, not a plugin.
  • Tool names, descriptions, and input schemas reach the model as instructions. Treat them as untrusted input, pin them, and re-review any change before the agent sees it.
  • Give each server its own narrowly scoped credential, never a shared personal token, and keep OAuth flows from opening server-supplied URLs without validation.
  • If a gateway or proxy enforces allowlists, it must parse requests exactly the way the server behind it does, or the allowlist can be bypassed.

The MCP threat model in one page

The Model Context Protocol lets an AI client (Claude Desktop, Cursor, Claude Code, Cline, IDE agents, and custom apps) discover tools exposed by a server and call them on the model's behalf. That is useful, and it means three trust boundaries collapse into one config file: the code you run, the text your model reads, and the credentials the code can use.

A local stdio server is launched as a child process by the client, usually on every client start. Nothing about the protocol sandboxes it. If the repository you cloned is trojanized, the payload runs before any tool is ever called. The MIOU operation tracked on pwn.watch did exactly that: trojanized Python MCP servers on GitHub, boosted with farmed stars, where pasting the README's config block was enough to start the malware on every launch.

Remote servers move the risk to the network: their responses, OAuth metadata, and tool listings are attacker-controllable if the server is malicious or hijacked. A tracked flaw in the widely used npm open package showed how a remote MCP server could answer with a crafted OAuth authorization URL that ran PowerShell on Windows when a developer clicked sign in.

  • Code risk: the server binary or script itself (malicious repo, hijacked package, compromised update).
  • Instruction risk: tool descriptions, schemas, and tool results that steer the model (tool poisoning and indirect prompt injection).
  • Credential risk: tokens in environment variables or config files that the server, or a tool call, can read and send elsewhere.
  • Protocol risk: parsers, proxies, and auth layers that disagree about what a request means.

Tool poisoning and schema/description injection

Tool poisoning is prompt injection delivered through tool metadata. The model reads each tool's name, description, and parameter schema to decide what to call and how. A description can include hidden instructions such as asking the model to read a dotfile and pass it as a parameter, or to prefer this tool over a safer one. Parameter descriptions and enum values are just as readable to the model as the top-level description.

Metadata can also change after you approve it. A server that returns a harmless tool list during review can return a different one later, which is why pinning matters. Tool results are the same class of input: a ticket, web page, or file returned by a tool can carry instructions aimed at the model.

  • Snapshot the full tools/list response (names, descriptions, input schemas) at review time and store a hash of it alongside the pinned server version.
  • Fail closed or alert when the tool list hash changes, and require a human re-review before the new metadata reaches the model.
  • Flag descriptions that mention other tools, files, credentials, or phrases like 'ignore previous' or 'do not tell the user'. Also flag zero-width or invisible Unicode characters.
  • Avoid tool names that shadow common tools from other servers. Namespace tools per server so the model and the logs can tell them apart.
  • Render tool results to the model as data, not instructions, and keep high-risk tools (shell, file write, network) behind explicit user confirmation.
Pin and diff an MCP server's tool metadata in CI
# Capture the tool list the client will see and compare it to the approved snapshot.
# 'list-tools.json' comes from your MCP client or inspector, saved during review.
jq -S '.tools | map({name, description, inputSchema})' list-tools.json > tools.normalized.json
sha256sum tools.normalized.json | cut -d' ' -f1 > tools.sha256

if ! diff -q tools.sha256 approved/tools.sha256 >/dev/null; then
  echo "MCP tool metadata changed: re-review before rollout" >&2
  diff <(jq . approved/tools.normalized.json) tools.normalized.json || true
  exit 1
fi

# Flag invisible characters that hide instructions in descriptions
grep -nP '[\x{200B}-\x{200F}\x{2060}-\x{2064}\x{FEFF}]' tools.normalized.json && exit 1 || true

OAuth, tokens, and credential scoping

Most MCP servers authenticate to something: GitHub, a database, a SaaS API, a cloud account. The common shortcut is exporting a personal access token with full scope into the server's environment. Every tool on that server, and any prompt injection that reaches it, then acts with your full identity.

Remote MCP servers increasingly use OAuth. The client opens an authorization URL the server supplies, so validate that URL before opening it: require https, match it against an expected issuer, and never pass it to a shell. On the server side, validate the bearer tokens you receive, including audience and issuer, instead of accepting any well-formed token. A LiteLLM flaw in its MCP Streamable HTTP endpoint, listed in CISA KEV, let an unauthenticated attacker open a session with an arbitrary bearer token.

  • One credential per server, scoped to the smallest set of repositories, projects, or tables it needs. Prefer fine-grained tokens and short-lived OAuth tokens over classic personal access tokens.
  • Read-only by default. Grant write or delete scopes to a separate server instance that requires confirmation.
  • Keep secrets out of the JSON config that gets copied between machines and committed by accident. Reference a secret manager or OS keychain instead.
  • Validate token audience, issuer, and expiry on every request a remote MCP server receives.
  • Record which token each server uses so you can revoke exactly one if that server misbehaves.

Least-privilege execution for local and remote servers

Run local servers as if you expect one to be malicious. Containers or OS sandboxes cost little compared with the access a stdio server gets by default: your home directory, SSH keys, cloud credentials, browser profiles, and shell history.

Put remote servers behind a gateway that terminates auth, enforces per-tool allowlists, rate-limits, and logs every call. Make sure the gateway and the server parse JSON-RPC the same way. The mcp-go case-folding issue tracked on pwn.watch showed that Go's encoding/json matches member names case-insensitively and keeps the last duplicate key, so a proxy doing exact-match checks on method names could approve one call while the server executed another.

  • Run local servers in a container or sandbox with only the project directory mounted, no host home directory, and no access to ~/.ssh, ~/.aws, or browser profiles.
  • Default-deny network egress for servers that do not need the internet. Allowlist hosts for those that do.
  • Drop privileges: non-root user, read-only filesystem where possible, no Docker socket.
  • At the gateway, reject requests with duplicate or non-canonical JSON keys rather than trying to normalize them.
  • Require human confirmation for tools that write files, run commands, send messages, or move money.
Run a stdio MCP server in a locked-down container
# Example client config command for a local server, wrapped in a container.
# Only the current project is mounted, read-only; no network; non-root; no new privileges.
docker run --rm -i \
  --network none \
  --read-only --tmpfs /tmp \
  --user 10001:10001 \
  --cap-drop ALL --security-opt no-new-privileges \
  -v "$PWD":/workspace:ro \
  ghcr.io/your-org/mcp-filesystem@sha256:<pinned-digest> /workspace

Auditing third-party MCP servers before approval

Treat a third-party MCP server like a new production dependency. Stars and forks are not a trust signal: the MIOU repositories used farmed stars, forks, and backdated commits to look established. Read the code, especially anything that runs at import or startup, and check where it fetches data from.

Keep an internal allowlist of approved servers with pinned versions or digests, the owner who approved them, the credential each one uses, and the date of the last review. Make the allowlist the only source developers install from, and check workstation and CI configs against it.

  • Source review: startup hooks, decorators, background threads, install scripts, obfuscated strings, and network calls outside the tool handlers.
  • Provenance: official publisher, signed releases or attestations where available, and a pinned commit, version, or image digest. Never track a moving main branch.
  • Dependencies: generate an SBOM and check it against tracked supply-chain incidents before approval.
  • Behavior: run it once in a sandbox with egress logging and confirm it only contacts the hosts it should.
  • Ownership: one named owner per approved server who watches its releases and security advisories.

// actionable engineering checklist

  • Inventory every MCP server in use

    Collect client configs (claude_desktop_config.json, .cursor/mcp.json, project .mcp.json, IDE settings) from workstations and CI, and list each server, version, and credential.

  • Pin servers and their tool metadata

    Pin to a version, commit, or image digest and store a hash of the approved tools/list output. Alert on any change.

  • Scope one credential per server

    Use fine-grained, read-only, short-lived tokens. No shared personal access tokens in MCP config files.

  • Sandbox local stdio servers

    Container or OS sandbox, project-only mount, no home directory, default-deny egress, non-root.

  • Front remote servers with a strict gateway

    Validate tokens, allowlist tools, reject duplicate or non-canonical JSON keys, and log every call with the identity behind it.

  • Confirm high-risk tool calls

    Shell, file write, outbound messages, payments, and deploys require explicit user approval in the client.

  • Subscribe to MCP and AI-agent incident feeds

    Follow /t/mcp and /t/ai-agents feeds so a hijacked server or protocol flaw reaches the owner the same day.

// connected pwn.watch tools & live trackers

Frequently Asked Questions

What is MCP tool poisoning?
Tool poisoning hides instructions in an MCP tool's name, description, or input schema. The model reads that metadata to decide what to call, so the hidden text can steer it into reading secrets, calling other tools, or exfiltrating data. Pin the approved metadata and re-review any change.
Are local stdio MCP servers safer than remote ones?
Not by default. A local stdio server is an executable that the client starts with your user's permissions, often on every launch. It can read your files and credentials before any tool is called. Run it in a sandbox with only the project mounted.
How should MCP servers get credentials?
Give each server its own narrowly scoped, preferably read-only and short-lived credential, loaded from a secret manager rather than written into a shared JSON config. That limits what a malicious server or a prompt injection can do and lets you revoke one server without touching the others.
Do I need a gateway in front of remote MCP servers?
For production use, yes. A gateway gives you one place to validate tokens, allowlist tools, rate-limit, and log calls. It must parse JSON-RPC exactly like the server behind it, or reject ambiguous requests, otherwise allowlists can be bypassed.

Get an email when a new major security incident drops. No spam, unsubscribe any time.