Repository navigation
docs: serve the TypeScript quickstart server with serveStdio - #3427
Open
claude[bot] wants to merge 2 commits into
Open
claude[bot] wants to merge 2 commits into
claude[bot] wants to merge 2 commits into
Conversation
The 2026-07-28 "Build an MCP server" quickstart wired its TypeScript server with `server.connect(new StdioServerTransport())`, which only serves clients that open with the 2025-era `initialize` handshake. A server built from the page failed version negotiation against 2026-07-28 clients, while the Inspector's default `legacy` era hid the failure. Build the server in a `createServer()` factory and serve it with `serveStdio(createServer)` from `@modelcontextprotocol/server/stdio`, which negotiates the era per connection and keeps 2025-era clients working. Explain why the factory returns a fresh instance, note that the hand-wired form only serves 2025-era clients, and add an Inspector CLI step that lists the tools in the `modern` era. The draft copy of the page receives the same change. Fixes #3422 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XFU2zyusVTttWcakgCjXjR
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
The comment above createServer said serveStdio calls it once per connection. The SDK calls the factory for every instance it needs, which is twice when a server/discover probe is followed by an initialize fallback, as the paragraph under "Running the server" already says. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XFU2zyusVTttWcakgCjXjR
This branch was successfully deployed
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.
Requested by Den Delimarsky · Slack thread
Before: The TypeScript tab of the 2026-07-28 "Build an MCP server" quickstart wires the server with
server.connect(new StdioServerTransport()). That entry point only serves clients that open with the 2025-erainitializehandshake, so a server built from the page fails against a 2026-07-28 client withVersion negotiation failed: the server did not offer pinned protocol version 2026-07-28 via server/discover. The Inspector defaults to thelegacyera, so the page's own test step looks fine.After: The tutorial builds the server in a
createServer()factory and serves it withserveStdio(createServer)from@modelcontextprotocol/server/stdio, which negotiates the era per connection and keeps 2025-era clients working. A short paragraph explains why the factory returns a fresh instance on every call and notes that the hand-wired form only serves 2025-era clients. A new Inspector CLI step lists the tools with--protocol-era modern. The draft copy of the page receives the same change.How: Only the TypeScript tab of
docs/docs/2026-07-28/develop/build-server.mdxanddocs/docs/draft/develop/build-server.mdxchanges. The tutorial code was extracted from the page as written, built with@modelcontextprotocol/server2.3.1, and checked with the Inspector CLI 2.9.0: before the changetools/listsucceeded only in thelegacyandautoeras, after itlegacy,autoandmodernall listget_alertsandget_forecast.check:docs:format(on the changed files),check:docs:js-commentsandcheck:docs:linkspass.Fixes #3422
🤖 Generated with Claude Code
https://claude.ai/code/session_01XFU2zyusVTttWcakgCjXjR
Generated by Claude Code