mcp-server-patterns

Implement MCP servers with the Node/TypeScript SDK using tools, resources, and prompts.

Updated Apr 18, 2026
One-click install
npx skills add https://github.com/JohnRebellion/.claude-public --skill mcp-server-patterns-johnrebellion
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: mcp-server-patterns
Source: https://github.com/JohnRebellion/.claude-public/tree/main/claude/skills/mcp-server-patterns
Command: npx skills add https://github.com/JohnRebellion/.claude-public --skill mcp-server-patterns-johnrebellion

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @modelcontextprotocol/sdk, zod.

What problem does it solve? Building a Model Context Protocol server requires navigating an evolving SDK API, choosing between stdio and Streamable HTTP transports, and correctly registering tools, resources, and prompts. This Skill provides the patterns and decision guidance to implement and maintain MCP servers without copy-paste errors from outdated examples. ## Core Features & Use Cases - Server Implementation Patterns: Register tools, resources, and prompts with the @modelcontextprotocol/sdk using Zod for input validation. - Transport Selection: Choose stdio for local clients like Claude Desktop or Streamable HTTP for remote clients like Cursor and cloud deployments. - SDK Upgrade Guidance: Verify current method signatures (tool() vs registerTool()) against official MCP docs or Context7 to avoid breaking changes. - Use Case: You need to expose an internal API as MCP tools for Claude Desktop. Use this Skill to scaffold the server, define Zod-validated tool schemas, and connect via stdio transport. ## Quick Start Use the mcp-server-patterns skill to scaffold a new MCP server in TypeScript with one Zod-validated tool and stdio transport.

Frequently Asked Questions about mcp-server-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build an MCP server with TypeScript?▼

Install @modelcontextprotocol/sdk and zod, create an McpServer instance with a name and version, then register tools and resources using the API your SDK version provides. Connect a stdio transport for local clients or Streamable HTTP for remote clients.

What is the difference between stdio and Streamable HTTP in MCP?▼

Stdio transport is for local clients like Claude Desktop, while Streamable HTTP is the preferred transport for remote clients such as Cursor or cloud deployments. Legacy HTTP/SSE should only be supported when backward compatibility is required.

Should I use tool() or registerTool() in the MCP SDK?▼

The Node/TypeScript SDK API has changed over time; some versions use server.tool() with positional args, others use registerTool() or object-based signatures. Check the official MCP documentation or query Context7 for the current signatures before writing registration code.

Does the MCP SDK support input validation for tools?▼

Yes, use Zod or the SDK's preferred schema format to define input schemas for every tool. Document parameters and return shapes so the model can invoke tools correctly and interpret structured errors.

Why does my MCP server fail after upgrading the SDK?▼

Registration and transport APIs change between SDK versions, so old method names or signatures may break. Pin the SDK version in package.json, review release notes when upgrading, and verify current patterns against official docs or Context7.