Skip to content
ansezz.
Laravel Nov 30, 2026 7 min read 1,220 words

Your MCP gateway reads a header. Your tool reads the body.

MCP 2026-07-28 lets a tool argument travel in a header and in the body. Laravel MCP 1.2.1 rejects a mismatch, but only for tools that declare it.

Anass Ez-zouaine

Backend · Architect · AI

Comic pop-art scene of a yellow robot reading a blue tag taped to the outside of a cardboard box while a blue robot cuts a second box open and pulls out a note with a red stripe, under the words TWO LABELS, ONE BOX
▸ On this page (5)

An MCP tool call can now carry one argument twice, once in the body and once in a header. If the two disagree, your gateway and your tool act on different values.

This is a different problem from the Origin check and from the stateless request headers. Those cover who is calling and which protocol version they speak. This one is about a value that appears in two places.

A tool argument can now travel twice

Say a tool takes a region argument. In the 2026-07-28 spec, the server may add an x-mcp-header property to that argument in the tool’s inputSchema:

"region": { "type": "string", "x-mcp-header": "Region" }

When a tool declares this, the spec says conforming clients must also send the value as Mcp-Param-Region: us-west1. The point is to let a load balancer, rate limiter, or WAF decide something without reading the body.

The annotation is optional for servers. The spec limits it to string, integer, and boolean arguments. A value that is not plain ASCII gets a Base64 form, =?base64?...?=.

Now you have the same fact in two places. The spec says why that is a problem. Servers must reject a mismatch because components can rely on different sources of truth, for example “a load balancer routing on the header value while the MCP server executes based on the body value.”

That sentence is the whole risk. The gateway sees staging. The tool receives production.

Laravel MCP 1.2.1 compares the two

The server side of the rule landed in PR #406, merged on 17 November and shipped in v1.2.1. For an annotated tool over HTTP, a mirrored header that is missing, unexpected, or different from the body now fails with 400 and -32020. Over stdio there are no headers, so the check is skipped.

The check runs when the tool is called. It does not run in the ValidateMcpHeaders middleware, because only the tool schema says which arguments carry the annotation.

One more thing: I could not find a fluent way to declare the annotation. A search of the Laravel 13.x MCP docs for x-mcp-header finds nothing. The package’s own test fixture adds it by overriding toArray(), so I did the same:

public function toArray(): array
{
    $tool = parent::toArray();

    $tool['inputSchema']['properties']['region']['x-mcp-header'] = 'Region';

    return $tool;
}

Same request, three versions

I built a small Laravel 13.44.1 app with one annotated tool, drain-region-tool, and ran the same requests against laravel/mcp 1.2.0, 1.2.1, and 1.3.0. The run was on 30 November 2026, at 17:52 Asia/Kuala_Lumpur, against a local server. The tool does nothing but echo the body value.

Request1.2.01.2.1 and 1.3.0
Header us-west1, body us-west1200, draining us-west1200, draining us-west1
Header staging, body production200, draining production400, -32020
Header missing200, draining production400, -32020
Base64 header for staging, body production200, draining production400, -32020
Old-style client with no protocol headers, same mismatch200, draining production400, -32020

On 1.2.0, a gateway that routes on staging forwards a request that runs on production. From 1.2.1 on, the same request is rejected before the tool runs. The message names the header and the body path, for example The [Mcp-Param-Region] header value does not match the request body value at [/region].

Comic pop-art scene of a blue robot with a magnifying glass comparing a blue tag with a note that has a red stripe, a red 400 stamp on the box, under the words COMPARE BOTH
Same box, two labels. The server compares both and stamps 400 when they differ.

Where the header is still only a hint

Two things in the same run are easy to miss.

First, the check only covers tools that declare the annotation. I added a second tool with the same region argument and no x-mcp-header. A request with a lying Mcp-Param-Region header returned 200 on every version, and the tool used the body. Nothing was wrong with the tool. But if your own code reads Mcp-Param-Region for every call, it is reading a value nobody validated for that tool.

Second, order. I added a middleware to the MCP route that records the header it sees. On the rejected request, it logged Mcp-Param-Region='staging' before the 400 came back. So a rate limit keyed on that header counts the request under staging, even though the call was refused.

That is mostly harmless for a counter. It is not harmless for a decision. An allow list or a tenant lookup in front of the tool should not treat the header as settled.

Trusting the copy

Middleware reads Mcp-Param-Region, picks a tenant or a rate bucket, and the tool trusts that choice later.

Trusting the body

The tool reads region from the arguments and authorizes that value. The header is used for routing and metering only.

A header is a second opinion about an argument. The tool runs on the body.

The spec adds a note for intermediaries that enforce policy on these headers, such as routing or rate-limiting by tenant. They should check that MCP-Protocol-Version names a version that requires the validation. If it is older or missing, they should reject the request instead of trusting the header.

What I would check this week

Run composer show laravel/mcp. If you are below 1.2.1 and any tool declares x-mcp-header, update first. From 1.2.1 on, a mismatch gets a 400. Below it, the lie goes through.

If you never declared the annotation, you do not need it. Add it only when a gateway really needs a value to route or meter on, and keep it to the arguments that need it.

Keep authorization on the body. Put the check inside the tool, or in a policy it calls, and use the header for routing. Then a header that slips past a layer cannot change what the tool is allowed to do.

Key takeaways

  • With x-mcp-header, one tool argument travels in the body and in an Mcp-Param-{Name} header. The spec says the server must reject a mismatch with 400 and -32020.
  • Laravel MCP 1.2.1 and later do that for annotated tools over HTTP. 1.2.0 and older ran the body value while the header said something else.
  • The header is only a hint for unannotated tools and for any code that runs before the tool call. Authorize on the body.

Which part of your stack reads an MCP header before your tool does?

▸ Made it to the end? Send it around.

▸ Share

▸ Comments