Production-grade TypeScript template for Model Context Protocol (MCP) servers. Ships with declarative tools/resources, robust error handling, DI, easy auth, optional OpenTelemetry, and first-class support for both local and edge (Cloudflare Workers) runtimes.
# Add to your Claude Code skills
git clone https://github.com/cyanheads/mcp-ts-template
README.md
<div align="center">
<h1>mcp-ts-template</h1>
<p><b>Production-grade TypeScript template for building Model Context Protocol (MCP) servers. Ships with declarative tools/resources, robust error handling, DI, easy auth, optional OpenTelemetry, and first-class support for both local and edge (Cloudflare Workers) runtimes.</b>
<div>6 Tools • 1 Resource • 1 Prompt</div>
</p>
</div>
<div align="center">
</div>
✨ Features
Declarative Tools & Resources: Define capabilities in single, self-contained files. The framework handles registration and execution.
Elicitation Support: Tools can interactively prompt the user for missing parameters during execution, streamlining user workflows.
mcp-server
model-context-protocol
modelcontextprotocol
opentelemetry
otel
template
ts
vibe-coding
Robust Error Handling: A unified McpError system ensures consistent, structured error responses across the server.
Pluggable Authentication: Secure your server with zero-fuss support for none, jwt, or oauth modes.
Abstracted Storage: Swap storage backends (in-memory, filesystem, Supabase, SurrealDB, Cloudflare D1/KV/R2) without changing business logic. Features secure opaque cursor pagination, parallel batch operations, and comprehensive validation.
Graph Database Operations: Optional graph service for relationship management, graph traversals, and pathfinding algorithms (SurrealDB provider).
Full-Stack Observability: Get deep insights with structured logging (Pino) and optional, auto-instrumented OpenTelemetry for traces and metrics.
Dependency Injection: Built with tsyringe for a clean, decoupled, and testable architecture.
Service Integrations: Pluggable services for external APIs, including LLM providers (OpenRouter), text-to-speech (ElevenLabs), and graph operations (SurrealDB).
Rich Built-in Utility Suite: Helpers for parsing (PDF, YAML, CSV, frontmatter), formatting (diffs, tables, trees, markdown), scheduling, security, and more.