Validate the Origin header on MCP web routes
Merged
PU
10d ago+179+179+012345678901234567890123456789-3-3-0123456789
The Streamable HTTP transport specification says that servers MUST validate the Origin header and respond 403 when it is invalid. This protects servers on localhost or a private network from DNS rebinding. A malicious page can otherwise use the visitor's browser to call those servers.
Routes from Mcp::web() now reject a browser request when its Origin is not the app.url origin or a loopback origin. Requests without an Origin header pass, so SDKs, desktop clients, and server-side connectors do not change. The dns-rebinding-protection conformance scenario now passes.