How2mcp
MCP server: How2mcp
Installation
npx how2mcpAsk AI about How2mcp
Powered by Claude Β· Grounded in docs
I know everything about How2mcp. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
HOW2MCP - Model Context Protocol 2025
The definitive 2025 resource for understanding and implementing Model Context Protocol (MCP) servers with modern architecture, real examples, and production-ready patterns.
β‘ 5-Minute Quickstart
Get a working MCP server running in 5 minutes:
1. Install Dependencies
npm install @modelcontextprotocol/sdk zod
npm install -D typescript @types/node tsx
2. Create Your Server (server.ts)
#!/usr/bin/env node
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
const server = new Server(
{ name: 'my-server', version: '1.0.0' },
{ capabilities: { tools: {} } }
);
server.setRequestHandler(ListToolsRequestSchema, async () => ({
tools: [{
name: 'greet',
description: 'Say hello to someone',
inputSchema: {
type: 'object',
properties: { name: { type: 'string' } },
required: ['name']
}
}]
}));
server.setRequestHandler(CallToolRequestSchema, async (request) => ({
content: [{ type: 'text', text: `Hello, ${request.params.arguments.name}! π` }]
}));
await server.connect(new StdioServerTransport());
3. Run Your Server
npx tsx server.ts
4. Test with MCP Inspector
npx @modelcontextprotocol/inspector npx tsx server.ts
π That's it! You have a working MCP server.
β‘οΈ Next: Check out progressive examples to learn more patterns.
π€ When to Use HOW2MCP
β Choose HOW2MCP if you want to:
- Understand MCP deeply - Comprehensive architecture and protocol documentation
- Build production servers - 2025 best practices, streaming, caching, versioning
- Deploy to Cloudflare - Workers, Code Mode, edge distribution patterns
- Enterprise scale - Multi-layer caching, rate limiting, observability
- Learn by example - Progressive examples from 15 lines to 700+ line production server
π Compare with FastMCP Framework
FastMCP is excellent for rapid development with opinionated abstractions. HOW2MCP teaches you the underlying patterns and 2025 production features.
Use both together:
- Start with FastMCP for quick prototyping
- Reference HOW2MCP for 2025 patterns (streaming, caching, versioning)
- Use HOW2MCP Cloudflare guides for edge deployment
π Progressive Learning Path
π Fast Track (1-2 hours)
- Quickstart β 5-minute example above
- Examples β
/examples/- Learn by building - Quick Reference β
MCP_QUICK_REFERENCE.md- Essential patterns
π Complete Path (4-6 hours)
- Architecture β
MCP_ARCHITECTURE_2025.md- Modern design patterns - Tech Stack β
MCP_TECH_STACK_2025.md- Tool selection - Implementation β
MCP_IMPLEMENTATION_GUIDE.md- Step-by-step guide - Advanced Patterns β
MCP_ADVANCED_PATTERNS_2025.md- Streaming, caching, versioning - Production Checklist β
MCP_CHECKLIST_2025.md- 100+ validation items
βοΈ Cloudflare Path (2-3 hours)
- Code Mode β
MCP_CODE_MODE_2025.md- Revolutionary TypeScript API - Remote Deployment β
MCP_REMOTE_DEPLOYMENT_2025.md- Workers deployment - Anti-Patterns β
MCP_ANTI_PATTERNS_2025.md- Avoid common mistakes
π― What's Included
π Examples (/examples/)
Progressive learning from simple to production-ready:
| Example | Lines | Features | Time |
|---|---|---|---|
quickstart.ts | ~15 | Basic tool | 5 min |
01-basic.ts | ~50 | Multiple tools | 15 min |
02-intermediate.ts | ~100 | Validation, errors | 30 min |
03-advanced.ts | ~150 | Streaming, resources | 45 min |
MCP_EXAMPLE_PROJECT/ | ~700 | Full production | 2 hours |
π Documentation (/MCP-DOCS/)
2025 Guides (Modern patterns and architecture)
MCP_ARCHITECTURE_2025.md- Component layers, modular design, capabilitiesMCP_TECH_STACK_2025.md- Languages, databases, caching, observabilityMCP_ADVANCED_PATTERNS_2025.md- Streaming, caching, versioning, multi-tenantMCP_WORKFLOWS_2025.md- Connection flows, tool execution, deploymentMCP_EMERGING_TRENDS_2025.md- Code2MCP, MCP Bridge, AutoMCP, MCP-BenchMCP_CHECKLIST_2025.md- 100+ production readiness items
Cloudflare Integration (Edge deployment and Code Mode)
MCP_CODE_MODE_2025.md- TypeScript API approach, goal-oriented toolsMCP_REMOTE_DEPLOYMENT_2025.md- Workers, HTTP+SSE, WebSocket, scalingMCP_ANTI_PATTERNS_2025.md- Common mistakes and best practices
Core Documentation (Technical reference)
MCP_IMPLEMENTATION_GUIDE.md- Complete technical referenceMCP_QUICK_REFERENCE.md- Essential patterns and cheat sheetMCP_DOCUMENTATION_INDEX.md- Navigation guide
Token Optimization (Efficiency and cost reduction)
TOON_IN_MCP_TOOLS.md- Add TOON format to tool responses (30-60% token savings)toon-mcp-server/- Example full TOON-native MCP server (proof-of-concept)
π What's New in 2025
Modern Architecture
β¨ Modular Servers - Single responsibility principle for maintainability π Capability-Based Access - Fine-grained security control π‘ Streaming Responses - SSE/WebSocket for incremental output β‘ Multi-Layer Caching - Memory β Redis β Database optimization π Versioning Strategies - Backward compatibility and API evolution
Technology Stack
- TypeScript/Node.js (primary), Go, Rust, Python support
- Zod + JSON Schema for type-safe validation
- Vector Databases - Qdrant, Chroma, Weaviate, pgvector
- Redis/SQLite/LevelDB for caching and persistence
- OpenTelemetry + Prometheus for observability
Emerging Innovations
- Code2MCP - Auto-generate MCP servers from code repositories
- MCP Bridge - RESTful proxy for universal access
- AutoMCP - Generate servers from OpenAPI specs
- MCP-Bench - Benchmark suite with 250+ evaluation tasks
Cloudflare Integration
- Code Mode - Revolutionary TypeScript API approach for AI agents
- Remote Deployment - Host MCP servers on Cloudflare Workers
- Edge Distribution - Global MCP server deployment at the edge
- Best Practices - Cloudflare-validated patterns and anti-patterns
Token Optimization
- TOON Format - 30-60% token savings for tool responses
- Hybrid Approach - TOON inside JSON-RPC for optimal efficiency
- Production Example - Real implementation in Fractal MCP
- Implementation Guide -
TOON_IN_MCP_TOOLS.md
π§ͺ Testing Your MCP Server
Method 1: MCP Inspector (Visual Interface)
npm install -g @modelcontextprotocol/inspector
npx @modelcontextprotocol/inspector npx tsx your-server.ts
Method 2: MCP CLI (Command Line)
npm install -g @modelcontextprotocol/cli
npx @modelcontextprotocol/cli npx tsx your-server.ts
Method 3: Claude Desktop Integration
Add to ~/.config/claude-desktop/config.json:
{
"mcpServers": {
"my-server": {
"command": "npx",
"args": ["tsx", "/absolute/path/to/your-server.ts"]
}
}
}
Then restart Claude Desktop and your server will be available!
π Showcase - Built with HOW2MCP
Real-world MCP servers using these patterns:
π‘ Want to showcase your MCP server? Submit a PR adding your project here!
π οΈ Example Tools Patterns
The example project demonstrates different MCP tool patterns:
- Simple Processing (
echo) - Text manipulation with parameters - Mathematical Operations (
calculator) - Operations with validation - Data Processing (
data-processor) - Array operations with transformations - System Information (
status) - Health checks and metrics - Streaming Tasks (
streaming-task) - Progress notifications - Async Operations (
async-fetch) - HTTP requests with error recovery
ποΈ Core Architecture Patterns
Server Initialization
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
const server = new Server(
{ name: 'server-name', version: '1.0.0' },
{ capabilities: { tools: {}, resources: {}, prompts: {} } }
);
Tool Registration
server.setRequestHandler(ListToolsRequestSchema, async () => ({
tools: [{
name: 'tool-name',
description: 'What the tool does',
inputSchema: zodToJsonSchema(YourZodSchema)
}]
}));
Validation with Zod
import { z } from 'zod';
import { zodToJsonSchema } from 'zod-to-json-schema';
const ToolSchema = z.object({
param: z.string().min(1),
optional: z.number().default(10)
});
const validated = ToolSchema.parse(args); // Type-safe!
Error Handling
import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js';
throw new McpError(
ErrorCode.InvalidParams,
'Detailed error message'
);
π Key Stats
- π 9 Comprehensive 2025 Guides - Modern architecture and patterns
- βοΈ 3 Cloudflare Integration Guides - Code Mode and remote deployment
- π 3 Core Documentation Files - Technical reference
- π» 5 Progressive Examples - 15 lines to 700+ line production server
- β 100+ Checklist Items - Production readiness validation
- π¬ Latest Research - Code2MCP, AutoMCP, MCP-Bench, Cloudflare Code Mode
π€ Contributing
This project is designed as a learning resource. We welcome:
- π Documentation improvements
- π§ Additional example tools and patterns
- π Showcase submissions of your MCP servers
- π Issue reports for unclear explanations
- π‘ Suggestions for new examples or guides
π License
MIT License - Feel free to use this for learning and building your own MCP servers.
π Additional Resources
Official Links
2025 Innovations
- Code2MCP - Auto-generate MCP servers
- MCP Bridge - RESTful proxy
- AutoMCP - OpenAPI to MCP
- MCP-Bench - Evaluation benchmark
Community
- Discord - Community support
- MCP Marketplace - Discover MCP servers
- GitHub Discussions - Q&A and examples
Other Frameworks
- FastMCP - Rapid MCP server development
- MCP Langchain - Langchain integration
- MCP Go SDK - Go implementation
β FAQ
How do I test my MCP server?
Use the MCP Inspector for visual testing or MCP CLI for command line:
npx @modelcontextprotocol/inspector npx tsx your-server.ts
Why aren't my tools showing up in Claude Desktop?
- Verify absolute paths in config file
- Check server logs for errors
- Restart Claude Desktop after config changes
- Ensure Zod schemas are properly converted to JSON Schema
How do I implement streaming responses?
See the advanced example (examples/03-advanced.ts) for streaming patterns with progress notifications.
What's the difference between Tools, Resources, and Prompts?
- Tools - Actions the LLM can execute (functions)
- Resources - Data the LLM can read (files, databases)
- Prompts - Templates the LLM can use (pre-written prompts)
Should I use FastMCP or HOW2MCP?
Use FastMCP for rapid development with abstractions. Use HOW2MCP to learn deep patterns and 2025 production features. Best: Use both together! FastMCP for speed, HOW2MCP for production patterns.
Build Production-Ready MCP Servers with 2025 Best Practices! π
