Skip to content

Add MCP 2026-07-28 request classification, method vocabulary, and authz registration #5829

Closed

Description

@jhrozek

Part of #5755. Design: RFC THV-0081 (merged, toolhive-rfcs); implementation detail in the arch doc on the stateless-transport-proxies-design branch (PR #5808).

Foundation for serving the MCP 2026-07-28 (Modern) revision: request classification, method vocabulary, and authorization registration. No behavior change — every request still classifies as Legacy until a Modern request actually arrives; this issue does not wire the classifier into proxy routing (that is the streamable/transparent proxy issues).

Changes

  • Deepen the classifier (pkg/mcp/revision.go, ClassifyRevision): unsupported version → -32022; require clientInfo/clientCapabilities (missing → -32021); a Modern MCP-Protocol-Version header with absent/malformed _meta is an error, not a Legacy downgrade; header/body mismatch → -32020 (neither value wins — drop any "body authoritative" behavior).
  • Parser (pkg/mcp/parser.go): register server/discover; recognize Mcp-Method / Mcp-Name (decode the Mcp-Name Base64 sentinel before comparing to the body); surface clientInfo/protocolVersion from _meta on the parsed request.
  • Authz (pkg/authz/middleware.go): add MCPMethodToFeatureOperation entries — server/discover allowed, subscriptions/listen recognized so it is not default-denied (its delivery is deferred). Parser labeling alone leaves these methods 403'd.
  • Telemetry (pkg/telemetry/middleware.go): set mcp.client.name on all spans from _meta.clientInfo, not only on the initialize span.

Dependencies

None. Gates the streamable and transparent proxy issues.

Verification

  • ClassifyRevision truth-table units: Modern _meta, absent/malformed _meta, initialize, header/body mismatch → -32020, unsupported version → -32022, Modern-header-with-broken-_meta → error (not Legacy).
  • Existing tests stay green (no behavior change on the proxy paths).

Activity

  1. added
    needs-triage
    on Jul 16, 2026
  2. self-assigned this
    on Jul 16, 2026
  3. removed
    needs-triage
    on Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions