Cheat sheet
MCP server security checklist
What to check before installing a server, least-privilege scopes, auth, transport, tool poisoning, and what to log.
Bookmark
Bookmarks are kept in your free account, so you can find this page again on any device.
Sign in to bookmarkOn this page
Use this page when you add an MCP server to an agent or run one for others. The short version: install only servers you can trace to an owner, give each one the narrowest credentials that work, prefer local stdio or authenticated HTTPS, and keep a log of every tool call. For why each risk exists, read MCP security risks.
Before you install a server
| Check | How |
|---|---|
| Who publishes it | Official vendor repo or the MCP Registry entry; not a lookalike package name |
| What it runs | Read the exact command and args in the config; no sudo, curl | sh or home-folder paths |
| Version | Pin a version or commit; never @latest in a shared config |
| Tools it exposes | List them in MCP Inspector and read every description |
| Data it can reach | Note every account, folder and network the server’s credentials allow |
| Write actions | Find tools that delete, send, pay or push; keep approval prompts on for those |
Scopes and credentials
| Rule | Why |
|---|---|
| One credential per server, scoped to the task | A stolen broad token (admin:*, files:*) reaches far more than the job needs |
| Read-only token unless the task writes | Most research and lookup servers never need write scopes |
| Ask for more scope only when a tool needs it | The spec recommends step-up challenges, not every scope up front |
| No secrets in shared config files | Use the client’s secret store or environment variables kept out of Git |
| Separate tokens for work and personal accounts | Keeps one compromised server from reaching both |
If you run a remote server
| Requirement | Source rule |
|---|---|
| Validate every token’s audience | Servers MUST NOT accept tokens not issued for them |
| Never pass the client’s token through to upstream APIs | Token passthrough is forbidden by the authorization spec |
| Per-client consent when proxying to a third-party OAuth server | Prevents the confused deputy attack |
Exact redirect_uri matching, single-use state |
Stops authorisation codes going to an attacker |
| Bind state handles to the authenticated user | A handle is a name, not proof of identity |
| Validate input, rate limit, sanitise output | Servers MUST do all three for tools |
The secure a remote MCP server tutorial builds these into a working server.
Transport
| Setting | Do this |
|---|---|
| Local server | Prefer stdio, so only the client that started it can talk to it |
| Local HTTP server | Bind to 127.0.0.1, not 0.0.0.0, and require a token |
| Any Streamable HTTP server | Validate the Origin header; reject a bad one with 403 (stops DNS rebinding) |
| Remote server | HTTPS only; http:// is acceptable for loopback during development |
| Old HTTP+SSE transport | Deprecated since 2025-03-26; migrate to Streamable HTTP |
Tool poisoning and injection
| Risk | Defence |
|---|---|
| Hidden instructions in a tool description | Read descriptions before approving; the model sees text you may not |
| Description changes after you approved it (rug pull) | Pin versions and compare descriptions or hashes on update |
| One server’s description changes how the agent uses another’s tools (shadowing) | Keep untrusted servers out of sessions that hold sensitive tools |
| Tool annotations, such as a read-only hint | Clients MUST treat them as untrusted unless the server is trusted |
| Two servers with the same tool name | Prefix tool names with the server; do not rely on the server’s name |
| Injected text in tool results | Validate results before they reach the model; never auto-run what a result says |
Logging
| Log | Notes |
|---|---|
| Every tool call: server, tool, arguments, caller, time | The tools spec says clients SHOULD log tool usage for audit |
| Approvals and denials | Shows which actions people let through |
| Scope elevation requests and what was granted | Recommended with a correlation ID |
| Config changes, new servers and version bumps | Lets you trace a rug pull to the day it happened |
| Never the tokens themselves | Redact Authorization headers and secret arguments |
Common mistakes
| Mistake | Fix |
|---|---|
| Copying a one-line install from a README without reading it | Read the full command; it runs with your user’s permissions |
| One personal access token with every scope, shared by all servers | One narrow token per server |
| Turning off approval prompts to save clicks | Keep them for any tool that writes or sends |
| Exposing a local HTTP server on the network | Bind to localhost and check Origin |
| Trusting a scanner result as a clean bill of health | Scanners find known patterns; you still read the descriptions |
Check your setup
Connect to the server with MCP Inspector (npx @modelcontextprotocol/inspector) and read every tool, then scan your machine’s configs:
export SNYK_TOKEN=your-api-token-here
uvx snyk-agent-scan@latest ~/.vscode/mcp.json
Snyk Agent Scan starts stdio servers and contacts remote URLs to fetch their descriptions, so run it in a sandbox for configs you do not trust. For the background on each attack, see MCP security risks and the glossary entry on tool poisoning.
Check your understanding
MCP server security checklist quiz
Checks before installing a server, scoped credentials, rules for remote servers, transport settings, tool poisoning and shadowing, what to log, and common mistakes.
8 questions · pass mark 70%
Review
Checked against
Related
- MCP security: tool poisoning, token scope and the lethal trifecta
The real attacks on MCP setups, from tool poisoning and rug pulls to token passthrough and the lethal trifecta, what hosts do about them, and a checklist.
- Secure a remote MCP server with OAuth
Protect a Streamable HTTP MCP server with OAuth 2.1 as the 2026-07-28 spec requires: resource metadata, audience checks, per-tool scopes and Inspector tests.
- Tool poisoning
Malicious instructions hidden in a tool's description, parameters or output that manipulate the agent using it without the user seeing them.
- MCP authorization
The part of the MCP specification that defines how clients obtain OAuth 2.1 access tokens for remote MCP servers over HTTP.
- Connect MCP servers to Claude Code, Codex and Cursor
Add local and remote MCP servers to Claude Code, Codex and Cursor, choose the right scope, sign in with OAuth and check which tools actually loaded.