What a local server can touch
Most local MCP servers use the stdio transport: your client launches the server as a child process. The MCP docs describe what that means (local server security). The process inherits your environment variables, can read anything your account can read, including SSH keys, cloud credentials and browser profiles, and can open outbound network connections anywhere. The protocol does not sandbox it. Your security decisions happen before launch: what you install and how you run it.
A remote server is a different case. One offered over Streamable HTTP runs no code on your machine. The MCP guide says to prefer the remote version where one exists, and to treat an unnecessary local install as a signal to ask why.
Six checks before you install
- Does it need to run locally at all? If it only wraps a web API, use the remote version if there is one.
- Who published it? Tie the package to a source repository and a real maintainer or organization, with recent, plausible activity. A registry listing is not an endorsement.
- Is the name exact? Typosquatting is the cheapest attack there is. Confirm the package matches what the docs name, not a lookalike.
- Is the version pinned? Install a specific version, not
latest. Pinning annpxoruvxpackage fixes only the top-level package. Pinning a container image by digest (image@sha256:...) freezes the whole dependency tree. - Did you read the tool list? Tool names and descriptions are text your model reads as instructions. If a description contains instructions unrelated to the tool's job, remove the server. The MCP Inspector lists every tool a server exposes without a model in the loop.
- Is the roster small? Every server shares the model's context, so each one you add widens the surface for all the others.
Why the tool list matters
The MCP docs name these threats. A version pin covers the last one, but not the first three:
- Tool poisoning: hidden directives in a tool's name or description steer the agent, even if that tool is never called.
- Tool shadowing: a poisoned tool steers how the agent uses another server's tools.
- Rug pull: a server quietly changes its tool definitions after you approved it, so a one-time consent dialog and a version pin do not help.
- Compromised dependency: the author is honest, but a package in the tree is not.
The fix for drift is to pin the tool list and diff it. The free mcp_pin.py tool records every tool a stdio server advertises, then fails if a tool is added, removed or changed, annotations included:
python3 mcp_pin.py pin mcp-tools.lock.json -- npx -y some-mcp-server@1.2.3
python3 mcp_pin.py check mcp-tools.lock.json -- npx -y some-mcp-server@1.2.3check exits 1 on any difference, so it works in CI or a pre-launch script. Read the diff before you re-pin. Prefer a browser? Paste two tools/list results into the free MCP tool-list diff checker.
Run it in a container
The MCP guide calls process isolation the single highest-leverage mitigation. A baseline: run third-party servers in a container with no volume mounts beyond what the server needs, no network unless it must have one, and each server's own narrowly scoped token passed through its per-server config. In a Claude Code .mcp.json, that looks like this:
{
"mcpServers": {
"project-files": {
"command": "docker",
"args": [
"run", "-i", "--rm", "--network=none",
"--mount", "type=bind,src=/path/to/project,dst=/work,readonly",
"example/files-server@sha256:<digest-you-checked>", "/work"
]
}
}
}The image name is a placeholder. Swap in a server whose source you have read and whose digest you pinned. Stdio works unchanged through docker run -i.
What your client does for you
- Claude Code: servers in a project
.mcp.jsonhave their own approval prompt, and a cloned repository cannot approve its own servers. Its docs say to verify you trust each server before connecting it, and that servers fetching external content add prompt injection risk (Claude Code MCP). - Cursor: all MCP connections need your approval, and after that each tool call still needs approval unless you pre-approve specific tools with an MCP allowlist (agent security).
- Codex: destructive app or MCP tool calls always need approval when the tool advertises a destructive annotation, unless it also advertises a read annotation (approvals and security).
None of those checks proves a server is honest. They keep you in the loop while you decide.
Quick follow-ups
Are servers in a directory or registry safe?
Not automatically. The MCP docs say a listing is not an endorsement, and that even curated catalogs describe their vetting as best-effort: curation reduces risk, it does not take on accountability for what you run.
Is a remote MCP server safer than a local one?
It removes one risk, because no server code runs on your machine. It still sees whatever data you send it, so scope its access and read its tool list like any other.
What is tool poisoning?
Instructions hidden in a tool's name, description or schema that the model reads and may follow. The user interface often never shows them.
Sources
- MCP: Local Server Security
- MCP: Security Best Practices
- OWASP: MCP Security Cheat Sheet
- Claude Code: Connect to tools via MCP
- Cursor: Agent security
- Codex: Agent approvals and security
See also the glossary and the other questions.
