Back to MCP Catalog

Fast MCP Server

Developer ToolsTypeScript
A TypeScript framework for building Model Context Protocol servers
Available Tools

add

Add two numbers

ab

FastMCP is a robust TypeScript framework designed for building Model Context Protocol (MCP) servers with client session handling capabilities. It provides a streamlined approach to defining tools, resources, and prompts while offering comprehensive features like authentication, session management, and support for various content types including images and audio. With built-in error handling, logging, and multiple transport options, FastMCP simplifies the development of MCP servers for AI applications.

Overview

FastMCP is a TypeScript framework that makes it easy to build Model Context Protocol (MCP) servers. It provides a clean, type-safe API for defining tools that can be used by AI models to interact with your application.

Installation

You can install FastMCP using npm, yarn, or pnpm:

npm install fastmcp
# or
yarn add fastmcp
# or
pnpm add fastmcp

Basic Usage

Creating a simple MCP server with FastMCP is straightforward:

import { FastMCP } from "fastmcp";
import { z } from "zod"; // Or any validation library that supports Standard Schema

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

Transport Options

FastMCP supports multiple transport types:

  1. stdio - For local development and testing
  2. SSE (Server-Sent Events) - For remote communication over HTTP
  3. HTTP Streaming - For more efficient remote communication

Setting up SSE transport:

server.start({
  transportType: "sse",
  sse: {
    endpoint: "/sse",
    port: 8080,
  },
});

Setting up HTTP Streaming:

server.start({
  transportType: "httpStream",
  httpStream: {
    endpoint: "/stream",
    port: 8080,
  },
});

Advanced Features

FastMCP includes many advanced features:

  • Authentication: Secure your MCP server with custom authentication logic
  • Sessions: Maintain state across multiple client interactions
  • Content Types: Return images, audio, and other content types
  • Logging: Comprehensive logging for debugging
  • Error Handling: Graceful error handling and reporting
  • Progress Notifications: Provide feedback during long-running operations
  • Typed Server Events: Type-safe server event handling
  • Prompt Argument Auto-completion: Improve developer experience

Testing and Debugging

FastMCP provides CLI tools for testing and debugging your MCP servers:

# Test a server using CLI
npx fastmcp dev path/to/server.ts

# Debug a server using MCP Inspector
npx fastmcp inspect path/to/server.ts

Schema Validation

FastMCP supports multiple schema validation libraries through the Standard Schema specification:

  • Zod
  • ArkType
  • Valibot

Choose the one that best fits your project's needs.

Related MCPs

Apple Shortcuts
Developer ToolsJavaScript

Control Apple Shortcuts automations from AI assistants

Clojars Dependency Lookup
Developer ToolsJavaScript

Fetch dependency information from Clojars, the Clojure community's artifact repository

Simple Timeserver
Developer ToolsPython

Provides Claude with current time and timezone information

About Model Context Protocol

Model Context Protocol (MCP) allows AI models to access external tools and services, extending their capabilities beyond their training data.

Generate Cursor Documentation

Save time on coding by generating custom documentation and prompts for Cursor IDE.