FastMCP is a TypeScript framework for building MCP servers. It provides HTTP streaming, SSE, embedded content support, and edge runtime options. Latest releases include v4.12.4 with bug fixes and v4.12.3 prior updates.
Collecting history — the radar snapshots this repo daily. The trend line appears after 3 days of data (1 so far).
What it is
A TypeScript framework for building MCP servers capable of handling client sessions. It includes features such as authentication, headers through context, session tracking, image/audio content support, logging, error handling, HTTP streaming (with SSE compatibility), HTTPS, CORS, custom HTTP routes, edge runtime support, stateless mode, and an in-memory transport for unit testing.
How it works
The library exposes a FastMCP class to create and start an MCP server with a given configuration (name, version, authentication). It supports multiple transports (stdio, httpStream, SSE), and can connect HTTP streaming or SSE clients depending on transport. It provides a getApp() to add custom HTTP routes via an underlying Hono app and includes built-in utilities for content blocks (image, audio) and resource embedding. It can be used in edge environments via EdgeFastMCP and Cloudflare Workers integration. It includes a Quickstart demonstrating server creation, adding a tool, and starting with transportType: "stdio". It also shows usage for HTTP streaming and HTTPS with SSL options, as well as CORS customization.
Getting started
Install with:
npm install fastmcp
Quickstart example:
import { FastMCP } from "fastmcp";
import { z } from "zod";
const server = new FastMCP({
name: "My Server",
version: "1.0.0",
});
server.addTool({
name: "add",
description: "Add two numbers",
parameters: z.object({
a: z.number(),
b: z.number(),
}),
execute: async (args) => {
return String(args.a + args.b);
},
});
server.start({
transportType: "stdio",
});
Test commands:
git clone https://github.com/punkpeye/fastmcp.git
cd fastmcp
pnpm install
pnpm build
# Test the addition server example using CLI:
npx fastmcp dev src/examples/addition.ts
# Test the addition server example using MCP Inspector:
npx fastmcp inspect src/examples/addition.ts
Remote Server Options
server.start({
transportType: "httpStream",
httpStream: { port: 8080 }
});
For SSE:
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
HTTPS support:
server.start({
transportType: "httpStream",
httpStream: {
port: 8443,
sslCert: "./path/to/cert.pem",
sslKey: "./path/to/key.pem",
sslCa: "./path/to/ca.pem",
},
});
CORS customization example:
server.start({
transportType: "httpStream",
httpStream: {
port: 8080,
cors: {
origin: "http://localhost:3000",
allowedHeaders: ["Content-Type", "Authorization", "Accept", "Mcp-Session-Id", "Mcp-Protocol-Version", "Last-Event-Id", "X-Custom-Header"],
credentials: true
}
},
});
Custom HTTP routes:
const app = server.getApp();
app.get("/api/users", async (c) => {
return c.json({ users: [] });
});
Edge Runtime:
import { EdgeFastMCP } from "fastmcp/edge";
const server = new EdgeFastMCP({ name: "My Edge Server", version: "1.0.0" });
export default server;
Recent releases
- v4.12.4 (2026-08-04): Bug Fixes — add timeout to image and audio content fetch
- v4.12.3 (2026-08-04): Bug Fixes — allow contents write
- v4.12.2 (2026-08-01): Bug Fixes — auth: use timing-safe comparison for JWT and consent signatures
- v4.12.1 (2026-07-27): Bug Fixes — export SessionError and FastMCPError from the package root
- v4.12.0 (2026-07-25): Features — add FastMCP.connect for custom transports
Traction
3246 stars, 300 forks, 22 open issues
Behind the repo
Not provided
Caveats
License: MIT Created: 2024-12-27 Last push: 2026-08-04






