Skip to content

feat: serve protocol revision 2026-07-28 (both eras) on HTTP and stdio - #1461

Draft
gagik wants to merge 6 commits into
chore/upgrade-mcp-sdk-to-v2from
chore/protocol-revision-2026-07-28
Draft

feat: serve protocol revision 2026-07-28 (both eras) on HTTP and stdio#1461
gagik wants to merge 6 commits into
chore/upgrade-mcp-sdk-to-v2from
chore/protocol-revision-2026-07-28

Conversation

@gagik

@gagik gagik commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Support protocol revision 2026-07-28 per the SDK migration guide, stacked on the v2 SDK upgrade (#1460).

Serving 2026-07-28 (both eras)

  • HTTP: MCPHttpServer gains a modern createMcpHandler(..., { legacy: 'reject' }) leg; POSTs route via isLegacyRequest — the guide's prescribed composition for keeping the sessionful Streamable-HTTP wiring serving 2025 clients.
  • stdio: StdioRunner now serves through serveStdio with a per-connection createServer factory. CliServer splits registration from transport connect (register()), idempotent close(), and wires session/telemetry cleanup into the protocol server's onclose.

Elicitation → multi-round-trip (inputRequired)

2026-07-28 removes the server→client request channel. Confirmation/input flows are now written once in the inputRequired style and serve both eras — the SDK's legacy shim turns the same return into real server→client requests on 2025-era connections:

  • Elicitation/IElicitation become inputRequired builders + inputResponses readers.
  • Converted ToolBase confirmation gate, MongoDB confirmWriteStages (aggregate / aggregate-db), and Atlas streams build connection-field elicitation.
  • Capability-less clients proceed without prompting (prior behavior preserved).

Notable

  • New integration tests exercise the modern era end-to-end over HTTP and stdio (client negotiates modern, lists tools; confirmation flow via client auto-fulfilment).
  • Elicitation/unit/aggregate/drop-index/streams tests updated to drive client-side elicitation/create handlers or the new builder/reader API.
  • api-extractor reports regenerated; MCP_SERVER_LIBRARY.md and the v3-migration skill updated.
  • Follow-up (out of scope): mongodb-atlas-mcp-remote proxy stays legacy bridging (session-recovery is initialize-centric); modern passthrough needs SEP-2243 standard-header synthesis.

gagik added 6 commits August 25, 2026 16:00
- http-runners MCPHttpServer: add a modern createMcpHandler leg
  (legacy: 'reject') and route modern POSTs to it via isLegacyRequest,
  keeping the sessionful streamable-HTTP wiring for 2025-era clients
  (the migration guide's prescribed composition).
- core StdioRunner: serve via serveStdio with a per-connection server
  factory so stdio speaks both eras; CliServer gains an idempotent
  register() (registration without a transport) and close guards,
  wiring session/telemetry close into the protocol server's onclose.
- SessionServer type: optional register() hook.
- integration tests: modern-era HTTP and stdio smoke tests (client
  negotiates modern era, lists tools).
Protocol revision 2026-07-28 removes the server->client JSON-RPC request
channel: handlers obtain client input by returning inputRequired(...) and
the client retries the original request with the answers in inputResponses.
The SDK's legacy shim serves the same return to 2025-era clients, so
handlers are written once and work on both eras.

- core Elicitation: replaced push-style elicitInput with inputRequired
  builders (confirmationRequired, inputRequired) and inputResponses readers
  (readConfirmation, readInput).
- IElicitation: new builder/reader contract; ToolExecutionContext carries
  inputResponses.
- ToolBase: invoke() gate returns inputRequired when a confirmation-required
  tool has no answer yet and reads the answer on re-entry; requestConfirmation
  becomes a re-entrant reader; execute() may return InputRequiredResult.
- MongoDB confirmWriteStages (aggregate / aggregate-db) and Atlas streams
  build connection-field elicitation converted to the inputRequired style.
- Tests: client-side elicitation/create handlers drive both eras (client
  auto-fulfilment on modern, server-side legacy shim on 2025); mock utility,
  elicitation/toolBase/aggregate/drop-index tests updated.
- core Elicitation unit tests rewritten for the builder/reader API
- integration elicitation.test.ts drives the client-side elicitation/create
  handler (client auto-fulfilment on modern, legacy shim on 2025)
- toolBase.test.ts: confirmation gate + requestConfirmation re-entrant reader
- streams build tests: inputRequired on first entry, re-entry applies fields
- tools-atlas/mongodb/assistant test mocks: IElicitation stub now satisfies
  the new contract (supportsElicitation/readConfirmation/readInput)
- createRunnerFromConfig, generateToolDocumentation, mockTools updated
- lint/format/type fixes across touched tests
…pability

Preserve the pre-MRTR behavior where capability-less clients proceed
without prompting (the legacy shim would otherwise refuse the embedded
elicitation): ToolBase.invoke gate, MongoDB confirmWriteStages, and the
streams build connection-field elicitation now gate on
IElicitation.supportsElicitation() before returning inputRequired.

Also:
- elicitation/dropIndex tests assert with expect.objectContaining since
  the embedded elicitation params may carry a _meta progressToken
- docs (MCP_SERVER_LIBRARY, v3 migration skill) updated for StdioRunner
  createServer factory and the new Elicitation API
- regenerate api reports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant