mcp-server-development

Develop MCP servers with TypeScript SDK, Zod validation, and JSON-RPC patterns.

8|1|Updated Oct 30, 2025
One-click install
npx skills add https://github.com/akiojin/llm-router --skill mcp-server-development-akiojin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mcp-server-development
Source: https://github.com/akiojin/llm-router/tree/main/.claude/skills/mcp-server-development
Command: npx skills add https://github.com/akiojin/llm-router --skill mcp-server-development-akiojin

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires zod.

What problem does it solve?

Provides expert guidance for building MCP (Model Context Protocol) servers using the TypeScript SDK, covering server initialization, request handlers, Zod schemas, error handling, and JSON-RPC patterns.

Core Features & Use Cases

  • Handler-based design with one class per tool
  • Strong input validation using Zod
  • MCP transport: Content-Length framing and NDJSON compatibility
  • Structured error handling and JSON-RPC patterns
  • Testing patterns: contract tests, mocks, and integration tests

Quick Start

Create a new MCP server skeleton, implement a single handler (e.g., system_ping), wire it into the central index, and run a local test to ensure JSON-RPC framing and error handling behave correctly.

Frequently Asked Questions about mcp-server-development

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build an MCP server using TypeScript?

Build an MCP server by initializing a TypeScript project, creating handler classes for each tool, validating inputs with Zod schemas, and wiring handlers into a central index. Use Content-Length framing for transport and JSON-RPC patterns for request-response cycles.

What is the handler-based pattern for MCP server development?

The handler-based pattern creates one class per tool, each implementing a base handler contract. This design isolates tool logic, simplifies testing, and enforces consistent input validation and error handling across your MCP server.

How do I validate inputs in an MCP server with Zod?

Define Zod schemas for each tool's input parameters, then validate requests in your handler before processing. Zod ensures type safety and generates MCP-compliant error responses when validation fails.

How do I handle errors and JSON-RPC framing in MCP servers?

Implement structured error handling using MCP error codes and JSON-RPC response patterns. Wrap handlers to catch exceptions, map them to appropriate MCP codes, and return properly formatted error objects to the client.

What testing strategies work for MCP server development?

Use contract tests to verify handler compliance with the base handler interface, mocks to isolate tool logic, and integration tests to validate JSON-RPC framing and Content-Length transport end-to-end.

Does MCP server development require Content-Length framing?

Yes, MCP transport uses Content-Length framing and NDJSON format for reliability. This ensures messages are properly delimited and compatible with streaming I/O and bidirectional communication.

Related Skills