Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
affaan-m avatar

Mcp Server Patterns

  • 5.2k installs
  • 238k repo stars
  • Updated August 5, 2026
  • affaan-m/everything-claude-code

mcp-server-patterns is an agent skill for building MCP servers with Node/TypeScript, Zod validation, tools, resources, prompts, and stdio or Streamable HTTP transport.

About

The mcp-server-patterns skill guides developers building Model Context Protocol servers so AI assistants can call tools, read resources, and surface prompts from custom backends. It covers core MCP concepts including tool registration for invocable actions, read-only resources with URI handlers, reusable prompt templates, and transport choice between stdio for local clients like Claude Desktop and Streamable HTTP for remote clients such as Cursor or cloud hosts. The Node and TypeScript SDK API evolves across versions, so agents must verify current registerTool, tool, registerResource, and connect signatures against official MCP docs or Context7 instead of copying stale examples. Best practices emphasize schema-first tool inputs with Zod validation, structured errors the model can interpret, idempotent tools for safe retries, and pinned SDK versions with release-note checks on upgrade. Examples show installing @modelcontextprotocol/sdk with zod, instantiating McpServer, and keeping server logic transport-independent so stdio or HTTP entrypoints can be swapped. Use when implementing a new MCP server, adding tools or resources, choosing transport, upgrading the SDK, or debugging regi.

  • Defines tools, resources, prompts, and transport as the four core MCP server concepts.
  • Recommends stdio for local clients and Streamable HTTP for remote Cursor or cloud hosts.
  • Requires schema-first tool inputs with Zod and structured model-readable errors.
  • Warns SDK method names change across versions; verify against MCP docs or Context7.
  • Keeps tool and resource logic independent of transport in the server entrypoint.

Mcp Server Patterns by the numbers

  • 5,201 all-time installs (skills.sh)
  • +248 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #147 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

mcp-server-patterns capabilities & compatibility

Capabilities
register mcp tools, resources, and prompts with · choose stdio or streamable http transport per cl · validate tool inputs with zod schemas · return structured errors and design idempotent t · pin and upgrade @modelcontextprotocol/sdk safely · separate server logic from transport entrypoints
Use cases
api development · orchestration
From the docs

What mcp-server-patterns says it does

The Model Context Protocol (MCP) lets AI assistants call tools, read resources, and use prompts from your server.
SKILL.md
stdio for local clients (e.g. Claude Desktop); Streamable HTTP is preferred for remote (Cursor, cloud).
SKILL.md
Define input schemas for every tool; document parameters and return shape.
SKILL.md
npx skills add https://github.com/affaan-m/everything-claude-code --skill mcp-server-patterns

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs5.2k
repo stars238k
Security audit3 / 3 scanners passed
Last updatedAugust 5, 2026
Repositoryaffaan-m/everything-claude-code

How do developers implement MCP servers with the correct SDK registration APIs and transport for local versus remote clients?

Build and maintain MCP servers with the Node/TypeScript SDK, covering tools, resources, prompts, Zod schemas, and stdio versus Streamable HTTP transport.

Who is it for?

Developers creating or maintaining MCP servers for Claude Desktop, Cursor, or other MCP clients.

Skip if: Skip for MCP client configuration only or languages outside the documented Node/TypeScript SDK patterns.

When should I use this skill?

User implements a new MCP server, adds tools or resources, chooses stdio versus HTTP, upgrades the SDK, or debugs MCP registration.

What you get

An MCP server with validated tool schemas, resource handlers, prompt templates, and a transport entrypoint verified against current SDK docs.

  • MCP server scaffold
  • Tool and resource handler modules

By the numbers

  • Covers three MCP primitives: tools, resources, and prompts

Files

SKILL.mdMarkdownGitHub ↗

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.

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() or tool() depending on SDK version.
  • Resources: Read-only data the model can fetch (e.g. file contents, API responses). Register with registerResource() or resource(). Handlers typically receive a uri argument.
  • 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 zod
import { 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.

Related skills

Forks & variants (1)

Mcp Server Patterns has 1 known copy in the catalog totaling 1.4k installs. They canonicalize to this original listing.

How it compares

Use mcp-server-patterns when agents need a standardized MCP tool surface instead of bespoke REST endpoints.

FAQ

When should I use stdio versus Streamable HTTP?

Use stdio for local clients such as Claude Desktop; use Streamable HTTP for remote clients like Cursor or cloud deployments, reserving legacy HTTP/SSE only for compatibility.

Why verify SDK signatures before coding?

The Node MCP SDK has changed registerTool versus tool APIs over time; copying old snippets causes registration failures.

What validation should every tool have?

Define input schemas, typically with Zod, document parameters and return shapes, and return structured errors instead of raw stack traces.

Is Mcp Server Patterns safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.