mcp-server-patterns

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

Updated Mar 18, 2026
One-click install
npx skills add https://github.com/freedom909/real-estate-saas --skill mcp-server-patterns-freedom909
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: mcp-server-patterns
Source: https://github.com/freedom909/real-estate-saas/tree/main/.trae/skills/mcp-server-patterns
Command: npx skills add https://github.com/freedom909/real-estate-saas --skill mcp-server-patterns-freedom909

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @modelcontextprotocol/sdk, zod.

What problem does it solve? Building a Model Context Protocol server involves evolving SDK APIs, multiple transport options, and registration patterns that change between versions, making it easy to write outdated or broken integration code. ## Core Features & Use Cases - Tool, Resource, and Prompt Registration: Guidance on registering tools, resources, and prompts with the @modelcontextprotocol/sdk, including Zod-based input validation. - Transport Selection: Explains when to use stdio for local clients like Claude Desktop versus Streamable HTTP for remote clients like Cursor, with legacy HTTP/SSE notes. - Version-Safe Patterns: Directs verification against Context7 or official MCP docs to avoid copy-paste errors from outdated SDK signatures. - Use Case: You need to expose an internal search API to Claude Desktop. Use this Skill to scaffold an MCP server, register a Zod-validated search tool, and connect it over stdio. ## Quick Start Use the mcp-server-patterns skill to scaffold a new MCP server in TypeScript with one Zod-validated tool and a 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 Node and 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.

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

Tool registration uses server.tool() or registerTool() depending on SDK version, with either positional arguments or an options object plus a handler. Define a Zod input schema for every tool and verify current signatures against the official MCP docs or Context7.

Should I use stdio or Streamable HTTP for my MCP server?▼

Use stdio for local clients such as 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.

Does the MCP SDK support input validation for tools?▼

Yes, the TypeScript SDK works with Zod schemas to validate tool inputs. Define a schema for every tool documenting parameters and return shape so invalid calls fail predictably.

Why does my MCP tool registration code break after an SDK upgrade?▼

The official SDK has changed registration method names and signatures over time, so older examples may no longer compile. Pin the SDK version in package.json and check release notes or Context7 when upgrading.