Skip to content

Support MCP protocol version 2026-07-28 (v4) #7024

Closed

Description

@lloydrichards

Summary

Add first-class server support for MCP protocol version 2026-07-28 through a new McpProtocol.v2026_07_28 adapter.

Unlike v2025-11-25, this is a new protocol era rather than an incremental schema revision. It replaces the initialization/session lifecycle with stateless, per-request negotiation and changes how discovery, reverse interaction, notifications, and Streamable HTTP routing work.

The existing adapters must retain their current session-based behavior.

Protocol changes

Stateless requests

2026-07-28 removes:

  • initialize and notifications/initialized
  • protocol-managed sessions
  • Mcp-Session-Id

Each request instead carries its protocol version, client capabilities, and optional client identity in _meta. The selected adapter must therefore be resolved from the raw request before its dated payload is decoded.

Streamable HTTP also mirrors routing information through headers such as MCP-Protocol-Version, Mcp-Method, and Mcp-Name. Header/body mismatches return HTTP 400 with MCP error -32020.

Discovery and results

Servers must implement server/discover, advertising:

  • supported protocol versions
  • server capabilities
  • optional instructions
  • cache metadata

Every successful modern result includes a resultType. Completed results use "complete"; operations requiring client input return "input_required" with keyed input requests and optional opaque requestState.

Server identity is carried in result _meta.

Multi-round-trip requests

General server-to-client JSON-RPC requests are removed. Elicitation, sampling, and roots interaction now use an InputRequiredResult. The client fulfils those requests and retries the original operation with inputResponses and the byte-exact requestState.

This requires a canonical result boundary that can represent either:

  • a completed tool, resource, or prompt result; or
  • an input-required result.

The dated adapter owns the corresponding wire projection. Direct McpReverseClient operations must report that they are unsupported for modern requests.

Subscriptions

Unsolicited list-change and resource-update notifications are replaced by subscriptions/listen.

Modern notifications must only be sent through an active subscription and must include the corresponding subscription identifier. Legacy adapters retain their existing session-oriented notification behavior.

Schema differences

The new dated schema must cover:

  • required request metadata and result discrimination
  • server/discover
  • multi-round-trip request and result types
  • subscriptions/listen
  • cache metadata
  • modern errors -32020, -32021, and -32022
  • full JSON Schema 2020-12 tool schemas
  • unrestricted tool output schemas and structured content
  • -32602 for missing resources

Required architecture changes

The existing ProtocolAdapter boundary already owns dated RPC groups, codecs, projections, error mapping, and cancellation normalization. The surrounding runtime still assumes every client has completed initialization and owns a session.

Introduce an adapter-owned lifecycle strategy supporting:

  • legacy initialize-and-pin selection;
  • modern per-request selection;
  • request metadata and HTTP header validation;
  • session requirements;
  • request-scoped client context;
  • result-envelope projection;
  • transport-specific cancellation; and
  • subscription delivery.

Modern requests must not synthesize an initialization payload or consult the legacy session maps.

flowchart TD
  A["Incoming request"] --> B["Inspect raw envelope"]
  B --> C{"Protocol era"}

  C -->|"initialize"| D["Select legacy adapter"]
  D --> E["Decode initialize"]
  E --> F["Create and pin session"]
  F --> G["Decode later requests with pinned adapter"]

  C -->|"version in request _meta"| H["Select 2026-07-28 adapter"]
  H --> I["Validate body and HTTP headers"]
  I --> J["Create request-scoped profile"]

  G --> K["Invoke McpCore"]
  J --> K

  K --> L{"Canonical result"}
  L -->|"Complete"| M["Encode resultType: complete"]
  L -->|"Needs input"| N["Encode resultType: input_required"]
  N --> O["Client retries with responses and requestState"]
  O --> A
Loading

McpCore should continue owning version-neutral registrations and semantic operations. It should not own dated metadata keys, HTTP headers, resultType, or protocol error numbers.

Acceptance criteria

Protocol adapter

  • Add mcpSchema/v2026_07_28.ts and mcpProtocol/v2026_07_28.ts.
  • Export McpProtocol.v2026_07_28.
  • Update ProtocolAdapter, ProtocolVersion, typetests, and Changesets.
  • Implement the final v2026-07-28 RPC vocabulary and wire schemas.

Routing and lifecycle

  • Select modern requests from raw per-request metadata before payload decoding.
  • Preserve initialize-and-session selection for legacy adapters.
  • Serve modern requests without initialization or Mcp-Session-Id.
  • Derive capabilities and optional client identity independently for each modern request.
  • Support legacy and modern clients on the same configured endpoint.
  • Return -32022 with requested and supported versions for unsupported revisions.

Discovery and wire behavior

  • Implement server/discover.
  • Add required request metadata and successful-result discrimination.
  • Stamp modern results with server identity metadata.
  • Validate modern HTTP routing headers and return HTTP 400 with -32020 on mismatch.
  • Do not create or require modern protocol sessions.
  • Preserve existing legacy HTTP behavior.

Multi-round-trip requests

  • Add a canonical input-required outcome.
  • Support elicitation, sampling, and roots input requests.
  • Re-enter operations with keyed inputResponses.
  • Round-trip opaque requestState byte-for-byte.
  • Reject direct reverse-client operations for modern requests.

Subscriptions

  • Implement subscriptions/listen.
  • Deliver modern change notifications only through active subscriptions.
  • Include subscription identifiers on delivered notifications.
  • Preserve legacy notification and resource-subscription behavior.

Schema and conformance

  • Support the final JSON Schema 2020-12 tool schema rules.
  • Preserve arbitrary JSON structured content.
  • Map missing resources to -32602.
  • Add a v2026_07_28.test.ts conformance entrypoint.
  • Cover discovery, stateless routing, headers, result discrimination, MRTR, subscriptions, and modern errors.
  • Add mixed-era tests with v2025_11_25 and v2026_07_28.
  • Verify malformed modern requests cannot fall through to a legacy adapter.

Out of scope

  • Tasks extension runtime and persistence
  • MCP Apps
  • client-side MRTR fulfilment
  • distributed subscription infrastructure
  • removal of legacy sessions
  • removal of deprecated roots, sampling, or logging APIs

Tasks and MCP Apps should remain separately composable extensions.

Related work

Activity

  1. added
    enhancement
    on Aug 5, 2026
  2. changed the title [-]Support MCP protocol version 2026-06-28 (v4)[/-] [+]Support MCP protocol version 2026-07-28 (v4)[/+] on Aug 5, 2026
  3. lloydrichards commented on Aug 5, 2026

    @lloydrichards
    ContributorAuthor

    Some thoughts on the transport runtime:

    interface RuntimeDescriptor {
      readonly _tag: "Sessionful" | "Stateless"
      readonly transport: TransportPolicy
    
      readonly make: (
        context: RuntimeContext
      ) => Effect.Effect<RuntimeInstance>
    }
    
    const legacyProtocol = McpProtocol.make({
      protocolVersion: "2025-06-18",
      runtime: McpProtocol.sessionful({
        jsonRpc: {
          acceptsBatches: false
        },
        http: {
          requiresVersionHeader: true
        }
      }),
      // dated RPC groups and projections
    })
    
    const modernProtocol = McpProtocol.make({
      protocolVersion: "2026-07-28",
      runtime: McpProtocol.stateless({
        jsonRpc: {
          acceptsBatches: false
        },
        http: {
          validateRoutingHeaders: true
        }
      }),
      // dated RPC groups and projections
    })

    In this way there is clear seperation between each part, while the adaptor still owns it all.

    flowchart TB
    
    A(HTTP / stdio binding)
    B(Runtime Router)
    C([Sessionful runtime instance])
    D(Selected dated adapter)
    E[McpCore]
    F(Selected dated adapter)
    G([Stateless runtime instance])
    
    B --> G
    A --> B --> C --> D --> E --> F --> G
    G --> F --> E --> D --> C
    C --> A
    G --> A
    
    Loading

    The physical binding carries bytes; the runtime owns lifecycle; the adapter owns the dated wire contract; McpCore owns semantics.

  4. IMax153 commented on Aug 9, 2026

    @IMax153
    Member

    I think this strategy seems reasonable, as long as the protocol era for the newer protocols supports additional protocols being added over time. It seems extendable, I'm just making the point.

    I also like the runtime abstraction, but I recommend stateful / stateless for naming.

  5. lloydrichards commented on Aug 14, 2026

    @lloydrichards
    ContributorAuthor

    Have been hacking away at this today and starting to make some shape of the RuntimeDescriptor. There are a few hiccups with things like the McpServerClient that needed to be lifted a bit into a new runtime-neutral context, but I've tried not to expose too much internals.

    Working now on the MRTR and subscription features, but since these both touch the McpSchema (+ RpcMessage) i'm gonna slow down a bit and give it some thought over the weekend.

    which is to say that i'll hopefully have a working version of this soon and would love some help in reviewing my decisions when the PR is ready 🙏

  6. lloydrichards commented on Aug 14, 2026

    @lloydrichards
    ContributorAuthor

    I think I found a bit of a gap with Rpc and its stream: true. Effect RPC produces something like:

    { "id": 42, "chunk": true, "result": [] }

    But MCP needs a real notifications:

    {
      "method": "notifications/tools/list_changed",
      "params": {
        "_meta": {
          "io.modelcontextprotocol/subscriptionId": 42
        }
      }
    }

    I want to check before I try implement this in Rpc but I think i need a typed server notification message and a way for an RPC server transport to send that notification using opt-in HTTP streaming mode. I'm not seeing anything about this in other issues (but similar mentioned issue in #6274).

    I can probably hack something together that'll work for Mcp, but I'm not sure I want to widen to scope to making sure the Rpc is spec compliant with the streamable transport.

  7. lloydrichards commented on Aug 15, 2026

    @lloydrichards
    ContributorAuthor

    I also like the runtime abstraction, but I recommend stateful / stateless for naming.

    In the end the runtime abstraction wasn't too tricky to pull off, needed to shift a bit around, but seems to work across both the new stateless and ol' sesssion lifecycles. The part that was more tricky in the end was the MRTR and subscription modeling as this required touching the McpSchema.Tool and RpcServer. Have done my best to break everything out into an easy-to-follow commit history, but the PR still ended up being net +4k loc 😬

    Right now it feel like all of this is needed in order to achieve the complete 2026-07-28 protocol but it would be very useful to get a second pair of eyes on this incase we want to break this up a bit or try a different angle.

  8. guillempuche commented on Aug 16, 2026

    @guillempuche

    Thanks Lloyd for pushing the MCP area in Effect!

  9. lloydrichards commented on Aug 17, 2026

    @lloydrichards
    ContributorAuthor

    @IMax153 I've gone and built out a whole conformance testing platform with the latest rc and the @modelcontextprotocol tools.

    https://github.com/lloydrichards/proj_effect-mcp-conformance

    I'm gonna use this to flesh out some gaps/issues that are still in each of the protocols that have a little more to do with Rpc then Mcp. This should also help in the future (or ad the conformance cli tool advances) to deterministicly test everything for regressions:

     bun run conformance:all
    $ bun run --cwd=apps/conformance start -- all
    $ bun run src/index.ts all
    ╭─────────────────────────────────────────────────────────────────────────────────────────╮
    │  MCP conformance                                                                        │
    │  scenario                      │ v2024-11-05 │ v2025-03-26 │ v2025-06-18 │ v2025-11-25  │
    │  ─────────────────────────────────────────────────────────────────────────────────────  │
    │  server-initialize             │    PASS     │    PASS     │    PASS     │    PASS      │
    │  logging-set-level             │    PASS     │    PASS     │    PASS     │    PASS      │
    │  ping                          │    PASS     │    PASS     │    PASS     │    PASS      │
    │  completion-complete           │    PASS     │    PASS     │    PASS     │    PASS      │
    │  tools-list                    │    PASS     │    PASS     │    PASS     │    PASS      │
    │  tools-call-simple-text        │    PASS     │    PASS     │    PASS     │    PASS      │
    │  tools-call-image              │    PASS     │    PASS     │    PASS     │    PASS      │
    │  tools-call-audio              │    SKIP     │    PASS     │    PASS     │    PASS      │
    │  tools-call-embedded-resource  │    PASS     │    PASS     │    PASS     │    PASS      │
    │  tools-call-mixed-content      │    PASS     │    PASS     │    PASS     │    PASS      │
    │  tools-call-with-logging       │    FAIL     │    FAIL     │    FAIL     │    FAIL      │
    │  tools-call-error              │    PASS     │    PASS     │    PASS     │    PASS      │
    │  tools-call-with-progress      │    FAIL     │    FAIL     │    FAIL     │    FAIL      │
    │  tools-call-sampling           │   TIMEOUT   │   TIMEOUT   │   TIMEOUT   │   TIMEOUT    │
    │  tools-call-elicitation        │    SKIP     │    SKIP     │   TIMEOUT   │    FAIL      │
    │  resources-list                │    PASS     │    PASS     │    PASS     │    PASS      │
    │  resources-read-text           │    PASS     │    PASS     │    PASS     │    PASS      │
    │  resources-read-binary         │    PASS     │    PASS     │    PASS     │    PASS      │
    │  resources-templates-read      │    PASS     │    PASS     │    PASS     │    PASS      │
    │  prompts-list                  │    PASS     │    PASS     │    PASS     │    PASS      │
    │  prompts-get-simple            │    PASS     │    PASS     │    PASS     │    PASS      │
    │  prompts-get-with-args         │    PASS     │    PASS     │    PASS     │    PASS      │
    │  prompts-get-embedded-resource │    PASS     │    PASS     │    PASS     │    PASS      │
    │  prompts-get-with-image        │    PASS     │    PASS     │    PASS     │    PASS      │
    │  79/96 adapter checks passing                                                           │
    ╰─────────────────────────────────────────────────────────────────────────────────────────╯

    I'll try strengthen the the MCP Conformance suite as well, but this repo is working more like e2e test suite

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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions