Skip to main content

FastMCP

A TypeScript framework for building MCP (Model Context Protocol) servers capable of handling client sessions.
For a Python implementation, see FastMCP for Python.

Get Started

Installation

Install FastMCP and get your environment ready

Quickstart

Build your first MCP server in minutes

Core Concepts

Learn about tools, resources, and prompts

API Reference

Explore the complete API documentation

Key Features

Simple Definitions

Define tools, resources, and prompts with minimal boilerplate

Type-Safe Schemas

Use Zod, Valibot, or ArkType for parameter validation

Built-in Authentication

OAuth 2.1 with Google, GitHub, Azure, and custom providers

Session Management

Track sessions with IDs and maintain client state

Rich Content

Return images, audio, and embedded resources

Multiple Transports

stdio, HTTP streaming, SSE, and edge runtime support

Streaming Output

Stream partial results and report progress

Custom Routes

Add REST APIs, webhooks, and admin interfaces

Why FastMCP?

FastMCP is built on top of the official MCP SDK, providing an opinionated framework that eliminates boilerplate and handles common patterns automatically. When to use FastMCP: You want to build MCP servers quickly without dealing with low-level implementation details. When to use the official SDK: You need maximum control or have specific architectural requirements.

Quick 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",
});

API Integration

Connect LLMs to external APIs and services

Data Access

Provide structured access to databases and files

Automation

Build tools for workflow automation

Edge Deployment

Deploy to Cloudflare Workers or serverless platforms

Next Steps

1

Install FastMCP

Get started by installing the package in your project.Installation Guide →
2

Build Your First Server

Follow the quickstart to create a working MCP server.Quickstart →
3

Learn Core Concepts

Understand tools, resources, prompts, and sessions.Core Concepts →
4

Deploy to Production

Learn about deployment options and best practices.Deployment →

Build docs developers (and LLMs) love