Skip to content

Last update 

Security tools

MCP implementation security review skill

Audit Model Context Protocol (MCP) server, MCP client, and tool handler code in your AI coding agent.

The skill checks 12 baseline controls aligned with MCP specification 2026-07-28 and 7 remote code execution (RCE) categories. It also maps all 10 OWASP MCP Top 10, 2025 edition risks. The report cites file and line evidence for each finding and separates code findings from manual checks. See the skill definition for the full rule set.

Install the skill

Install the skill with npx and the skills CLI:

npx skills add microsoft/mcp-azure-security-guide --skill mcp-implementation-security-review

Run a security review

Run the skill:

  1. Open your MCP server or MCP client repository in an AI coding agent that supports Agent Skills.
  2. Prompt the agent, for example: "Review this MCP server for security against MCP-01 through MCP-12 and the OWASP MCP Top 10."
  3. Inspect the protocol and transport, control, RCE, and OWASP tables. Check every NEEDS INVESTIGATION item against your deployment configuration and identity provider.

All server targets run all 7 RCE checks. Control scope depends on the target type:

  • Network-exposed HTTP servers. Scores MCP-01 through MCP-07, applicable MCP-09 through MCP-12, and all 10 OWASP risks. Marks MCP-08 as N/A.
  • Localhost HTTP servers. Scores Origin validation under MCP-01, MCP-06, MCP-07, applicable MCP-09, MCP-11, MCP-12, and OWASP checks. Adds best-practice notes for other network controls.
  • Local stdio servers. Evaluates MCP-09, MCP-11, and MCP-12. Marks MCP-01 through MCP-07 as N/A with best-practice notes, and marks MCP-08, MCP-10 (unless the server implements tasks), and network-dependent OWASP risks (MCP07:2025, MCP09:2025) as N/A.
  • MCP clients. Evaluates MCP-08, MCP-09, MCP-11, MCP-12, received-token handling, refusal to trust server-provided legacy session IDs, and MCP-07 cache isolation when the client caches results.
  • Gateways or proxies. Evaluates MCP-01 (audience validation and no token passthrough), MCP-06 (intermediary header validation), MCP-07 (cache rules), MCP-11, and MCP-12.
  • Older protocol revisions. Servers that target only 2025-11-25 or earlier receive a Low finding. For those servers, the review continues under the legacy MCP-02 branch and marks 2026-07-28-only controls (MCP-06, MCP-07) as N/A. HTTP plus Server-Sent Events receives a Medium finding. The skill reviews dual-revision servers under both branches. See What's new.

Baseline controls

Control Name Checks
MCP-01 Identity isolation Authenticates every inbound request, validates the audience (aud) claim, rejects invalid Origin headers with HTTP 403, and blocks token passthrough.
MCP-02 State handles and legacy sessions Mints random opaque state handles bound to the verified principal, returns HTTP 405 on GET and DELETE, and ignores inbound Mcp-Session-Id headers.
MCP-03 Rate limits Enforces per-identity and per-handle rate limits in the server runtime on discovery and invocation, and returns HTTP 429 with Retry-After.
MCP-04 Schema validation Validates all tool arguments server-side against strict JSON Schema 2020-12 definitions that reject unspecified properties.
MCP-05 SDK-first Uses a patched official MCP SDK for remote MCP servers instead of a custom transport stack.
MCP-06 Request header and body consistency Verifies MCP-Protocol-Version, Mcp-Method, applicable Mcp-Name, and Mcp-Param-* headers against the JSON-RPC body, and returns HTTP 400 with -32020 on mismatch.
MCP-07 Cache scope on cacheable results Emits ttlMs and cacheScope on the 6 cacheable methods, sets cacheScope: "private" on user-scoped or tenant-scoped results, and never caches Multi Round-Trip Requests (MRTR) retries.
MCP-08 Client issuer validation and credential binding Applies RFC 9207 iss validation in MCP clients and binds pre-registered and legacy Dynamic Client Registration (DCR) credentials to the issuer. Enforces Proof Key for Code Exchange S256 and sends the RFC 8707 resource parameter.
MCP-09 Elicitation secret isolation and MRTR state integrity Uses URL-mode elicitation for secrets and verifies the authenticated user. Protects requestState integrity and single use wherever it affects authorization, resource access, or business logic.
MCP-10 Task handle entropy and per-request authorization Generates unguessable task IDs and checks caller ownership on every tasks/get, tasks/update, and tasks/cancel call.
MCP-11 JSON Schema $ref and composition bounds Disables automatic dereferencing of network $ref URIs, rejects unresolved external references, and bounds recursive or composed schemas from another party. Servers that validate only their own static schemas are N/A for composition bounds.
MCP-12 Static tool-poisoning indicators Scans tool, prompt, and resource metadata for the 5 OWASP MCP03 static indicators and treats tool annotations as untrusted unless they come from trusted servers. Reports Critical FAIL for indicator 4, indicator 5, or a confirmed adversarial match, NEEDS INVESTIGATION when ambiguous, and PASS for benign usage hints.

RCE and OWASP coverage

The skill inspects every tool handler for 7 RCE categories:

  • Command injection (CWE-78)
  • Dynamic code evaluation (CWE-94 and CWE-95)
  • Unsafe deserialization (CWE-502)
  • Path traversal (CWE-22)
  • Server-side template injection (CWE-1336)
  • Dependency hijacking (CWE-829)
  • Server-side request forgery (CWE-918)

It maps observable evidence to all 10 OWASP MCP Top 10 risks as PASS, FAIL, NEEDS INVESTIGATION, or N/A, and reuses baseline control results where they apply.

Sample review output

Illustrative example

This excerpt shows a fictional remote Streamable HTTP MCP server (inventory-mcp-server) with placeholder file paths, line numbers, and statuses.

Protocol and transport (example)

Check Status Severity Justification
Target type Server - src/server.ts:12 registers MCP tool handlers on HTTP.
Target revisions 2026-07-28 - src/http/discover.ts:19 advertises supportedVersions: ["2026-07-28"].
Transport and exposure Network-exposed HTTP - src/server.ts:44 binds StreamableHttpServerTransport on 0.0.0.0:8080.
HTTP plus Server-Sent Events PASS - No legacy SSEServerTransport or /sse route.
Older protocol revision PASS - src/http/version.ts:15 accepts only 2026-07-28.
server/discover PASS - src/http/discover.ts:14 implements server/discover.
Unsupported version handling (HTTP 400 and -32022) PASS - src/http/version.ts:22 returns HTTP 400 with -32022, data.supported, and data.requested.
State model State handles - src/state/handles.ts:27 mints opaque handles and ignores Mcp-Session-Id.

Control summary (example)

Control Name Status Severity Justification
MCP-01 Auth and identity isolation PASS - src/auth/jwt.ts:42 validates aud against the dedicated server resource ID. src/http/origin.ts:18 returns HTTP 403 on disallowed Origin values.
MCP-02 State handles (and legacy sessions) PASS - src/state/handles.ts:27 uses crypto.randomBytes(32) and keys records by ${tenantId}:${userId}:${handleId}.
MCP-03 Rate limiting and abuse protection NEEDS INVESTIGATION Medium infra/apim-policy.xml:14 configures gateway throttling, but src/server.ts lacks runtime rate-limit middleware.
MCP-06 Request header and body consistency FAIL High src/http/router.ts:61 dispatches from params.name with no Mcp-Name check or -32020 error.
MCP-08 Client issuer validation and credential binding N/A - Remote MCP server only.

RCE summary (example)

RCE class Status Severity Justification
Command injection AT RISK Critical src/tools/export.ts:88 passes args.filter into exec("csvtool --filter " + args.filter) through a shell.
Path traversal AT RISK High src/tools/report.ts:53 joins args.filename into fs.readFile without a canonical path check against a fixed base directory.
Server-side request forgery N/A - No tool sends HTTP requests to caller-supplied URLs.

OWASP summary (example)

Risk Status Justification
MCP01:2025 PASS No hardcoded secrets found. src/clients/storage.ts:12 uses managed identities for Azure resources.
MCP05:2025 FAIL Shell command injection in src/tools/export.ts:88 lets tool input reach exec().
MCP07:2025 FAIL No header-body check (MCP-06) in src/http/router.ts:61.

Manual follow-ups (example)

  • Confirm whether a sidecar or middleware outside src/server.ts enforces runtime rate limiting (MCP-03).
  • Verify Microsoft Entra ID app registration scopes and Conditional Access assignments in the target tenant (MCP02:2025, MCP07:2025).

Next steps

Act on your review: