mcp-best-practices
БесплатноБез исполняемых скриптовНе проверенBuild, harden, and debug production MCP servers with the TypeScript SDK. Use when writing or reviewing an MCP server - transports, tool schemas, errors…
от tenequm2 868 установок в других каталогахОб этом скилле
MCP Best Practices
Decision reference for building production MCP servers with the TypeScript SDK. Not a tutorial - assumes you already have a working server and need to make it correct, fast, and secure.
Quick Reference
| Component | Current | Notes |
|---|---|---|
| Spec (released) | 2026-07-28 (specification) | Stateless/sessionless overhaul - see "Spec 2026-07-28" below and references/spec-2026-07-28.md |
| Spec (still deployed) | 2025-11-25 | Still the bulk of deployed software and the TS client default - but Claude Code now negotiates 2026-07-28 with HTTP servers that offer it |
| TS SDK (current) | v2.3.1 (2026-10-05): /server, /client, /core 2.3.1; /node 2.1.1, /express + /hono 2.0.2, /fastify 2.0.1 (no longer lockstep) |
createMcpHandler serves both eras by default; the client speaks 2025-era unless told otherwise |
| TS SDK (legacy) | v1.32.1 (@modelcontextprotocol/sdk) |
Bug + security fixes for >=6 months after v2 GA, never a revision past 2025-11-25; source on the v1.x branch |
| JSON Schema | 2020-12 default (2019-09 / draft-07 accepted since v2.0.0) | - |
| Transport | Streamable HTTP (remote), stdio (local) | SSE + WebSocket removed in v2 |
| Extensions | MCP Apps (Stable, SEP-1865), Auth Extensions (official), Tasks (ext-tasks) | Domain-specific WGs |
| Registry | Preview with v0.1 API freeze since 2025-10-24 (registry) | GA pending |
v2 imports (current):
import { McpServer } from "@modelcontextprotocol/server";
import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/server";
import { ProtocolError, ProtocolErrorCode } from "@modelcontextprotocol/core";
v1 imports (legacy line, still widely deployed):
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
The Two Eras
The most decision-relevant fact after the 2026-07-28 release: upgrading the TS SDK does not move your client to the new spec, but other SDKs and clients do not share that default. rmcp (Rust) >= 3.0 advertises 2026-07-28 out of the box, so a dependency bump can silently put a server on the modern wire - re-check which revisions you advertise after every SDK upgrade.
Every revision from 2024-10-07 through 2025-11-25 opens with initialize and shares one wire behavior - the SDK calls that family legacy. 2026-07-28 starts the modern era: no initialize, a server/discover advertisement instead, a _meta envelope on every request. Selection is explicit:
versionNegotiation.mode |
Behavior |
|---|---|
absent / 'legacy' |
The 2025 initialize handshake, byte for byte. No probe. This is the default. |
'auto' |
Probe with server/discover; fall back to initialize against a 2025-only server |
{ pin: '2026-07-28' } |
That revision or nothing - a pin never falls back |
Servers: serve both eras. Claude Code's current MCP runtime asks HTTP servers whether they support 2026-07-28 and uses it when they do (stdio is rolling out), so a server that advertises modern support gets modern traffic from a mainstream client today. v2's createMcpHandler serves 2025-era requests alongside modern ones by default (legacy: 'stateless'); test both eras. The stateless design guidance throughout this skill is what makes that cheap.
Tooling: SDK docs (v2); MCP Inspector, which connects as legacy by default - pass --protocol-era modern (see "Testing Against Each Era" in references/spec-2026-07-28.md); the conformance suite; and the mcp-server-dev plugin for scaffolding.
Server Setup
Transport Decision
| Scenario | Transport | Key Config |
|---|---|---|
| Remote, v2 (K8s, CF Workers, Node) | createMcpHandler(factory) |
Serves both eras; stateless per request |
| Remote, v1 / stateless | WebStandardStreamableHTTPServerTransport |
sessionIdGenerator: undefined, enableJsonResponse: true |
| Remote, stateful (2025-era only) | WebStandardStreamableHTTPServerTransport |
sessionIdGenerator: () => randomUUID() |
| Local CLI / Claude Desktop | StdioServerTransport / v2 serveStdio(factory) |
Default |
| Legacy SSE clients | SSE removed in v2 - migrate to |
Установить mcp-best-practices в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл mcp-best-practices?
Build, harden, and debug production MCP servers with the TypeScript SDK. Use when writing or reviewing an MCP server - transports, tool schemas, errors, OAuth, token bloat, SDK migrations, MCP Apps, Registry. Assumes a server already exists.
Как установить скилл mcp-best-practices?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл mcp-best-practices запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic