frontmcp.dev · Learn · Reference · Examples · Playground · Blog
Write a tool. Ship a server.
Classes in, protocol out. FrontMCP handles transport, DI, sessions, auth and execution flow, and the same server runs locally and in production unchanged.
import 'reflect-metadata';
import { App, FrontMcp, Tool, ToolContext, z } from '@frontmcp/sdk';
@Tool({
name: 'add',
description: 'Adds two numbers together',
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 },
})
export default class Server {}
Start
npx frontmcp create my-app # new project (Node 24+)
npx frontmcp init # or add FrontMCP to an existing one
Then follow Learn on frontmcp.dev, or browse Tools, Resources, Prompts, Agents, Auth, Plugins, Tool UI, Testing and Deployment. Try it live in the Playground.
Packages
Install frontmcp (CLI) and @frontmcp/sdk. The rest is pulled in for you, or opt-in. Keep every @frontmcp/* package on the same version: they depend on each other at exact versions.
Internal, published so the above resolve: protocol, di, utils, lazy-zod.
PRs welcome: see CONTRIBUTING. Released under the Apache-2.0 license.