@frontmcp/sdk
The core of FrontMCP, a TypeScript framework for building Model Context Protocol (MCP) servers. You write tools, resources and prompts as decorated classes; the SDK handles the protocol, the transports, sessions, authentication, dependency injection and the request pipeline. The same server runs on your machine, in Docker, on Vercel or AWS Lambda, and on Cloudflare Workers.
Use it to build an MCP server, or to run one inside another program. The
frontmcp CLI creates, runs, tests and builds the project around it.
Install
Start a new project with the CLI, which sets everything up:
npx frontmcp create my-app
Or add the SDK to a project you already have:
npm install @frontmcp/sdk reflect-metadata
npm install -D frontmcp typescript @types/node@^24
npx frontmcp init
FrontMCP needs Node.js 24 or later. frontmcp init turns on experimentalDecorators and emitDecoratorMetadata in
tsconfig.json. Import reflect-metadata once, at the top of your entry file, before anything from FrontMCP.
npm and pnpm install the SDK's required peer dependencies (express, cors, content-type and raw-body) for you;
with Yarn, add them yourself. The optional ones turn on features:
| Install | To |
|---|---|
@frontmcp/storage-sqlite | Keep sessions, tasks and events in SQLite |
@frontmcp/observability, @opentelemetry/api, @opentelemetry/sdk-trace-base | Trace and log requests with OpenTelemetry |
openai or @anthropic-ai/sdk | Run an @Agent on OpenAI or Anthropic models |
@enclave-vm/core | Run dynamic jobs (scripts) in a sandbox |
A server in one file
import 'reflect-metadata';
import { App, FrontMcp, Tool, ToolContext, z } from '@frontmcp/sdk';
@Tool({
name: 'add',
description: 'Add two numbers',
inputSchema: { a: z.number(), b: z.number() },
})
class AddTool extends ToolContext {
async execute(input: { a: number; b: number }) {
return input.a + input.b;
}
}
@App({ id: 'calc', name: 'Calculator', tools: [AddTool] })
class CalcApp {}
@FrontMcp({
info: { name: 'Demo', version: '0.1.0' },
apps: [CalcApp],
http: { port: 3000, entryPath: '/mcp' },
})
export default class Server {}
Save it as src/main.ts and run npx frontmcp dev. The server reloads when you edit it, and answers MCP requests at
http://localhost:3000/mcp (at / without entryPath). Try it with the MCP Inspector, npx frontmcp inspector, or
add it to Claude Code:
claude mcp add --transport http demo http://localhost:3000/mcp
A tool is a class: @Tool describes it to the model, inputSchema validates its input with Zod
(the SDK exports z), and execute returns the result. An @App groups tools, resources, prompts and providers, and
@FrontMcp is the server. The Quick Start walks through each piece.
What the SDK covers
| Area | What you use | Docs |
|---|---|---|
| Server and apps | @FrontMcp, @App | Server, Apps |
| What clients call | @Tool, @Resource, @ResourceTemplate, @Prompt, @Skill | Tools, Resources, Prompts, Skills |
| Work that takes time | @Agent, @Job, @Workflow, background tasks | Agents, Jobs, Workflows, Tasks |
| Your own code | @Provider (dependency injection), hooks, @Plugin, @Adapter | Providers, Hooks, Plugins |
| Who may call | Auth modes (public, static keys, transparent JWT, local or remote OAuth), sessions, authorities | Authentication |
| Protocol | Every MCP revision from 2024-11-05 to 2026-07-28 on one endpoint, chosen per request | Protocol versions |
| Running it | Streamable HTTP or stdio; in process with create(); as tools for OpenAI, Claude, LangChain and the Vercel AI SDK with connect*() | Deployment, create(), connect() |
The SDK reference lists every decorator, context method and option.
Compared with other frameworks
TypeScript MCP server frameworks for production compares FrontMCP with the official TypeScript SDK, FastMCP, mcp-framework, mcp-use, ViteMCP and xmcp, on auth, testing, protocol support and deployment. To move a server over, see Migrate from the TypeScript SDK and Migrate from FastMCP. Longer guides and measurements are on the blog.
Related packages
frontmcp— the CLI:create,dev,build,test@frontmcp/testing— end-to-end tests for a server@frontmcp/adapters— generate tools from an OpenAPI spec@frontmcp/auth— the authentication layer the SDK uses- Plugins:
@frontmcp/plugin-cache,@frontmcp/plugin-remember,@frontmcp/plugin-approval,@frontmcp/plugin-codecalland more @frontmcp/uiand@frontmcp/react— widgets for tool results, and React hooks for a FrontMCP server
Keep every @frontmcp/* package on the same version: they depend on each other at exact versions.
Contributing
Source: libs/sdk. Issues and pull requests are welcome;
see CONTRIBUTING.md.
License
Apache-2.0. See LICENSE.