Skip to content

Rewrite docs/server.md as a code-heavy, prose-light how-to guide#1552

Open
jonathanhefner wants to merge 2 commits intomodelcontextprotocol:mainfrom
jonathanhefner:server-how-to
Open

Rewrite docs/server.md as a code-heavy, prose-light how-to guide#1552
jonathanhefner wants to merge 2 commits intomodelcontextprotocol:mainfrom
jonathanhefner:server-how-to

Conversation

@jonathanhefner
Copy link
Member

@jonathanhefner jonathanhefner commented Feb 17, 2026

Repositions the server guide from a mixed how-to/reference/overview document into a focused how-to guide that leads with type-checked code snippets and delegates conceptual content to the MCP overview docs on modelcontextprotocol.io.

Key changes to docs/server.md:

  • Rename heading to "Building MCP servers" (task framing)
  • Add snippet-synced imports block so readers know which packages to import
  • Cross-reference links now point to MCP overview/learn pages (server-concepts, client-concepts, architecture) instead of the specification, except for Logging and Tasks which have no dedicated learn pages
  • Replace > [!NOTE] callout blocks with inline example links
  • Add decision guidance to Resources and Prompts sections ("use a resource when the client needs to read data; use a tool when it needs to do something")
  • Add tool annotations snippet (destructiveHint, idempotentHint)
  • Add error handling subsection under Tools showing the isError: true pattern, with notes on auto-catch and output schema skip behavior
  • Add shutdown section with SIGINT handling for both multi-session HTTP (including httpServer.close()) and stdio servers
  • Condense three Streamable HTTP variant subsections into one snippet plus an Options paragraph
  • Promote Tools, Resources, Prompts to top-level sections
  • Replace "More server features" table with See Also list and Additional Examples table
  • Update docs/documents.md description to match

New example regions in serverGuide.examples.ts:

  • imports — synced into the Imports section
  • registerTool_annotations — tool with destructiveHint
  • registerTool_errorHandling — try/catch with isError: true
  • shutdown_statefulHttp — SIGINT + httpServer.close() + transport cleanup
  • shutdown_stdio — SIGINT + server.close()

@changeset-bot
Copy link

changeset-bot bot commented Feb 17, 2026

⚠️ No Changeset found

Latest commit: afd9e61

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 17, 2026

Open in StackBlitz

@modelcontextprotocol/client

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

@modelcontextprotocol/server

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

@modelcontextprotocol/express

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

@modelcontextprotocol/hono

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

@modelcontextprotocol/node

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

commit: afd9e61

jonathanhefner and others added 2 commits February 19, 2026 20:47
Repositions the server guide from a mixed how-to/reference/overview
document into a focused how-to guide that leads with type-checked code
snippets and delegates conceptual content to the MCP overview docs on
modelcontextprotocol.io.

Key changes to `docs/server.md`:

- Rename heading to "Building MCP servers" (task framing)
- Add snippet-synced imports block so readers know which packages to
  import
- Cross-reference links now point to MCP overview/learn pages
  (server-concepts, client-concepts, architecture) instead of the
  specification, except for Logging and Tasks which have no dedicated
  learn pages
- Replace `> [!NOTE]` callout blocks with inline example links
- Add decision guidance to Resources and Prompts sections ("use a
  resource when the client needs to read data; use a tool when it needs
  to do something")
- Add tool annotations snippet (`destructiveHint`, `idempotentHint`)
- Add error handling subsection under Tools showing the `isError: true`
  pattern, with notes on auto-catch and output schema skip behavior
- Add shutdown section with SIGINT handling for both multi-session HTTP
  (including `httpServer.close()`) and stdio servers
- Condense three Streamable HTTP variant subsections into one snippet
  plus an Options paragraph
- Promote Tools, Resources, Prompts to top-level sections
- Replace "More server features" table with See Also list and Additional
  Examples table
- Update `docs/documents.md` description to match

New example regions in `serverGuide.examples.ts`:

- `imports` — synced into the Imports section
- `registerTool_annotations` — tool with `destructiveHint`
- `registerTool_errorHandling` — try/catch with `isError: true`
- `shutdown_statefulHttp` — SIGINT + `httpServer.close()` + transport
  cleanup
- `shutdown_stdio` — SIGINT + `server.close()`

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
`docs/server.md`

Three gaps identified in the server how-to guide, each with a
type-checked example in `serverGuide.examples.ts`:

- **Server instructions** — `McpServer` constructor `instructions`
  option for cross-tool relationships, workflow patterns, and
  constraints. Placed between Transports and Tools.
- **Progress** — sending `notifications/progress` via
  `ctx.mcpReq.notify()` during long-running tool execution, guarded by
  `progressToken`. Placed between Logging and Server-initiated requests.
- **Roots** — calling `server.server.listRoots()` to discover the
  client's workspace directories. Placed under Server-initiated requests
  alongside Sampling and Elicitation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jonathanhefner jonathanhefner marked this pull request as ready for review February 20, 2026 02:50
@jonathanhefner jonathanhefner requested a review from a team as a code owner February 20, 2026 02:50
@jonathanhefner jonathanhefner enabled auto-merge (squash) February 20, 2026 02:50
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

Comments