Skip to main content

Prerequisites

Before installing FastMCP, ensure you have:
  • Node.js - Version 18 or higher recommended
  • Package manager - npm, yarn, or pnpm

Install FastMCP

Install the fastmcp package using your preferred package manager:
This will install FastMCP along with its core dependencies:
  • @modelcontextprotocol/sdk - The official MCP SDK
  • zod - For schema validation (you can also use ArkType or Valibot)
  • Additional runtime dependencies for HTTP streaming and session management

Optional dependencies

Depending on your use case, you may want to install additional packages:

For OAuth/JWT authentication

If you plan to use OAuth authentication with JWT token verification:

For Valibot schema validation

If you prefer Valibot over Zod for schema validation:

For ArkType schema validation

If you prefer ArkType over Zod for schema validation:

Verify installation

Create a simple test file to verify FastMCP is installed correctly:
test.ts
Run the file:
If you see “FastMCP installed successfully!”, you’re ready to build your first MCP server.

Using the CLI

FastMCP includes a CLI for testing and debugging servers:
The CLI supports various options:
  • --transport - Choose transport type (stdio, http-stream)
  • --port - Set HTTP port (default: 8080)
  • --stateless - Enable stateless mode for serverless deployments

Project setup

For a complete boilerplate with TypeScript configuration and best practices:

Next steps

Quickstart

Create your first MCP server

Core concepts

Learn about tools, resources, and prompts