PTS security notes / Guides

An MCP server security checklist for Claude Code, Codex and Cursor

By PTS · Published 2026-12-03 · Updated 2026-12-03 · Docs checked December 3, 2026

An MCP server is not a harmless plugin. A local server is an ordinary process your coding agent launches. Official MCP docs are blunt about that: it inherits your environment variables, can read anything your account can read, and can open outbound network connections, unless you isolate it yourself (local server security).

This is a practical pass you can finish in about 15 minutes. Setting names and limits were checked against official docs on December 3, 2026. Tools change fast. If a key does not match your version, trust the vendor docs over this page. Test any change on a non-production project first.

If you have not yet mapped accounts, env names and existing servers, start with the 15-minute inventory. The permissions audit covers deny lists, sandboxes and Cursor ignore files.

1. Inventory every server, then delete the ones you do not use

Official MCP guidance says that if you do one thing after reading it, open your client's MCP configuration, remove the servers you no longer use, and make sure you know where each remaining one comes from, with its version pinned (local server security).

Where to look:

Write down, for each server: the name, how it is launched (command or URL), the publisher, the pinned version if you have one, and the account or API it can reach. If you cannot explain why it is there, remove it.

2. Treat a local stdio server as code you chose to run

Most local servers use stdio: the client starts the server as a child process and talks to it over stdin and stdout. Official MCP docs say the client and a stdio server share one trust domain. The protocol does not sandbox one against the other. A server already has code execution on your machine by being launched. Isolation is your job, and the host application's, not the transport's (local server security).

The trust is also cumulative. Every server you add shares the same model context, so a bad server can influence how the agent uses the tools of every other server.

Claude Code's MCP page adds a direct warning: verify you trust each server before connecting it, because servers that fetch external content can expose you to prompt injection risk (Claude Code MCP).

3. Pin the publisher and the version

The same official local-server guide tells you to confirm an identifiable publisher and pin the version. Clients that offer one-click install are supposed to show the exact command before it runs. Official MCP docs describe that requirement as SEP-1024 in local server security. Read that command. A typosquat or an abandoned package with a new publisher is a different threat from a protocol bug.

Prefer a remote, hosted server when the tool needs nothing from your laptop. A remote server still has to be trusted, but it is not an extra process with your home directory and your shell environment.

4. Do not let servers inherit your whole shell

Official guidance: give each server only its own narrowly scoped credentials in per-server config. Nothing inherited from your shell, and nothing reused across servers (local server security).

If a server needs an API token, put that token in the server's own env block, scoped to the least privilege the tool needs. Do not point a server at your personal cloud admin keys because they were already in the terminal.

Claude Code also documents a specific case for headersHelper commands that a repository or plugin might supply. Those helpers can be arbitrary shell. For a server in a project .mcp.json, Claude Code runs the helper only after you accept the trust dialog for that project directory. It also strips many credential-looking environment variables from helpers in project scope. Read the current MCP reference for your version before you rely on that stripping as a complete control. It is a mitigation, not a reason to leave broad secrets in the environment.

5. Limit files and network, on purpose

Official local-server defaults:

None of that is provided by the MCP protocol itself. You or your tools have to set it.

Remember the limit you already saw in the inventory and audit guides: a tool sandbox that wraps shell commands does not automatically wrap MCP servers. Official Claude Code docs describe the sandbox as wrapping shell, while built-in file tools, MCP servers and hooks can run outside it (sandboxing). Cursor's ignore file does not block the terminal or MCP tools (ignore file).

6. Approve project servers and MCP tools deliberately

For Claude Code:

For Cursor, keep approval prompts on for MCP and terminal use, and treat auto-run or "yolo" style modes as best-effort guardrails, not a hard boundary. Cursor's own agent security and ignore file pages are the source for those limits.

For Codex, read the project and user config.toml so you know which servers start with the session, and keep approval and sandbox settings at the safe defaults from the config basics.

7. Watch for tool descriptions that change

Official MCP local-server guidance includes this item on its own-machine checklist: skim each server's tool descriptions, and use a client that re-prompts when a tool definition changes (local server security). A server that was safe at install time can grow a new tool later. If your client does not re-prompt, re-read the tool list yourself after updates.

8. Be careful with tokens and proxies on remote servers

If you connect to remote MCP servers over HTTP, official Security Best Practices cover a different threat model: confused-deputy issues in proxy servers, token passthrough, and over-broad OAuth scopes (security best practices). The practical version for a developer machine:

You do not need to implement the protocol to follow those habits.

A compact checklist

Copy this into your notes, or use the worksheet in the free Agent Blast Radius Checklist:

  1. I can name every MCP server in Claude Code, Codex and Cursor, and I removed the ones I do not use.
  2. I know the publisher and pinned version for each remaining server.
  3. Each server has its own narrowly scoped credentials. Nothing is inherited from my shell "because it was already there."
  4. Filesystem access is limited to the directories the server actually needs.
  5. Servers that do not need the network cannot reach the network. The rest have a known destination list.
  6. Third-party local servers run isolated, not as a bare process with my full user account.
  7. Project MCP configs are approved on purpose, not with a blanket allow.
  8. High-impact MCP tools are on an ask or deny list, and skip-all-prompts modes are off on machines with real keys.
  9. I have skimmed the tool descriptions, and I will re-check them after a server updates.
  10. I know that ignore files and some sandboxes do not automatically contain MCP servers.

Official pages to re-check

Get the free checklist

A 9-page worksheet plus starter files for Claude Code and Codex. Download it on Gumroad. This site does not collect email.

Get the free checklist

Keep reading