mcp-server-patterns

Implements MCP servers with tools, resources, prompts, and stdio or HTTP transports.

5|15|Updated Jul 8, 2026
One-click install
npx skills add https://github.com/clfigueiredo/hermes-infra-skills --skill mcp-server-patterns-clfigueiredo
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: mcp-server-patterns
Source: https://github.com/clfigueiredo/hermes-infra-skills/tree/main/.hermes/skills/curso-hermes/mcp-server-patterns
Command: npx skills add https://github.com/clfigueiredo/hermes-infra-skills --skill mcp-server-patterns-clfigueiredo

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 MCP servers without copy-paste errors from outdated documentation. ## Core Features & Use Cases - Tool, Resource, and Prompt Registration: Register callable tools with Zod-validated input schemas, read-only resources with URI handlers, and reusable parameterized prompt templates. - Transport Selection: Choose stdio for local clients like Claude Desktop or Streamable HTTP for remote clients like Cursor, keeping server logic transport-independent. - SDK Version Guidance: Verify current @modelcontextprotocol/sdk method signatures via Context7 or official MCP docs instead of relying on stale examples. - Use Case: You need to expose an internal API to AI assistants. Use this Skill to scaffold an MCP server with schema-first tools, structured error responses, and the correct transport for your client. ## Quick Start Use the mcp-server-patterns skill to scaffold a new MCP server in TypeScript with a 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 in 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.

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 for backward compatibility.

How do I register tools in the MCP TypeScript SDK?▼

Tool registration varies by SDK version: some versions use server.tool(name, description, schema, handler) with positional arguments, others use an object form or registerTool(). Verify the current signature against official MCP docs or Context7 before implementing.

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. Schema-first design documents parameters and return shapes while preventing invalid inputs from reaching your handlers.

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

The MCP SDK API has changed over time, so method names and signatures from older examples may no longer exist. Pin the SDK version in package.json, review release notes when upgrading, and confirm current patterns via Context7 or official docs.