Skip to content

docs: serve the TypeScript quickstart server with serveStdio - #3427

Open
claude[bot] wants to merge 2 commits into
mainfrom
claude/fix-3422-ts-quickstart-serve-stdio
Open

claude[bot] wants to merge 2 commits into
mainfrom
claude/fix-3422-ts-quickstart-serve-stdio

Conversation

@claude

@claude claude Bot commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

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-era initialize handshake, so a server built from the page fails against a 2026-07-28 client with Version negotiation failed: the server did not offer pinned protocol version 2026-07-28 via server/discover. The Inspector defaults to the legacy era, so the page's own test step looks fine.

After: The tutorial builds the server in a createServer() factory and serves it with serveStdio(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.mdx and docs/docs/draft/develop/build-server.mdx changes. The tutorial code was extracted from the page as written, built with @modelcontextprotocol/server 2.3.1, and checked with the Inspector CLI 2.9.0: before the change tools/list succeeded only in the legacy and auto eras, after it legacy, auto and modern all list get_alerts and get_forecast. check:docs:format (on the changed files), check:docs:js-comments and check:docs:links pass.

Fixes #3422

🤖 Generated with Claude Code

https://claude.ai/code/session_01XFU2zyusVTttWcakgCjXjR


Generated by Claude Code

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
@mintlify

mintlify Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
mcp-staging 🟢 Ready View Preview Oct 11, 2026, 4:50 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

@mintlify

mintlify Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
mcp 🟢 Ready View Preview Oct 11, 2026, 4:50 AM

💡 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

1 active deployment
staging - docs — d824c383 Deployed Oct 11, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The 2026-07-28 TypeScript quickstart builds a server that 2026-07-28 clients cannot connect to

1 participant