mcp-server-patterns

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

Updated Mar 25, 2026
One-click install
npx skills add https://github.com/Femad-6/my-skills --skill mcp-server-patterns-femad-6
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mcp-server-patterns
Source: https://github.com/Femad-6/my-skills/tree/main/.github/skills/mcp-server-patterns
Command: npx skills add https://github.com/Femad-6/my-skills --skill mcp-server-patterns-femad-6

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 guidance to implement MCP servers in Node/TypeScript without guessing at current API signatures. ## Core Features & Use Cases - Tool, Resource, and Prompt Registration: Register callable tools with Zod-validated input schemas, read-only resources with URI handlers, and parameterized prompt templates. - Transport Selection: Configure stdio transport for local clients like Claude Desktop, or Streamable HTTP for remote clients like Cursor and cloud deployments, with legacy HTTP/SSE only for backward compatibility. - Use Case: You need to expose an internal search API to AI assistants. Use this Skill to scaffold an MCP server, register a search tool with a Zod schema, and connect it over stdio so Claude Desktop can invoke it. ## Quick Start Ask the AI to scaffold an MCP server in TypeScript with a Zod-validated tool and connect it over stdio for Claude Desktop.

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. Verify current method signatures against the official MCP docs or Context7 since the API has changed over time.

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.

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(). Check the official MCP documentation or Context7 for the current signature before writing code.

Does the MCP SDK support input validation for tools?

Yes, the recommended approach is defining Zod schemas for every tool's input parameters. Schema-first design documents parameters and return shapes, and helps the model call tools correctly.

Why does my MCP server fail to connect with Claude Desktop?

Connection failures usually come from incorrect stdio transport setup or mismatched SDK APIs. Keep server logic independent of transport, verify the connect method against current docs, and confirm the client configuration points to your server entrypoint.