mcp-server-patterns

Build and configure MCP servers with the Node/TypeScript SDK.

1|Updated Mar 18, 2026
One-click install
npx skills add https://github.com/xxih/ai-harness-zh --skill mcp-server-patterns-xxih
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mcp-server-patterns
Source: https://github.com/xxih/ai-harness-zh/tree/main/references/translations/everything-claude-code/docs/zh-CN/skills/mcp-server-patterns
Command: npx skills add https://github.com/xxih/ai-harness-zh --skill mcp-server-patterns-xxih

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It enables developers to quickly set up and maintain Model Context Protocol (MCP) servers with the Node/TypeScript SDK, handling tool, resource, and prompt registration as well as transport selection between stdio and streaming HTTP.

Core Features & Use Cases

  • Tool & Resource Registration: Register callable functions and read‑only data with version‑aware SDK methods.
  • Prompt Management: Define reusable prompt templates for client interactions.
  • Transport Flexibility: Choose between local stdio connections or remote streaming HTTP endpoints.
  • Schema Validation: Use Zod (or SDK‑provided schemas) to validate tool inputs.
  • Use Case: Build a local development MCP server for testing tools, then switch to a cloud‑hosted streaming HTTP server for production.

Quick Start

Ask the assistant to generate a minimal Node.js MCP server that registers a sample tool and runs using 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?

To build an MCP server with Node and TypeScript, use the @modelcontextprotocol/sdk package to register tools, resources, and prompts, then configure your preferred stdio or streaming HTTP transport.

How do I validate tool inputs in a Model Context Protocol server?

You validate MCP server tool inputs using Zod schema validation or the SDK-provided schemas, ensuring correct data types and structures are enforced before callable functions execute.

When should I use stdio versus streaming HTTP transport for an MCP server?

Use stdio transport for local development and testing connections, and switch to remote streaming HTTP endpoints when deploying your MCP server to a cloud-hosted or production environment.

Do I need Zod to manage MCP prompt templates in TypeScript?

Zod is optional for managing MCP prompt templates; the TypeScript SDK provides version-aware methods to define reusable prompt templates for client interactions without requiring external schema validation.

Can I register read-only resources alongside callable tools in a TypeScript MCP server?

Yes, you can register both read-only resources and callable tools within a TypeScript MCP server using version-aware SDK methods to expose data and functions to the client.