MCP.so
Sign In
Servers

MCP TypeScript Template 🚀

@cyanheads

Agent-native TypeScript framework for building MCP servers. Declarative definitions with auth, multi-backend storage, OpenTelemetry, and first-class support for Bun/Node/Cloudflare Workers.

Overview

What is MCP TypeScript Template 🚀?

The MCP TypeScript Template is an agent-native TypeScript framework and starter project for building MCP servers. It provides declarative tool, resource, and prompt definitions with built-in auth, multi-backend storage, OpenTelemetry observability, and first-class support for Bun, Node.js, and Cloudflare Workers. It is designed to let developers focus on domain logic while the framework handles infrastructure.

How to use MCP TypeScript Template 🚀?

Run bunx @cyanheads/mcp-ts-core init my-mcp-server to scaffold a new project, then cd my-mcp-server && bun install. Use the tool(), resource(), and prompt() builders to define your server’s capabilities and call createApp() in the entry point. Configuration is done via environment variables.

Key features of MCP TypeScript Template 🚀

  • Declarative tool, resource, and prompt builders with Zod schemas
  • Unified context for logging, storage, elicitation, and cancellation
  • Auth modes: none, JWT, or OAuth, checked automatically
  • Typed error contracts that publish in tools/list
  • Multi‑backend storage: in‑memory, filesystem, Supabase, Cloudflare D1/KV/R2
  • Observability with Pino logging and optional OpenTelemetry
  • Agent‑friendly developer experience with CLAUDE.md and Agent Skills

Use cases of MCP TypeScript Template 🚀

  • Build a search tool that queries an external API and returns structured results
  • Expose a database as MCP resources with automatic caching and access control
  • Create long‑running task tools for operations like data export or report generation
  • Deploy an MCP server on Cloudflare Workers using the same definitions

FAQ from MCP TypeScript Template 🚀

What runtimes does the template support?

It supports Bun (v1.3.0+), Node.js, and Cloudflare Workers. Scaffolded projects can use either the standard createApp() or createWorkerHandler() for Workers.

What transports and auth modes are available?

Transports: stdio (default) and http (port configurable via MCP_HTTP_PORT). Auth modes: none, jwt, or oauth (configured with MCP_AUTH_MODE and related variables).

Which storage backends can I use?

Storage providers: in‑memory (default), filesystem, supabase, cloudflare‑d1, cloudflare‑kv, and cloudflare‑r2. Switch via the STORAGE_PROVIDER_TYPE env var.

How do I define a tool with structured output?

Use the tool() builder with a Zod output schema. Structured content is available to clients that support it. Add a format() method to render markdown for clients that only read content[]. A linter (run via lint:mcp) checks parity between the two surfaces.

Can I deploy on Cloudflare Workers?

Yes. The framework provides createWorkerHandler(), which returns an ExportedHandler. Use the same tool, resource, and prompt definitions — only the entry point differs.

Tags

More from Developer Tools