Skip to content

refactor(examples): inline SDK calls in every story; isolate machinery; add shape-check#2363

Merged
felixweinberger merged 1 commit into
v2-2026-07-28from
fweinberger/examples-inline
Jun 24, 2026
Merged

refactor(examples): inline SDK calls in every story; isolate machinery; add shape-check#2363
felixweinberger merged 1 commit into
v2-2026-07-28from
fweinberger/examples-inline

Conversation

@felixweinberger

@felixweinberger felixweinberger commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Inline serveStdio/createMcpHandler/toNodeHandler/Client/transport construction explicitly in every example story; isolate runner machinery from the example code.

Motivation and Context

Examples are compiled documentation — when the SDK API changes, 25 compile errors flag 25 doc pages. Hiding the transport setup behind runServerFromArgs/connectFromArgs defeats that. Users browsing examples/ should see exactly what they'd write.

How Has This Been Tested?

run:examples 65/65 legs, typecheck, lint (incl. new no-restricted-imports public-only rule), docs:check.

Breaking Changes

None.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added or updated documentation as needed

Additional context

  • parseExampleArgs/check/runClient/siblingPath@mcp-examples/shared (workspace package, clearly scaffolding).
  • Runner → scripts/examples/run-examples.ts.
  • examples/eslint.config.mjs: bans @modelcontextprotocol/core, */src/*, */dist/*, and the deleted harness — examples can only reach the published surface.
  • Stories that don't fit the canonical stdio-or-http shape (Hono adapter, sessionful-2025 demos, interactive REPL, gateway prior-connect, auth scaffolding, etc.) explain why in their file-header doc comment.
  • examples/harness.ts deleted; examples/CONTRIBUTING.md gains a "Canonical shape" section.

@felixweinberger felixweinberger requested a review from a team as a code owner June 24, 2026 16:25
@changeset-bot

changeset-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 1e73950

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Comment thread examples/CONTRIBUTING.md
Comment thread examples/dual-era/package.json
Comment thread examples/elicitation/server.ts
@felixweinberger felixweinberger force-pushed the fweinberger/examples-inline branch from 1365f18 to 87c8651 Compare June 24, 2026 16:41
Comment thread pnpm-lock.yaml Outdated
Comment thread examples/standalone-get/server.ts Outdated
Comment thread examples/sse-polling/client.ts Outdated
@felixweinberger felixweinberger force-pushed the fweinberger/examples-inline branch from 87c8651 to 1044192 Compare June 24, 2026 16:57
@pkg-pr-new

pkg-pr-new Bot commented Jun 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/client@2363

@modelcontextprotocol/codemod

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/codemod@2363

@modelcontextprotocol/server

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/server@2363

@modelcontextprotocol/server-legacy

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/server-legacy@2363

@modelcontextprotocol/express

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/express@2363

@modelcontextprotocol/fastify

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/fastify@2363

@modelcontextprotocol/hono

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/hono@2363

@modelcontextprotocol/node

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/node@2363

commit: 1e73950

Comment thread examples/elicitation/package.json
Comment thread examples/custom-version/client.ts Outdated
Comment thread examples/json-response/client.ts Outdated
@felixweinberger felixweinberger force-pushed the fweinberger/examples-inline branch from 1044192 to ae3a873 Compare June 24, 2026 18:30
Comment thread examples/stickynotes/client.ts Outdated
@felixweinberger felixweinberger force-pushed the fweinberger/examples-inline branch 2 times, most recently from 37ca17e to 4ab6856 Compare June 24, 2026 22:14
Comment thread examples/hono/server.ts Outdated
Comment thread examples/README.md
@felixweinberger felixweinberger force-pushed the fweinberger/examples-inline branch 2 times, most recently from d250721 to bef0edf Compare June 24, 2026 22:48
Comment thread examples/shared/src/index.ts Outdated
Comment thread examples/shared/src/index.ts
@felixweinberger felixweinberger force-pushed the fweinberger/examples-inline branch from bef0edf to c2508e9 Compare June 24, 2026 23:04
…y to @mcp-examples/shared + scripts/examples/
@felixweinberger felixweinberger force-pushed the fweinberger/examples-inline branch from c2508e9 to 1e73950 Compare June 24, 2026 23:11
@felixweinberger felixweinberger merged commit 1b6a0b8 into v2-2026-07-28 Jun 24, 2026
15 checks passed
@felixweinberger felixweinberger deleted the fweinberger/examples-inline branch June 24, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant