MCP security best practices
The best MCP security practices are to discover every server, vet each before first use, authenticate remote endpoints with tokens issued for your server, constrain files, network and scopes, log every tool call and keep a removal plan. Each practice below cites the MCP specification, OWASP or client documentation read on 16 Nov 2026.
Facts read on .
What are the best practices for MCP security?
The best practices for MCP security are to run only servers you have reviewed, give each server the narrowest credentials and file access it needs, require authentication on every remote endpoint, keep a person in the loop for sensitive tool calls and log every call. The MCP specification and the OWASP MCP Security Cheat Sheet agree on these points, and OWASP tells operators to treat each server as an untrusted, separate security domain.
Eleven practices follow from those two documents:
- Inventory every configured server on every machine, including project-level config files.
- Read the source, tool descriptions and schemas before first use, and verify the package name against its publisher.
- Show the exact startup command to the user before a local server runs.
- Sandbox local servers with minimal file system, network and credential access.
- Require authentication on any remote endpoint that exposes non-public tools or data.
- Accept only tokens issued for your server, and never pass them to an upstream API.
- Request narrow scopes and use short-lived, per-server credentials.
- Validate every tool input as untrusted, and keep a human approval step for destructive calls.
- Pin the complete reviewed tool definition and re-review when it changes.
- Log each invocation with parameters, user and timestamp, and send logs to a SIEM.
- Know in advance how to remove a server and revoke what it held.
Sources: MCP specification: Security Best Practices (2025-11-25); OWASP MCP Security Cheat Sheet.
Which practices matter most for developer machines?
Controlling what starts on the machine matters most, because a local MCP server is a program the client launches from a config entry. The specification lists three local attacks: a malicious startup command in a client configuration, a malicious payload inside the server itself, and an insecure local server reached through DNS rebinding. Its stated risks include arbitrary code execution with the client's privileges and no visibility into the commands run.
Configuration files that ride along in a repository are a delivery path, since Visual Studio Code documents a workspace-root .mcp.json that teams share through source control. Review changes to those files like code. Clients also give administrators allowlists: Claude Code documents allowedMcpServers and deniedMcpServers settings and a managed-mcp.json file for exclusive control, and Cursor documents an MCP Allowlist that approves local servers by command pattern and remote servers by URL pattern. Cursor notes that allowlisting approves a configuration and does not install the server.
Start with the inventory, because every other control depends on it. A team that cannot list its servers cannot allowlist, review or revoke them. Project-level files such as .mcp.json travel with the repository, user-level files sit in the home directory, and desktop apps keep their own configuration, so a complete inventory reads all three places on every operating system you support.
Sources: MCP specification: Security Best Practices (2025-11-25); Visual Studio Code documentation: Add and use MCP servers; Claude Code documentation: Connect Claude Code to tools via MCP; Cursor documentation: Model Context Protocol.
How do you secure the connection to a remote MCP server?
Require authentication, validate the token's audience on every request, and refuse any token that was not issued for your server. The specification makes authorization optional, so a remote server with non-public tools has no protection until you add it. When OAuth is used, clients must send the resource parameter that names the server, and servers must reject tokens issued for another audience with a 401.
Token passthrough, where a server accepts a client's token and forwards it downstream, is forbidden by the authorization specification. It defeats rate limiting and audit trails and widens the blast radius of a stolen token. For HTTP servers, validate the Origin header and answer an invalid one with 403, and bind local servers to 127.0.0.1 rather than all interfaces. Store tokens in the operating system's credential store, not in plaintext config files.
Sources: MCP specification: Authorization (2025-11-25); MCP specification: Security Best Practices (2025-11-25); MCP specification: Transports (2025-11-25); OWASP MCP Security Cheat Sheet.
How do you control what a tool can do?
Review the whole tool definition, restrict what each tool can reach, and require approval for destructive calls. OWASP treats the entire schema as an injection surface, not only the description field, and advises hashing the complete definition, including input schema, output schema and annotations, so a changed definition triggers review. A hash detects metadata changes; it does not detect changed behavior behind an unchanged definition.
The specification says clients must treat tool annotations as untrusted unless they come from trusted servers, and that there should always be a human in the loop who can deny tool invocations. Validate inputs as untrusted because they come from model output shaped by whatever the model has read. Use strict JSON Schema with additionalProperties set to false, and never fetch arbitrary URLs a model supplies without an allowlist.
Match the control to the effect of the call. OWASP says a read or write label alone may not establish risk, and it recommends choosing between explicit confirmation, narrowly scoped authorization and policy checks enforced at execution time according to what the tool can do, including sensitive reads and irreversible actions.
Sources: OWASP MCP Security Cheat Sheet; MCP specification: Tools (2025-11-25).
How do the practices map to the checklist?
The checklist groups the practices into six steps, in the order a team usually works. Discover covers the inventory of servers and config files. Vet covers source, descriptions, publisher and provenance. Authenticate covers tokens, audience and scopes.
Constrain covers sandboxing, allowlists and approval. Observe covers logging and alerting. Respond covers removal, revocation and finding every machine that ran a server. Each checklist item links back to the register row it reduces, so a ticked box can be traced to a risk.
Sources: OWASP MCP Security Cheat Sheet; MCP specification: Security Best Practices (2025-11-25).
What do the standards leave to you?
The standards leave code review, enforcement and monitoring to you. The MCP Registry verifies who owns a namespace and hosts metadata, but it delegates security scanning of server code to package registries and downstream aggregators.
Developer tools carry the same risk as production servers. In June 2025 a critical advisory for MCP Inspector (CVE-2025-49596) described remote code execution in versions below 0.14.1 because the client and proxy did not authenticate each other, and the fix was to upgrade to 0.14.1 or later. Keep inspection tools updated and off shared networks.
Message signing is optional too. OWASP describes an Internet-Draft for signing and replay protection as an individual work in progress and not an adopted MCP standard, and advises against presenting it as a requirement for ordinary deployments.
Sources: MCP Registry: About; GitHub advisory GHSA-7f8r-222p-6f5g: Inspector proxy server vulnerabilities (CVE-2025-49596).
Sources
- MCP specification: Security Best Practices (2025-11-25) (modelcontextprotocol.io), read
- MCP specification: Authorization (2025-11-25) (modelcontextprotocol.io), read
- MCP specification: Transports (2025-11-25) (modelcontextprotocol.io), read
- MCP specification: Tools (2025-11-25) (modelcontextprotocol.io), read
- MCP Registry: About (modelcontextprotocol.io), read
- OWASP MCP Security Cheat Sheet (cheatsheetseries.owasp.org), read
- GitHub advisory GHSA-7f8r-222p-6f5g: Inspector proxy server vulnerabilities (CVE-2025-49596) (github.com), read
- Claude Code documentation: Connect Claude Code to tools via MCP (code.claude.com), read
- Cursor documentation: Model Context Protocol (cursor.com), read
- Visual Studio Code documentation: Add and use MCP servers (code.visualstudio.com), read