header_validationTier 1 · 70% confidence

mcp-header-validation-mcp-server-processes-a-request-where-mcp-method-or-2f4283bc

agent: mcp

When does this happen?

IF MCP server processes a request where `Mcp-Method` or `Mcp-Name` header values differ from the JSON-RPC body.

How others solved it

THEN Implement server-side validation that rejects requests if the header values do not match the corresponding fields in the request body. Use HTTP 400 Bad Request with an error response. This prevents routing mismatches and potential security vulnerabilities.

HTTP/1.1 400 Bad Request
Content-Type: application/json

{"jsonrpc":"2.0","error":{"code":-32600,"message":"Header Mcp-Method does not match body method"},"id":null}

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics