A multi-tenant MCP gateway must route each tools/call to the correct tenant's backend based on a tenantId tool argument, without parsing JSON request bodies. How should the server enable this?
Select an answer to reveal the explanation.
Short Explanation
It's like you writing the apartment number on the outside of the envelope so the mailroom doesn't have to open it. The trap is cramming routing data into the tool name or a session ID, which hacks around a feature built for exactly this.
Full Explanation
The Streamable HTTP transport mirrors selected body fields into headers so intermediaries such as load balancers and gateways can route without parsing the body. Beyond the standard Mcp-Method and Mcp-Name headers, a server can mark a primitive tool parameter in its inputSchema with x-mcp-header; conforming clients must then send that argument's value in a header named Mcp-Param- followed by the declared name, encoding unsafe values as Base64. The server validates that header and body agree and rejects mismatches with HTTP 400 and the HeaderMismatch error, -32020, so the gateway can route on the header knowing the backend sees the same value. Adding a custom query parameter is not part of the transport, so conforming clients will not send it and nothing validates it against the body. Encoding the tenant into tool names multiplies tool definitions per tenant and leaks tenant identifiers into the shared tool list, which should not vary per connection. Mcp-Session-Id is a legacy header that modern servers ignore and never mint. Exam caveat: gateways enforcing policy on mirrored headers should reject requests whose protocol version predates header validation. Operational check: call the tool and confirm the request carries the mirrored tenant header, then send a mismatched header and confirm a 400 with -32020.