feat: serve protocol revision 2026-07-28 (both eras) on HTTP and stdio - #1461
Draft
gagik wants to merge 6 commits into
Draft
feat: serve protocol revision 2026-07-28 (both eras) on HTTP and stdio#1461gagik wants to merge 6 commits into
gagik wants to merge 6 commits into
Conversation
- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Support protocol revision 2026-07-28 per the SDK migration guide, stacked on the v2 SDK upgrade (#1460).
Serving 2026-07-28 (both eras)
MCPHttpServergains a moderncreateMcpHandler(..., { legacy: 'reject' })leg; POSTs route viaisLegacyRequest— the guide's prescribed composition for keeping the sessionful Streamable-HTTP wiring serving 2025 clients.StdioRunnernow serves throughserveStdiowith a per-connectioncreateServerfactory.CliServersplits registration from transport connect (register()), idempotentclose(), and wires session/telemetry cleanup into the protocol server'sonclose.Elicitation → multi-round-trip (
inputRequired)2026-07-28 removes the server→client request channel. Confirmation/input flows are now written once in the
inputRequiredstyle and serve both eras — the SDK's legacy shim turns the same return into real server→client requests on 2025-era connections:Elicitation/IElicitationbecomeinputRequiredbuilders +inputResponsesreaders.ToolBaseconfirmation gate, MongoDBconfirmWriteStages(aggregate / aggregate-db), and Atlas streams build connection-field elicitation.Notable
modern, lists tools; confirmation flow via client auto-fulfilment).elicitation/createhandlers or the new builder/reader API.MCP_SERVER_LIBRARY.mdand the v3-migration skill updated.mongodb-atlas-mcp-remoteproxy stays legacy bridging (session-recovery is initialize-centric); modern passthrough needs SEP-2243 standard-header synthesis.