Skip to content

Commit b153505

Browse files
docs: rebuild the v2 documentation around a task-based page tree (#2397)
1 parent 708d545 commit b153505

120 files changed

Lines changed: 11884 additions & 4971 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: v2 feedback
2+
description: Bugs, API friction, or docs gaps in v2 of the SDK
3+
title: '[v2] '
4+
labels: ['v2']
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for trying v2. Anything that broke, surprised you, or slowed you down is useful — API feedback is explicitly welcome while v2 is in beta.
10+
11+
Docs: https://ts.sdk.modelcontextprotocol.io/v2/ · Migration from v1: https://ts.sdk.modelcontextprotocol.io/v2/migration/
12+
- type: textarea
13+
id: what
14+
attributes:
15+
label: What happened?
16+
description: What did you do, and what went wrong (or felt wrong)? Paste error output verbatim if there is any.
17+
validations:
18+
required: true
19+
- type: textarea
20+
id: expected
21+
attributes:
22+
label: What did you expect?
23+
validations:
24+
required: false
25+
- type: textarea
26+
id: repro
27+
attributes:
28+
label: Code to reproduce
29+
description: The smallest snippet or repository that shows it. For docs feedback, link the page instead.
30+
render: TypeScript
31+
validations:
32+
required: false
33+
- type: input
34+
id: version
35+
attributes:
36+
label: SDK version
37+
description: The published version (`npm ls @modelcontextprotocol/server @modelcontextprotocol/client`) or commit.
38+
validations:
39+
required: false
40+
- type: dropdown
41+
id: area
42+
attributes:
43+
label: Area
44+
options:
45+
- Server
46+
- Client
47+
- Transports
48+
- Auth
49+
- Documentation
50+
- Migration / codemod
51+
- Other
52+
validations:
53+
required: false

.github/workflows/examples.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,9 @@ jobs:
4545

4646
- name: Run all example pairs (transport × era)
4747
run: pnpm tsx scripts/examples/run-examples.ts
48+
49+
# Every docs-page companion under examples/guides/ is a real program
50+
# (the page's quoted output comes from it). Run each one; a file whose
51+
# first line is "// docs: typecheck-only" is skipped.
52+
- name: Run guide examples
53+
run: pnpm docs:examples

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ dist/
5151
.worktrees/
5252

5353
# Generated docs-site artifacts
54-
docs/index.md
5554
docs/api/
5655
docs/.vitepress/cache/
5756
docs/.vitepress/dist/

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ basket. See `examples/README.md` for the full story matrix.
131131

132132
- `examples/shared/``@mcp-examples/shared` package. Root export is args-only (`parseExampleArgs`, `check`, `siblingPath`); the demo OAuth provider and `InMemoryEventStore` live at the `@mcp-examples/shared/auth` subpath so non-auth stories don't eagerly evaluate better-auth/express/better-sqlite3. Stories import only this plumbing and inline the SDK transport setup themselves — see `examples/CONTRIBUTING.md`.
133133
- `scripts/examples/` — runner (`run-examples.ts`)
134-
- `examples/guides/`typecheck-only snippet collections synced into `docs/{server,client}.md`
134+
- `examples/guides/`per-page snippet companions for the `docs/` guide pages (one `<section>/<page>.examples.ts` per page); fences sync via `pnpm sync:snippets`, and the runnable ones are executed in CI by `pnpm docs:examples`
135135

136136
## Message Flow (Bidirectional Protocol)
137137

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22

33
<!-- prettier-ignore -->
44
> [!IMPORTANT]
5-
> **This is the `main` branch which contains v2 of the SDK (currently in development, pre-alpha).**
5+
> **This is the `main` branch v2 of the SDK, now in beta** (`@modelcontextprotocol/server`, `@modelcontextprotocol/client`), implementing the [2026-07-28 MCP spec](https://blog.modelcontextprotocol.io/posts/2026-07-28-release-candidate/).
66
>
7-
> We anticipate a stable v2 release in Q3 2026 along with the [updated MCP spec](https://blog.modelcontextprotocol.io/posts/2026-07-28-release-candidate/). Until then, **v1.x remains the recommended version** for production use. v1.x will continue to receive bug fixes and security updates for at least 6 months after v2 ships to give people time to upgrade.
7+
> **Have feedback? Please [open a v2 issue](https://github.com/modelcontextprotocol/typescript-sdk/issues/new?template=v2-feedback.yml)** — it is the most useful thing you can do for the SDK right now. The [v2 documentation](https://ts.sdk.modelcontextprotocol.io/v2/) starts with a ten-minute server tutorial.
88
>
9-
> For v1 documentation, see the [V1 API docs](https://ts.sdk.modelcontextprotocol.io/). For v2 API docs, see [`/v2/`](https://ts.sdk.modelcontextprotocol.io/v2/).
9+
> We expect a stable release alongside the full release of the 2026-07-28 spec on July 28, 2026. Until then, **v1.x remains the supported release for production**; it keeps receiving bug fixes and security updates for at least 6 months after v2 ships. v1 documentation: [ts.sdk.modelcontextprotocol.io](https://ts.sdk.modelcontextprotocol.io/) · v2: [`/v2/`](https://ts.sdk.modelcontextprotocol.io/v2/).
1010
1111
<!-- prettier-ignore -->
1212
> [!WARNING]
13-
> **We're temporarily restricting PRs to contributors only to manage reviewer capacity while implementation work for the [new spec](https://blog.modelcontextprotocol.io/posts/2026-07-28-release-candidate/) is ongoing**
13+
> **We're limiting pull requests to contributors while we land the [2026-07-28 spec](https://blog.modelcontextprotocol.io/posts/2026-07-28-release-candidate/) implementation.**
1414
>
15-
> Please continue to submit issues as your main source of feedback. We anticipate reopening once we have a stable release for the new spec, currently slated to launch on July 28, 2026.
15+
> [Issues](https://github.com/modelcontextprotocol/typescript-sdk/issues/new?template=v2-feedback.yml) are the most useful feedback right now — we'll reopen PRs as v2 stabilizes.
1616
1717
[![NPM Version - Server](https://img.shields.io/npm/v/%40modelcontextprotocol%2Fserver?label=%40modelcontextprotocol%2Fserver)](https://www.npmjs.com/package/@modelcontextprotocol/server)
1818
[![NPM Version - Client](https://img.shields.io/npm/v/%40modelcontextprotocol%2Fclient?label=%40modelcontextprotocol%2Fclient)](https://www.npmjs.com/package/@modelcontextprotocol/client) ![MIT licensed](https://img.shields.io/npm/l/%40modelcontextprotocol%2Fserver)
@@ -129,22 +129,22 @@ async function main() {
129129
main();
130130
```
131131

132-
Ready to build something real? Follow the step-by-step quickstart tutorials:
132+
Ready to build something real? Follow the step-by-step tutorials:
133133

134-
- [Build a weather server](docs/server-quickstart.md) — server quickstart
135-
- [Build an LLM-powered chatbot](docs/client-quickstart.md)client quickstart
134+
- [Build your first server](docs/get-started/first-server.md)a stdio weather-alert server, from `npm init` to a tool call
135+
- [Build your first client](docs/get-started/first-client.md)connect to that server, list its tools, and call them
136136

137-
The complete code for each tutorial is in [`examples/server-quickstart/`](https://github.com/modelcontextprotocol/typescript-sdk/tree/main/examples/server-quickstart/) and
138-
[`examples/client-quickstart/`](https://github.com/modelcontextprotocol/typescript-sdk/tree/main/examples/client-quickstart/). For more advanced runnable examples, see:
137+
For runnable, end-to-end examples beyond the tutorials, see:
139138

140139
- [`examples/README.md`](examples/README.md) — runnable, self-verifying client/server example pairs (one story per directory)
141140

142141
## Documentation
143142

144-
- [Server Guide](docs/server.md) — building MCP servers: transports, tools, resources, prompts, server-initiated requests, and deployment
145-
- [Client Guide](docs/client.md) — building MCP clients: connecting, tools, resources, prompts, server-initiated requests, and error handling
146-
- [FAQ](docs/faq.md) — frequently asked questions and troubleshooting
147-
- [API docs](https://modelcontextprotocol.github.io/typescript-sdk/)
143+
- [Build a server](docs/get-started/first-server.md) — your first MCP server, step by step
144+
- [Build a client](docs/get-started/first-client.md) — your first MCP client, step by step
145+
- [Documentation site](https://ts.sdk.modelcontextprotocol.io/v2/) — the full guides: tools, resources, prompts, serving over HTTP and stdio, clients, OAuth, and migration
146+
- [Troubleshooting](docs/troubleshooting.md) — common errors and their fixes
147+
- [API reference](https://ts.sdk.modelcontextprotocol.io/v2/api/)
148148
- [MCP documentation](https://modelcontextprotocol.io/docs)
149149
- [MCP specification](https://modelcontextprotocol.io/specification/latest)
150150

docs/.vitepress/config.mts

Lines changed: 64 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default defineConfig({
2424
title: 'MCP TypeScript SDK',
2525
description: 'The TypeScript SDK implementation of the Model Context Protocol specification.',
2626
base: '/v2/',
27-
srcExclude: ['v1/**', 'behavior-surface-pins.md'],
27+
srcExclude: ['v1/**', '_meta/**', 'behavior-surface-pins.md'],
2828
sitemap: { hostname: 'https://ts.sdk.modelcontextprotocol.io/v2/' },
2929
markdown: {
3030
config(md) {
@@ -44,26 +44,82 @@ export default defineConfig({
4444
},
4545
themeConfig: {
4646
nav: [
47-
{ text: 'Guide', link: '/server-quickstart', activeMatch: '^/(server|client|faq)' },
47+
{ text: 'Get started', link: '/get-started/first-server', activeMatch: '^/get-started/' },
48+
{ text: 'Servers', link: '/servers/tools', activeMatch: '^/(servers|serving)/' },
49+
{ text: 'Clients', link: '/clients/connect', activeMatch: '^/clients/' },
4850
{ text: 'Migration', link: '/migration/', activeMatch: '^/migration/' },
4951
{ text: 'API Reference', link: '/api/', activeMatch: '^/api/' },
5052
{ text: 'V1 Docs', link: 'https://ts.sdk.modelcontextprotocol.io/' }
5153
],
5254
sidebar: [
5355
{
54-
text: 'Getting started',
56+
text: 'Get started',
5557
items: [
56-
{ text: 'Server Quickstart', link: '/server-quickstart' },
57-
{ text: 'Client Quickstart', link: '/client-quickstart' }
58+
{ text: 'Build a server', link: '/get-started/first-server' },
59+
{ text: 'Plug into a real host', link: '/get-started/real-host' },
60+
{ text: 'Build a client', link: '/get-started/first-client' },
61+
{ text: 'Packages', link: '/get-started/packages' },
62+
{ text: 'Examples', link: '/get-started/examples' }
5863
]
5964
},
6065
{
61-
text: 'Guides',
66+
text: 'Servers',
6267
items: [
63-
{ text: 'Server', link: '/server' },
64-
{ text: 'Client', link: '/client' }
68+
{ text: 'Tools', link: '/servers/tools' },
69+
{ text: 'Resources', link: '/servers/resources' },
70+
{ text: 'Prompts', link: '/servers/prompts' },
71+
{ text: 'Completion', link: '/servers/completion' },
72+
{ text: 'Logging, progress, cancellation', link: '/servers/logging-progress-cancellation' },
73+
{ text: 'Elicitation', link: '/servers/elicitation' },
74+
{ text: 'Sampling (sunset)', link: '/servers/sampling' },
75+
{ text: 'Input required', link: '/servers/input-required' },
76+
{ text: 'Notifications', link: '/servers/notifications' },
77+
{ text: 'Errors', link: '/servers/errors' }
6578
]
6679
},
80+
{
81+
text: 'Serving',
82+
items: [
83+
{ text: 'stdio', link: '/serving/stdio' },
84+
{ text: 'HTTP', link: '/serving/http' },
85+
{ text: 'Express', link: '/serving/express' },
86+
{ text: 'Hono', link: '/serving/hono' },
87+
{ text: 'Fastify', link: '/serving/fastify' },
88+
{ text: 'Web-standard runtimes', link: '/serving/web-standard' },
89+
{ text: 'Sessions, state, scaling', link: '/serving/sessions-state-scaling' },
90+
{ text: 'Authorization', link: '/serving/authorization' },
91+
{ text: 'Legacy clients', link: '/serving/legacy-clients' }
92+
]
93+
},
94+
{
95+
text: 'Clients',
96+
items: [
97+
{ text: 'Connect', link: '/clients/connect' },
98+
{ text: 'Calling', link: '/clients/calling' },
99+
{ text: 'Handle server requests', link: '/clients/server-requests' },
100+
{ text: 'Roots (sunset)', link: '/clients/roots' },
101+
{ text: 'Subscriptions', link: '/clients/subscriptions' },
102+
{ text: 'OAuth', link: '/clients/oauth' },
103+
{ text: 'Machine auth', link: '/clients/machine-auth' },
104+
{ text: 'Middleware', link: '/clients/middleware' },
105+
{ text: 'Caching', link: '/clients/caching' }
106+
]
107+
},
108+
{ text: 'Protocol versions', link: '/protocol-versions' },
109+
{
110+
text: 'Advanced',
111+
collapsed: true,
112+
items: [
113+
{ text: 'Low-level server', link: '/advanced/low-level-server' },
114+
{ text: 'Custom methods', link: '/advanced/custom-methods' },
115+
{ text: 'Schema libraries', link: '/advanced/schema-libraries' },
116+
{ text: 'Custom transports', link: '/advanced/custom-transports' },
117+
{ text: 'Wire schemas', link: '/advanced/wire-schemas' },
118+
{ text: 'Gateway', link: '/advanced/gateway' }
119+
]
120+
},
121+
{ text: 'Testing', link: '/testing' },
122+
{ text: 'Troubleshooting', link: '/troubleshooting' },
67123
{
68124
text: 'Migration',
69125
items: [
@@ -72,10 +128,6 @@ export default defineConfig({
72128
{ text: '2026-07-28 protocol support', link: '/migration/support-2026-07-28' }
73129
]
74130
},
75-
{
76-
text: 'FAQ',
77-
items: [{ text: 'FAQ', link: '/faq' }]
78-
},
79131
{
80132
text: 'API Reference',
81133
collapsed: true,

docs/.vitepress/theme/custom.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,24 @@
66
* light, white on slate dark. We map that onto VitePress brand variables.
77
*/
88

9+
/* ------------------------------------------------------------------ layout */
10+
11+
/*
12+
* The default theme caps the doc column at 688px (and the page at 1440px),
13+
* which forces horizontal scrolling on most of our ~100-column code blocks.
14+
* Let the layout breathe and the column grow so typical snippets fit;
15+
* genuinely long lines still scroll inside their own block.
16+
*/
17+
:root {
18+
--vp-layout-max-width: 1680px;
19+
}
20+
21+
/* !important: the default rule is a scoped component style ([data-v-…]), which
22+
otherwise out-specifies any override written here. */
23+
.VPDoc.has-aside .content-container {
24+
max-width: 960px !important;
25+
}
26+
927
/* ---------------------------------------------------------------- branding */
1028

1129
:root {

0 commit comments

Comments
 (0)