Guide security/
MCP server security checklist: what to check before you ship
The requirements the MCP specification puts on server authors, plus the project's guidance for local installs, as a list you can run before each release.
Short answer
Before shipping an MCP server, check it against the MCP specification, version 2026-07-28. Validate every tool input, enforce access control, rate limit calls and sanitize outputs. Keep tool descriptions to what each tool does. On Streamable HTTP, validate the Origin header and accept only access tokens issued for your server, never forwarding them. Request minimal scopes and step up later. For local installs, publish a pinned launch command and ask for narrowly scoped credentials.
Checked against: the MCP specification’s overview, Tools, Authorization and Streamable HTTP pages (version 2026-07-28), and the MCP project’s Security Best Practices and Local Server Security guides, December 6, 2026.
Run by us: no. Commands and config are copied from the MCP project’s and Anthropic’s docs.
What does the spec require of every MCP server?
The Tools page requires four things of any server that exposes tools: validate all tool inputs, implement proper access controls, rate limit tool invocations and sanitize tool outputs. The rest of this checklist adds the transport and authorization rules:
| # | Check | Level |
|---|---|---|
| 1 | Validate all tool inputs | MUST |
| 2 | Implement proper access controls | MUST |
| 3 | Rate limit tool calls | MUST |
| 4 | Sanitize tool outputs | MUST |
| 5 | Validate the Origin header on Streamable HTTP |
MUST |
| 6 | Accept only tokens issued for your server; never pass them through | MUST / MUST NOT |
| 7 | Publish Protected Resource Metadata if the server uses authorization | MUST |
| 8 | Add per-client consent if you proxy a third-party API with a static client ID | MUST |
| 9 | Never treat a state handle as authentication | MUST NOT |
| 10 | Bind a local HTTP server to 127.0.0.1 | SHOULD |
| 11 | Start with minimal scopes and step up | Recommended |
The spec overview says why this falls on you: MCP “cannot enforce these security principles at the protocol level.” As of December 6, 2026, the versioning page lists 2026-07-28 as the current protocol version.
How should I write tool definitions?
Write each one as a short, accurate description of what the tool does, with a strict schema. This is the spec’s recommended form for a tool with no parameters:
{
"name": "get_current_time",
"description": "Returns the current server time",
"inputSchema": {
"type": "object",
"additionalProperties": false
}
}
- Names. SHOULD be 1 to 128 characters from ASCII letters, digits,
_,-and., unique within the server. Claude Code prefixes them asmcp__<server>__<tool>and drops any tool whose full name exceeds 128 characters, per Anthropic. - Descriptions. Describe the job and nothing else. The Local Server Security guide tells users to remove servers whose descriptions contain “instructions that have nothing to do with the tool’s job,” the check that catches tool poisoning.
- Annotations. Clients MUST treat them as untrusted unless they come from trusted servers, so
readOnlyHintis a hint, not a control. - A stable list. The tool set MUST NOT vary per connection and SHOULD come back in a deterministic order. When it changes, send
notifications/tools/list_changed; some clients then ask users to approve the new definitions. - Header mirroring. Don’t mark passwords, API keys, tokens or personal data with
x-mcp-header; the spec says header values are visible to network intermediaries.
For a tool whose approval prompt is the point, such as granting access, Claude Code honors this vendor-specific flag:
{
"name": "grant_access",
"description": "Requests access to a protected resource",
"_meta": {
"anthropic/requiresUserInteraction": true
}
}
Anthropic’s docs say the permission prompt then appears for every call to that tool, even in auto and bypassPermissions modes.
How do I lock down a Streamable HTTP endpoint?
Validate the Origin header, bind to localhost when running locally, and authenticate every request. When a request has no valid token, answer as in the Authorization spec’s example:
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer resource_metadata="https://mcp.example.com/.well-known/oauth-protected-resource",
scope="files:read"
The Streamable HTTP spec adds:
- Servers MUST validate the
Originheader and respond 403 Forbidden when it is present and invalid. Otherwise, the spec says, “attackers could use DNS rebinding to interact with local MCP servers from remote websites.” - Local servers SHOULD bind only to 127.0.0.1, not 0.0.0.0, and all servers SHOULD authenticate every connection.
- Servers MUST reject a request whose
MCP-Protocol-Version,Mcp-MethodorMcp-Nameheader doesn’t match the body, with400 Bad Requestand error-32020(HeaderMismatch), so a load balancer can’t route on one value while your server executes another.
Protocol 2026-07-28 has no protocol-level sessions. If a tool keeps state, the Security Best Practices page says servers MUST NOT treat possession of a state handle as authentication, and SHOULD use securely random handles bound to the user, for example keyed as <user_id>:<handle> with the user ID from the verified token.
How should my server handle access tokens?
Accept only tokens issued for your server, and never forward them. These rules come from the Authorization spec:
| Rule | Level |
|---|---|
| Serve Protected Resource Metadata (RFC 9728) | MUST |
| Validate access tokens per OAuth 2.1 Section 5.2 | MUST |
| Validate that each token was issued for your server as its audience (RFC 8707) | MUST |
| Return HTTP 401 for invalid or expired tokens | MUST |
| Accept or transit any other tokens | MUST NOT |
Return 403 with error="insufficient_scope" when a token lacks scope |
SHOULD |
Tokens arrive in the Authorization header; clients MUST NOT put them in the query string. Authorization is optional in MCP, and stdio servers SHOULD NOT follow the authorization spec but “retrieve credentials from the environment.”
The Security Best Practices page explains the ban on token passthrough: forwarding client tokens lets callers skip controls that depend on the token’s audience, such as rate limits, and leaves downstream logs showing the wrong identity. See the token passthrough guide and the MCP authorization walkthrough.
How many scopes should my server ask for?
Ask for as few as the first operation needs, and request more through step-up challenges. The spec’s insufficient-scope response:
HTTP/1.1 403 Forbidden
WWW-Authenticate: Bearer error="insufficient_scope",
scope="files:write",
resource_metadata="https://mcp.example.com/.well-known/oauth-protected-resource",
error_description="File write permission required for this operation"
The Security Best Practices page lists the common mistakes: publishing every possible scope in scopes_supported, wildcard or omnibus scopes such as *, all or full-access, bundling unrelated privileges, returning the whole scope catalog in every challenge, changing a scope’s meaning without versioning, and trusting scopes claimed in a token without server-side authorization logic.
The Authorization spec adds that scopes_supported should be the minimal set for basic functionality, and one challenge SHOULD carry every scope the current operation needs. Log each elevation, with the scope requested and the subset granted, under a correlation ID.
What extra checks apply if my server proxies a third-party API?
If your server uses one static client ID with a third-party authorization server, it MUST add per-client consent, or it becomes a confused deputy. In the Security Best Practices page’s attack, a consent cookie from an earlier sign-in lets an attacker’s registered client skip the consent screen and collect an authorization code. Required protections:
| Area | What the server MUST do |
|---|---|
| Consent registry | Keep approved client_id values per user and check them before starting third-party authorization |
| Consent page | Name the requesting client, show the third-party scopes and the registered redirect_uri, use CSRF protection, and block framing with frame-ancestors or X-Frame-Options: DENY |
| Consent cookies | Use the __Host- prefix; set Secure, HttpOnly and SameSite=Lax; sign them or use server-side sessions; bind them to the client_id |
| Redirect URIs | Match the registered URI by exact string |
state |
Random, stored only after consent, single-use, short-lived (the page’s example is 10 minutes) |
Dynamic Client Registration is deprecated as of 2026-07-28, but the page says the attack “still applies to MCP proxy servers that support it.”
What if users run my server on their own machines?
Treat the launch command, the package and the credentials it asks for as part of your server. The Security Best Practices page says servers meant to run locally SHOULD use stdio “to limit access to just the MCP client,” or, over HTTP, require an authorization token or use Unix domain sockets or other restricted IPC. Document an exact version in the install command, as the MCP project’s local server tutorial does:
"args": [
"-y",
"@modelcontextprotocol/server-filesystem@2.4.1",
"/Users/username/Desktop",
"/Users/username/Downloads"
]
From the Local Server Security guide:
- Offer a remote version if the server only wraps a remote API; the guide tells users to “Prefer the remote version where one exists.”
- Publish provenance: signed artifacts, build attestations and an SBOM. An
npxoruvxpin “fixes only the top-level package”; a container image pinned by digest “freezes the entire dependency tree.” - Ask for one narrowly scoped token through per-server config, and an explicit root directory, read-only where possible.
- Keep the launch command readable. One-click installers MUST show “the exact command that will be executed, without truncation,” and the Security Best Practices page warns about “complex or convoluted commands” made to look legitimate.
How do I test this before a release?
Run the MCP Inspector against your server and read what a client will receive. From the Inspector docs:
# List a server's tools and exit
npx @modelcontextprotocol/inspector --cli node path/to/server/index.js --method tools/list
That prints every name, description and schema as your server returns them. For a deployed endpoint, the docs connect with --server-url https://api.example.com/mcp --transport http instead. The Inspector guide covers the OAuth flow, and running a remote MCP server covers deployment.
What to read next
Sources
Changelog
- First published.
Cite this page
Agents for Devs. "MCP server security checklist: what to check before you ship." Published Dec 6, 2026. https://agentsfordevs.com/guides/mcp-server-security-checklist - Page: https://agentsfordevs.com/guides/mcp-server-security-checklist
- Markdown version: https://agentsfordevs.com/guides/mcp-server-security-checklist.md
- Reuse: quote or summarize with a link to this page. Reuse terms
Cite one section
- What does the spec require of every MCP server?
- How should I write tool definitions?
- How do I lock down a Streamable HTTP endpoint?
- How should my server handle access tokens?
- How many scopes should my server ask for?
- What extra checks apply if my server proxies a third-party API?
- What if users run my server on their own machines?
- How do I test this before a release?
- What to read next