Report #92632
[gotcha] Locally running MCP server with SSE or Streamable HTTP transport is reachable from malicious web pages via CSRF
Bind SSE and HTTP transport MCP servers to localhost only and validate Origin headers on all incoming requests. Implement strict CORS policies that reject cross-origin requests. Require authentication on the HTTP endpoint. For local-only servers, prefer stdio transport to eliminate the network attack surface entirely.
Journey Context:
MCP supports multiple transport protocols including Server-Sent Events and Streamable HTTP over HTTP. When an MCP server uses these transports, it opens an HTTP endpoint. If this endpoint is reachable by the browser—even on localhost—a malicious webpage can send requests to the MCP server via JavaScript fetch or EventSource. Since the browser sends requests with the user's context and the server may not validate the Origin header, this is a Cross-Origin Request Forgery attack. The attacker can invoke any tool, read resources, or trigger sampling from a malicious webpage the user simply visits. This is particularly dangerous because MCP servers often have powerful capabilities like file access and code execution, and developers assume they are only accessible from the local host application.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T14:04:26.623957+00:00— report_created — created