Skip to content

Conversation

@jonathanhefner
Copy link
Member

ℹ️ This is based on top of #1487


New doc sections: Connecting to a server (3 transports), Authentication (client credentials, private key JWT, full OAuth), Using server features (tools, resources, prompts, completions), Notifications (listChanged first, manual handlers second), Handling server-initiated requests (capabilities, sampling, elicitation), Advanced patterns (middleware, resumption tokens), and a More client features reference table.

New companion file examples/client/src/clientGuide.examples.ts provides the snippet source with 16 regions covering: connect_streamableHttp, connect_stdio, connect_sseFallback, auth_clientCredentials, auth_privateKeyJwt, callTool_basic, readResource_basic, getPrompt_basic, complete_basic, listChanged_basic, notificationHandler_basic, capabilities_declaration, sampling_handler, elicitation_handler, middleware_basic, and resumptionToken_basic.


I still want to improve this document more in the future, but I think this is in a mergeable state.

jonathanhefner and others added 3 commits February 11, 2026 17:23
JSDoc `@example` code blocks were previously inlined and not
type-checked, meaning they could silently drift from the actual API.
This adds a `scripts/sync-snippets.ts` script (`pnpm sync:snippets`)
that extracts code from co-located `.examples.ts` files — using
`//#region` markers — and syncs them into JSDoc `@example` fences and
markdown files.

The script supports a `--check` mode (wired into `lint:all`) to catch
drift in CI. Code fences use a `source="./file.examples.ts#regionName"`
attribute to reference their source of truth.

Includes `.examples.ts` companion files for:

- `packages/core`: `SdkError`, validation providers
  (`AjvJsonSchemaValidator`, `CfWorkerJsonSchemaValidator`,
  `jsonSchemaValidator`), and module-level validator examples
- `packages/client`: `Client` options, `fetchToken`, auth extensions
  (`createPrivateKeyJwtAuth`, `ClientCredentialsProvider`,
  `PrivateKeyJwtProvider`), client middleware (`applyMiddlewares`,
  `createMiddleware`), and experimental task streaming
- `packages/server`: `hostHeaderValidation` response helper
- `packages/middleware/express`: `createMcpExpressApp` and host header
  validation middleware

Also removes the duplicate `@example` from `Protocol.requestStream()`
(now covered by `ExperimentalClientTasks.requestStream()`), adds ESLint
overrides for `.examples.ts` files (`no-unused-vars`, `no-console`), and
updates `CLAUDE.md` with snippet conventions.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
New doc sections: Connecting to a server (3 transports), Authentication
(client credentials, private key JWT, full OAuth), Using server features
(tools, resources, prompts, completions), Notifications (`listChanged`
first, manual handlers second), Handling server-initiated requests
(capabilities, sampling, elicitation), Advanced patterns (middleware,
resumption tokens), and a More client features reference table.

New companion file `examples/client/src/clientGuide.examples.ts`
provides the snippet source with 16 regions covering:
`connect_streamableHttp`, `connect_stdio`, `connect_sseFallback`,
`auth_clientCredentials`, `auth_privateKeyJwt`, `callTool_basic`,
`readResource_basic`, `getPrompt_basic`, `complete_basic`,
`listChanged_basic`, `notificationHandler_basic`,
`capabilities_declaration`, `sampling_handler`, `elicitation_handler`,
`middleware_basic`, and `resumptionToken_basic`.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Add a top-level scope-setting link and per-section spec links for Tools,
Resources, Prompts, Sampling, Elicitation, and Authorization.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@changeset-bot
Copy link

changeset-bot bot commented Feb 12, 2026

⚠️ No Changeset found

Latest commit: 1f07d0d

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 12, 2026

Open in StackBlitz

@modelcontextprotocol/client

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

@modelcontextprotocol/server

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

@modelcontextprotocol/express

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

@modelcontextprotocol/hono

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

@modelcontextprotocol/node

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

commit: 1f07d0d

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