mcp-server-patterns
Skill8 starsChanged 3 months agoMITView on GitHub
Build MCP servers with Node/TypeScript SDK — tools, resources, prompts, Zod validation, stdio vs Streamable HTTP. Use Context7 or official MCP docs for latest API. Use when building or debugging an MCP server — tools, resources, prompts, validation, or transport choice.
- Installs packages
We split this skill into the rules it gives an agent
5 rules. 4 are common, 0 are distinctive, and 1 is very specific to this project.
4
Common
Most of the 31 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Common: line 16
Use when: implementing a new MCP server, adding tools or resources, choosing stdio vs HTTP, upgrading the SDK, or debugging MCP …
- Very specific: line 23
Resources: Read-only data the model can fetch (e.g.
- Common: line 33
Keep server logic (tools + resources) independent of transport so you can plug in stdio or HTTP in the entrypoint.
- Common: line 56
Use Zod (or the SDK’s preferred schema format) for input validation.
- Common: line 62
Idempotency: Prefer idempotent tools where possible so retries are safe.
“Common” is measured: kept by at least 6 in 10 of the 31 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
MCP Server Patterns
The Model Context Protocol (MCP) lets AI assistants call tools, read resources, and use prompts from your server. Use this skill when building or maintaining MCP servers. The SDK API evolves; check Context7 (query-docs for "MCP") or the official MCP documentation for current method names and signatures.
For the broader routing decision of when a capability should be a rule, a skill, MCP, or a plain CLI/API workflow, see docs/capability-surface-selection.md.
When to Use
Use when: implementing a new MCP server, adding tools or resources, choosing stdio vs HTTP, upgrading the SDK, or debugging MCP registration and transport issues.
How It Works
Core concepts
- Tools: Actions the model can invoke (e.g. search, run a command). Register with
registerTool()ortool()depending on SDK version. - Resources: Read-only data the model can fetch (e.g. file contents, API responses). Register with
registerResource()orresource(). Handlers typically receive auriargument. - Prompts: Reusable, parameterised prompt templates the client can surface (e.g. in Claude Desktop). Register with
registerPrompt()or equivalent. - Transport: stdio for local clients (e.g. Claude Desktop); Streamable HTTP is preferred for remote (Cursor, cloud). Legacy HTTP/SSE is for backward compatibility.
The Node/TypeScript SDK may expose tool() / resource() or registerTool() / registerResource(); the official SDK has changed over time. Always verify against the current MCP docs or Context7.
Connecting with stdio
For local clients, create a stdio transport and pass it to your server’s connect method. The exact API varies by SDK version (e.g. constructor vs factory). See the official MCP documentation or query Context7 for "MCP stdio server" for the current pattern.
Keep server logic (tools + resources) independent of transport so you can plug in stdio or HTTP in the entrypoint.
Remote (Streamable HTTP)
For Cursor, cloud, or other remote clients, use Streamable HTTP (single MCP HTTP endpoint per current spec). Support legacy HTTP/SSE only when backward compatibility is required.
Examples
Install and server setup
npm install @modelcontextprotocol/sdk zodimport { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { z } from "zod";
const server = new McpServer({ name: "my-server", version: "1.0.0" });Register tools and resources using the API your SDK version provides: some versions use server.tool(name, description, schema, handler) (positional args), others use server.tool({ name, description, inputSchema }, handler) or registerTool(). Same for resources — include a uri in the handler when the API provides it. Check the official MCP docs or Context7 for the current @modelcontextprotocol/sdk signatures to avoid copy-paste errors.
Use Zod (or the SDK’s preferred schema format) for input validation.
Best Practices
- Schema first: Define input schemas for every tool; document parameters and return shape.
- Errors: Return structured errors or messages the model can interpret; avoid raw stack traces.
- Idempotency: Prefer idempotent tools where possible so retries are safe.
- Rate and cost: For tools that call external APIs, consider rate limits and cost; document in the tool description.
- Versioning: Pin SDK version in package.json; check release notes when upgrading.
Official SDKs and Docs
- JavaScript/TypeScript:
@modelcontextprotocol/sdk(npm). Use Context7 with library name "MCP" for current registration and transport patterns. - Go: Official Go SDK on GitHub (
modelcontextprotocol/go-sdk). - C#: Official C# SDK for .NET.
Other versions33 projects use a version of this.
Word for word · 2
- NISTALTALSON/essential-claude-skills★ 1100% same
- Ronnasayd/aipp★ 1100% same
Edited · 29
- affaan-m/ECC★ 246k99% same
- loulanyue/awesome-claude-notes★ 27299% same
- tpavanipradeep/everything-claude-code★ 10499% same
- mturac/everything-openai-codex★ 8997% same
- mit-network/everything-claude-code★ 7699% same
- Fmarzochi/EGC★ 6197% same
- ysyecust/everything-claude-code★ 4499% same
- jiten-singh-shahi/salesforce-claude-code★ 1539% same
- yapota2018/affaan-m-everything-claude-code★ 499% same
- yevhens-hue/claude-skills-starter-kit★ 499% same
19 more not listed
Wrote their own version · 2
- bjornjee/skills★ 2same name
- jamesdebatty/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
Used alongsideProjects with it also use everything-claude-code-conventions and frontend-design.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
mryeastcodeSkilleverything-claude-code-conventions
Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.
Also in 8 projects that use this
BlockSkillfrontend-design
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
Also in 3 projects that use this
In this repository273 other files it gives its agents.
- accessibilitySkill
- agent-architecture-auditSkill
- agent-evalSkill
- agent-harness-constructionSkill
- agentic-engineeringSkill
- agentic-osSkill
- agent-introspection-debuggingSkill
- agent-payment-x402Skill
- agent-self-evaluationSkill
- agent-sortSkill
- ai-first-engineeringSkill
- ai-regression-testingSkill
- android-clean-architectureSkill
- angular-developerSkill
- api-connector-builderSkill
- api-designSkill
- architecture-decision-recordsSkill
- article-writingSkill
- automation-audit-opsSkill
- autonomous-agent-harnessSkill
- autonomous-loopsSkill
- backend-patternsSkill
- benchmark-methodologySkill
- benchmark-optimization-loopSkill
- benchmarkSkill
- blender-motion-state-inspectionSkill
- blueprintSkill
- brand-discoverySkill
- brand-voiceSkill
- browser-qaSkill
- bun-runtimeSkill
- canary-watchSkill
- carrier-relationship-managementSkill
- cisco-ios-patternsSkill
- ckSkill
- claude-devfleetSkill
- clickhouse-ioSkill
- click-path-auditSkill
- codebase-onboardingSkill
- codehealth-mcpSkill
- code-tourSkill
- coding-standardsSkill
- competitive-platform-analysisSkill
- competitive-report-structureSkill
- compose-multiplatform-patternsSkill
- config-gcSkill
- configure-eccSkill
- connections-optimizerSkill
- content-engineSkill
- content-hash-cache-patternSkill
- context-budgetSkill
- continuous-agent-loopSkill
- contract-firstSkill
- cost-aware-llm-pipelineSkill
- cost-trackingSkill
- council-multi-modelSkill
- councilSkill
- cpp-coding-standardsSkill
- cpp-testingSkill
- crosspostSkill
- The first 60 shown.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

