mcp-server-patterns

Implements MCP servers with the Node/TypeScript SDK covering tools, resources, prompts, and transports.

1|Updated Oct 11, 2025
One-click install
npx skills add https://github.com/ibytechaos/claude --skill mcp-server-patterns-ibytechaos
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mcp-server-patterns
Source: https://github.com/ibytechaos/claude/tree/main/plugins/everything-claude-code/skills/mcp-server-patterns
Command: npx skills add https://github.com/ibytechaos/claude --skill mcp-server-patterns-ibytechaos

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @modelcontextprotocol/sdk, zod.

What problem does it solve? Building a Model Context Protocol server involves evolving SDK APIs, transport choices, and schema validation decisions that are easy to get wrong. This Skill provides current patterns and best practices for implementing MCP servers correctly with the Node/TypeScript SDK. ## Core Features & Use Cases - Tool, Resource, and Prompt Registration: Register callable tools, read-only resources, and parameterized prompt templates using registerTool(), registerResource(), or version-specific equivalents. - Transport Selection Guidance: Choose stdio for local clients like Claude Desktop or Streamable HTTP for remote clients like Cursor, with legacy HTTP/SSE only for backward compatibility. - Zod Schema Validation: Define input schemas for every tool so parameters are validated and documented. - Use Case: You need to expose an internal search API to Claude Desktop. Use this Skill to scaffold an MCP server with a stdio transport, register a search tool with a Zod input schema, and return structured errors the model can interpret. ## Quick Start Help me build an MCP server in TypeScript that exposes a search tool with Zod validation and connects over stdio.

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. Check the official MCP docs or Context7 for current registration signatures since the API has changed over time.

Should I use stdio or HTTP transport for my MCP server?

Use stdio for local clients like Claude Desktop and Streamable HTTP for remote clients like Cursor or cloud deployments. Legacy HTTP/SSE should only be supported when backward compatibility is required.

How do I validate MCP tool inputs with Zod?

Define a Zod schema for every tool's input and pass it during tool registration so parameters are validated before the handler runs. Document each parameter and the return shape in the tool description.

Why does my MCP tool registration fail after an SDK upgrade?

The SDK has changed between tool(), registerTool(), and object-based versus positional argument signatures across versions. Pin the SDK version in package.json and verify current signatures against the official MCP documentation or Context7 when upgrading.

Can I use the same MCP server logic for stdio and HTTP?

Yes, keep server logic for tools and resources independent of transport so you can plug in stdio or Streamable HTTP in the entrypoint. This separation lets one codebase serve both local and remote clients.