Skip to content

[Request]: Origin allowlist and MCP-Protocol-Version check for @jimhoyd/urlcode-mcp mounts #676

Closed

Description

@jimhoyd

Problem or use case

@jimhoyd/urlcode-mcp 0.6.0 (packages/mcp/src/mcp.ts, handle()) checks method, content type, body size and the JSON-RPC envelope, but never reads the Origin header. The MCP Streamable HTTP transport says servers MUST validate Origin on incoming connections to prevent DNS-rebinding attacks. An operator can't do this in YAML today, because the mount has no origin setting and no hook runs before dispatch.

It also doesn't validate the MCP-Protocol-Version request header. The spec says a server should answer 400 Bad Request for an unsupported version, and treat a missing header as 2025-03-26.

urlcode-ai's hand-written /mcp (functions/mcp.mjs) does both checks: MCP_ALLOWED_ORIGINS returns 403, and an unsupported version returns 400. That makes these checks a blocker for switching https://urlcode.ai/mcp to the extension: switching would drop a spec-required protection from a public endpoint.

Proposed behavior and alternatives

  • A per-server allowedOrigins: [..] in the extension config. A request whose Origin isn't listed gets 403 before any parsing. A request with no Origin header (non-browser clients) is allowed, as it is today.
  • Validate MCP-Protocol-Version against the versions the extension negotiates, with a missing header treated as 2025-03-26. Answer 400 otherwise.
  • Alternative: a general core route option for Origin allowlisting that any extension mount can use. That's more reusable, but MCP is the one surface where the spec requires it.

Activity

  1. added
    bug
    extension
    important
    on Sep 24, 2026
  2. added a commit that references this issue on Sep 24, 2026
    1ed366a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugextensionimportant

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions