Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0bfaf3f
chore(examples): collapse examples/{server,client} into one per-story…
felixweinberger Jun 18, 2026
a44f9d4
test(examples): self-verifying example-pair runner + CI job
felixweinberger Jun 18, 2026
e786e82
refactor(examples): move existing pairs into per-story directories
felixweinberger Jun 18, 2026
f2661d0
refactor(examples): rewrite the three HTTP hosting examples onto crea…
felixweinberger Jun 18, 2026
7d91a18
feat(examples): add the six start-here / capstone stories
felixweinberger Jun 18, 2026
f9b0f95
feat(examples): paired clients for the remaining audited stories
felixweinberger Jun 18, 2026
efdbc54
docs: re-point guide snippets and example links at the per-story layout
felixweinberger Jun 18, 2026
400c934
docs(examples): restore the subscriptions/listen story stacked on the…
felixweinberger Jun 18, 2026
3126794
test(examples): run every story over the transport × era matrix it su…
felixweinberger Jun 18, 2026
bf7bdf2
chore(examples): per-story workspace packages; harness reads package.…
felixweinberger Jun 18, 2026
7378eb7
feat(examples): oauth-client-credentials story (machine-to-machine, n…
felixweinberger Jun 18, 2026
8996193
chore(changeset): drop stale examples-server changeset (package remov…
felixweinberger Jun 18, 2026
8501d6d
fix(examples): legacy-routing 404 for unknown sid; drop dead doc cros…
felixweinberger Jun 18, 2026
fa0524d
refactor(examples): trim oauth/ to the browser auth-code flow; carve …
felixweinberger Jun 18, 2026
6f24767
docs(examples): annotate runServerFromArgs / connectFromArgs at every…
felixweinberger Jun 18, 2026
46241cb
chore(examples): finish the old-layout cleanup; fix SIGKILL backstop,…
felixweinberger Jun 18, 2026
393bc07
docs(examples): consumer-facing elicitation/ story (both eras), READM…
felixweinberger Jun 18, 2026
be71bee
docs(examples): close review-1 M2-M9 + bot nits; in-repo OAuth-protec…
felixweinberger Jun 18, 2026
e9b7263
docs(examples): sessionful http/legacy harness; complete the transpor…
felixweinberger Jun 19, 2026
b09b320
docs(examples): un-exclude oauth/ via demo-AS autoConsent + headless …
felixweinberger Jun 19, 2026
3a56996
docs(examples): fix sse-polling sessionful 404/400 routing; align REA…
felixweinberger Jun 19, 2026
6e51b50
docs: update CLAUDE.md examples section to the per-story layout
felixweinberger Jun 19, 2026
65ca0b1
docs(examples): make sampling/ dual-era via inputRequired.createMessa…
felixweinberger Jun 19, 2026
d0d3316
docs(examples): restore [!TYPE] alert markers (proseWrap: preserve fo…
felixweinberger Jun 19, 2026
a59063a
fix(examples): httpUrlFromArgs helper for HTTP-only story clients (in…
felixweinberger Jun 19, 2026
e17ffb7
fix(examples/oauth): align browser-client default URL with server's a…
felixweinberger Jun 19, 2026
9ab402d
docs(examples): prose-vs-code sweep — align guide/example-README clai…
felixweinberger Jun 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": [
"@modelcontextprotocol/examples-client",
"@modelcontextprotocol/examples",
"@modelcontextprotocol/examples-client-quickstart",
"@modelcontextprotocol/examples-server",
"@modelcontextprotocol/examples-server-quickstart",
"@modelcontextprotocol/examples-shared"
"@mcp-examples/*"
]
}
5 changes: 0 additions & 5 deletions .changeset/fix-session-status-codes.md

This file was deleted.

4 changes: 1 addition & 3 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
"@modelcontextprotocol/eslint-config": "2.0.0",
"@modelcontextprotocol/tsconfig": "2.0.0",
"@modelcontextprotocol/vitest-config": "2.0.0",
"@modelcontextprotocol/examples-client": "2.0.0-alpha.0",
"@modelcontextprotocol/examples": "2.0.0-alpha.0",
"@modelcontextprotocol/examples-client-quickstart": "2.0.0-alpha.0",
"@modelcontextprotocol/examples-server": "2.0.0-alpha.0",
"@modelcontextprotocol/examples-server-quickstart": "2.0.0-alpha.0",
"@modelcontextprotocol/examples-shared": "2.0.0-alpha.0",
"@modelcontextprotocol/client": "2.0.0-alpha.0",
"@modelcontextprotocol/core": "2.0.0-alpha.0",
"@modelcontextprotocol/express": "2.0.0-alpha.0",
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Examples

on:
push:
branches:
- main
- v2-2026-07-28
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
# Builds the workspace + examples and e2e-runs every examples/<story>/ pair
# over every transport it supports. Each client.ts is a self-verifying test
# (asserts and exits non-zero on any mismatch). This is part of the per-PR
# gate basket — a red examples run blocks merge.
examples:
name: examples (build + e2e)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- name: Install pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
with:
run_install: false

- uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml

- run: pnpm install

# The workspace packages the examples import resolve to built dists
# (the gap that killed an earlier examples smoke suite).
- run: pnpm run build:all

- name: Run all example pairs (transport × era)
run: pnpm tsx scripts/run-examples.ts
3 changes: 2 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
{
"files": "**/*.md",
"options": {
"printWidth": 280
"printWidth": 280,
"proseWrap": "preserve"
}
}
]
Expand Down
14 changes: 9 additions & 5 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,15 @@ Pluggable JSON Schema validation (`packages/core/src/validators/`):

### Examples

Runnable examples in `examples/`:

- `examples/server/src/` - Various server configurations (stateful, stateless, OAuth, etc.)
- `examples/client/src/` - Client examples (basic, OAuth, parallel calls, etc.)
- `examples/shared/src/` - Shared utilities (OAuth demo provider, etc.)
Runnable examples in `examples/<story>/{server.ts,client.ts}` — each story is its own
`@mcp-examples/<story>` workspace package and a self-verifying e2e test (the client connects,
asserts results, exits non-zero on mismatch). `pnpm run:examples` runs every story over its
configured transport×era legs; the `examples (build + e2e)` CI job is part of the per-PR gate
basket. See `examples/README.md` for the full story matrix.

- `examples/harness.ts` — dual-transport scaffold (`connectFromArgs`, `runServerFromArgs`, `httpUrlFromArgs`, `runClient`)
- `examples/shared/` — `@mcp-examples/shared` package (demo OAuth provider, `InMemoryEventStore`)
- `examples/guides/` — typecheck-only snippet collections synced into `docs/{server,client}.md`

## Message Flow (Bidirectional Protocol)

Expand Down
13 changes: 8 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,19 @@ Then:

### Running Examples

See [`examples/server/README.md`](examples/server/README.md) and [`examples/client/README.md`](examples/client/README.md) for a full list of runnable examples.
See [`examples/README.md`](examples/README.md) for the full list of runnable examples — one self-verifying client/server pair per directory.

Quick start:

```bash
# Run a server example
pnpm --filter @modelcontextprotocol/examples-server exec tsx src/simpleStreamableHttp.ts
# Run any story's server
pnpm --filter @mcp-examples/tools server -- --http --port 3000

# Run a client example (in another terminal)
pnpm --filter @modelcontextprotocol/examples-client exec tsx src/simpleStreamableHttp.ts
# Run its client (in another terminal)
pnpm --filter @mcp-examples/tools client -- --http http://127.0.0.1:3000/

# Run every story over every transport × era leg
pnpm run:examples
```

## Releasing v1.x Patches
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ Ready to build something real? Follow the step-by-step quickstart tutorials:
The complete code for each tutorial is in [`examples/server-quickstart/`](https://github.com/modelcontextprotocol/typescript-sdk/tree/main/examples/server-quickstart/) and
[`examples/client-quickstart/`](https://github.com/modelcontextprotocol/typescript-sdk/tree/main/examples/client-quickstart/). For more advanced runnable examples, see:

- [`examples/server/README.md`](examples/server/README.md) — server examples index
- [`examples/client/README.md`](examples/client/README.md) — client examples index
- [`examples/README.md`](examples/README.md) — runnable, self-verifying client/server example pairs (one story per directory)
Comment thread
felixweinberger marked this conversation as resolved.

## Documentation

Expand Down
2 changes: 1 addition & 1 deletion docs/client-quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -420,5 +420,5 @@ If you see:
Now that you have a working client, here are some ways to go further:

- [**Client guide**](./client.md) — Add OAuth, middleware, sampling, and more to your client.
- [**Example clients**](https://github.com/modelcontextprotocol/typescript-sdk/tree/main/examples/client) — Browse runnable client examples.
- [**Example clients**](https://github.com/modelcontextprotocol/typescript-sdk/tree/main/examples) — Browse runnable client examples.
- [**FAQ**](./faq.md) — Troubleshoot common errors.
Loading
Loading