# mcp-ts-template [Health: Active]

**Category:** 💻 Developer Tools  
**Repository:** https://github.com/cyanheads/mcp-ts-template  
**GitHub Stars:** 155  
**npm Downloads (last month):** 85407  
**Views:** 3  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/mcp-ts-template

## Description
A production-grade TypeScript template for scalable MCP servers with built-in observability.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `bunx` (confidence: high):

```json
"mcpServers": {
  "mcp-ts-template": {
    "command": "bunx",
    "args": ["@cyanheads/mcp-ts-core"]
  }
}
```

## Documentation

## What mcp-ts-template does

mcp-ts-template is a TypeScript scaffold built around `@cyanheads/mcp-ts-core`, an agent-focused framework for creating MCP servers. The project is intended to connect an AI agent to an API, dataset, or workflow through MCP while leaving domain-specific behavior in the application code.

The framework supports typed definitions for tools, resources, prompts, and interactive MCP Apps. Tool definitions can include input and output schemas, read-only annotations, enriched results, declared failure modes, recovery guidance, and custom text formatting. Resources expose application data through URI templates, while server instructions and optional skills help clients understand how to use the available capabilities.

## How it works

A generated project registers its definitions with `createApp()`. A tool combines a name, description, Zod-based schema, and handler; the handler can use the request context to add result enrichment, return structured failures, request additional user or client input, and access tenant-scoped state. The framework advertises tool contracts through `tools/list` and can lint definitions against their declared behavior.

Results are emitted as both structured JSON and text content so clients that prefer either MCP surface receive equivalent data. A custom `format()` function controls the text representation, and the format-parity lint rule checks that output fields are represented there. Declared errors carry recovery information, and tool failures include the request ID associated with server logs.

Servers can use stdio for local client launches or Streamable HTTP at an MCP endpoint. Bun and Node.js deployments use the normal application entry point; Cloudflare Workers use `createWorkerHandler()` with the same definitions from a separate entry point.

## Setup and configuration

Create a scaffold with:

```bash
bunx @cyanheads/mcp-ts-core init my-mcp-server
cd my-mcp-server
bun install
```

For an existing TypeScript project, install the core package with `bun add @cyanheads/mcp-ts-core` and register definitions through `createApp()`. The generated project includes source, build, and test configuration, agent guidance files, Agent Skills, and plugin metadata for Claude Code and Codex.

Run `bun run rebuild` followed by `bun run start:http` to serve over HTTP. Clients can connect to `http://127.0.0.1:3010/mcp`, or launch the compiled application over stdio with `bun /absolute/path/to/dist/index.js`. The supported runtimes are Bun, Node.js 24 or newer, and Cloudflare Workers.

Authentication is configured per definition with scopes under JWT or OAuth. State is tenant-scoped and can use in-memory or filesystem storage, Supabase, or Cloudflare D1, KV, and R2. DuckDB, Supabase, and the OpenTelemetry SDK are optional peer dependencies.

## Tools and capabilities

- Build typed tools with Zod input and output schemas.
- Register URI-based resources and reusable prompts.
- Add interactive MCP Apps and server instructions.
- Declare errors with retry and recovery guidance.
- Enrich results without mixing metadata into domain return values.
- Emit matching structured and text result surfaces.
- Use stdio, Streamable HTTP, or Cloudflare Workers transports.
- Add structured logging and optional OpenTelemetry.
- Run definition linting, contract tests, and fuzz tests.
- Serve root skills through the SEP-2640 Skills extension.

## Limitations and notes

The scaffold supplies runtime infrastructure, but application-specific tools and handlers remain the developer’s responsibility. Optional integrations require separate installation. The framework’s package-upgrade workflow can update the core dependency and synchronize its Agent Skills through the `maintenance` skill.

_Full upstream README: https://allmcps.com/mcp/mcp-ts-template/readme_

