# mcp-ts-core [Health: Active]

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

## Description
TypeScript framework for building MCP servers with declarative definitions and observability.

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

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

## Documentation

## What mcp-ts-core does

mcp-ts-core provides the application layer for building MCP servers in TypeScript. Your project supplies the domain logic, while the framework handles registration, request processing, authentication, storage, logging, and transport setup. It is designed for servers that expose APIs, datasets, or business workflows to AI agents.

Definitions are created in code and registered with `createApp()`. The available builders cover tools, resources, prompts, and interactive MCP Apps. Server instructions can be sent during initialization, and a skills directory can be exposed through the SEP-2640 Skills extension.

## How it works

A tool combines a name, description, input schema, output schema, and handler. Schemas use the framework's Zod export, allowing handlers and MCP clients to work from typed contracts. Definitions can also declare read-only annotations, expected errors, recovery guidance, and additional success metadata.

Handlers receive a context for operations such as enriching results, reporting a typed failure, requesting additional input, and accessing tenant-scoped state. Declared enrichment is published alongside the main result, while declared errors describe when a failure occurs and how an agent can recover. Tool contracts are advertised through `tools/list`, and definition linting checks the implementation against those contracts.

Results are supplied through both MCP result surfaces: structured JSON and text content. A custom `format()` function can render the text representation, while the framework keeps enrichment synchronized across both forms. Without a formatter, the text content uses JSON.

Resources map URI patterns to handlers. For example, an `items://{itemId}` resource can validate the `itemId` parameter and retrieve data from an application service. Cloudflare Workers use `createWorkerHandler()` with the same definitions from a separate entry point.

## Setup and configuration

New projects can be scaffolded with:

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

The scaffold contains source, build, and test configuration, agent instruction files, Agent Skills, and plugin metadata for Claude Code and Codex. Existing TypeScript projects can add the package with `bun add @cyanheads/mcp-ts-core`, then register definitions through `createApp()`.

Servers run on Bun, Node.js 24+, or Cloudflare Workers. A local HTTP process can be built and started with `bun run rebuild` and `bun run start:http`; the resulting Streamable HTTP endpoint is `http://127.0.0.1:3010/mcp`. Clients can also launch the compiled server over stdio with `bun /absolute/path/to/dist/index.js`.

Authentication scopes are declared on definitions and checked before handlers run under JWT or OAuth. State can use in-memory or filesystem storage, or configured Supabase and Cloudflare D1, KV, or R2 backends. DuckDB, Supabase, and the OpenTelemetry SDK are optional peer dependencies.

## Tools and capabilities

- Typed builders for tools, resources, prompts, and MCP Apps
- Input and output schemas using Zod
- Declared errors with retry and recovery guidance
- Result enrichment and custom text formatting
- stdio and Streamable HTTP transports
- JWT/OAuth scope checks
- Tenant-scoped storage with replaceable backends
- Structured logging and optional OpenTelemetry
- Definition linting, contract tests, and fuzz testing
- Agent Skills for design, testing, security review, releases, and maintenance

## Limitations and notes

The framework is infrastructure rather than a ready-made connector to a particular SaaS product or database. Application-specific handlers still need to call the APIs, datasets, or services that the server exposes.

MCP hosts may emphasize structured content, text content, or both. mcp-ts-core fills both surfaces, but custom formatters should include every output field; the `lint:mcp` format-parity rule checks this condition. Optional integrations require their corresponding peer dependencies to be installed.

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

