mcp-server-patterns
Learn to construct MCP servers using the Node/TypeScript SDK, implementing tools for model invocation, resources for data access, and prompt templates. This skill covers registration patterns, transport selection between stdio for local clients and Streamable HTTP for remote, and validation best practices with Zod.
mcp-server-patterns teaches you to build MCP servers with Node/TypeScript, covering tools, resources, prompts, and transport choices.
AI-generated summary based on this skill's SKILL.md
Install
affaan-m/ECC/mcp-server-patterns · repository language: JavaScript
git clone https://github.com/affaan-m/ECC
cp -r ECC/skills/mcp-server-patterns ~/.claude/skills/mcp-server-patternsnpx skillfed install affaan-m/ECC/mcp-server-patternsFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How do I set up an MCP server with Node.js?
mcp-server-patterns teaches you to build MCP servers using the Node/TypeScript SDK. Start by initializing a project, importing the Server class, defining tools with input schemas, and choosing your transport layer—stdio for local Cursor integration or Streamable HTTP for remote clients. The skill covers registration patterns and best practices for structuring your server code.
What's the difference between MCP stdio vs HTTP transport?
mcp-server-patterns explains that stdio transport connects MCP servers directly to local clients like Cursor through standard input/output, ideal for development. HTTP transport, specifically Streamable HTTP, enables remote client connections and is better for distributed setups. Your choice depends on whether you need local or remote access to your server's tools and resources.
How do I register tools in an MCP server?
mcp-server-patterns covers tool registration by defining handlers that respond to tool_call requests. You specify tool names, descriptions, and input schemas using Zod for validation. When a client invokes a tool, your handler processes the input and returns results. The skill shows patterns for organizing multiple tools and handling both simple and complex tool implementations.
How can I validate MCP tool inputs with Zod schemas?
mcp-server-patterns demonstrates using Zod schemas to define and validate tool input parameters. Define your schema with Zod's type system, attach it to your tool definition, and let the SDK validate incoming requests. This approach catches errors early and ensures type safety. The skill includes error handling patterns for validation failures and best practices for schema design.
What are MCP resources and prompt templates?
mcp-server-patterns teaches that MCP resources provide data access through URI-based handlers—clients request resources and your server returns content. Prompt templates are reusable instruction sets that guide model behavior. Both extend your server's capabilities beyond tools. The skill covers implementing resource handlers, managing URIs, and creating effective prompt templates for Claude and other models.
How do I debug MCP registration and SDK version issues?
mcp-server-patterns addresses debugging by explaining SDK API changes, version compatibility, and registration validation. Check your server's capabilities declaration, verify tool and resource handlers are properly attached, and use logging to trace requests. The skill covers common pitfalls like mismatched schemas and outdated SDK patterns, plus strategies for upgrading to newer MCP SDK versions.
SKILL.md
rendered from the published skill — quoted content, verbatim
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.
For the broader routing decision of when a capability should be a rule, a skill, MCP, or a plain CLI/API workflow, see docs/capability-surface-selection.md.
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()ortool()depending on SDK version. - Resources: Read-only data the model can fetch (e.g. file contents,
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 1 file
skills/mcp-server-patterns/SKILL.md