Skip to content

Outbound MCP client needs protocol/version negotiation for current Streamable HTTP #260

Description

@serge-ivo

Problem

The outbound MCP connector currently behaves like a single-era MCP client:

  • hardcoded protocol version 2025-06-18
  • always sends an initialize request before the real call
  • echoes Mcp-Session-Id from initialize into the follow-up request

That worked for earlier Streamable HTTP servers, but the MCP spec has moved. Current Streamable HTTP uses per-request metadata and headers, and the 2026-07-28 revision removes protocol-level sessions and the standalone GET stream. A PAGS agent that claims it can accept any MCP URL needs version negotiation and compatibility fallback, not one hardcoded transport shape.

Why this matters

Even after OAuth works (#258 / #180), authenticated modern MCP servers may still fail because PAGS is speaking the wrong protocol era. The user experience will look like “I connected successfully, but tools are broken.”

Expected behavior

PAGS outbound MCP should detect and interoperate with supported MCP server eras:

  • modern Streamable HTTP with required request metadata
  • earlier Streamable HTTP initialize/session flow where needed
  • clear unsupported-version errors when no compatible path exists

Acceptance criteria

  • Client advertises supported protocol versions rather than one hardcoded version.
  • Modern Streamable HTTP requests include required MCP request metadata in the body and mirrored HTTP headers.
  • Compatibility fallback handles legacy initialize/session servers.
  • Server-era detection is cached per endpoint/origin with re-probe on failure.
  • Tests cover a modern server, a legacy initialize/session server, version mismatch, and unsupported server response.

Related

Code pointers

  • workers/api/src/lib/connectors/mcp.ts
  • workers/api/src/lib/connectors/mcp.test.ts

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions