Skip to main content

Requirements

FastMCP TypeScript runs on Node.js 22 or later. There is no browser support.

Install the package

npm install @prefecthq/fastmcp-ts
The package exposes two subpath entrypoints, so you only pull in what you use:
import { FastMCP } from '@prefecthq/fastmcp-ts/server'
import { Client } from '@prefecthq/fastmcp-ts/client'
It also installs the fastmcp CLI as a self-contained binary:
npx fastmcp --help

Schema library

Input and output schemas work with any Standard Schema-compatible validation library — Zod, Valibot, ArkType, and others. Most examples in these docs use Zod:
npm install zod

Optional peer dependencies

The client’s sampling adapters forward LLM sampling requests to your AI provider. Each adapter requires its provider SDK, declared as an optional peer dependency — install only the one you use:
AdapterInstall
AnthropicSamplingAdapternpm install @anthropic-ai/sdk
OpenAISamplingAdapternpm install openai
GoogleSamplingAdapternpm install @google/genai
Nothing breaks if these are absent — the adapters import provider types with import type, so there is no runtime cost or error unless you actually instantiate one.

Next steps

Quickstart

Build and run your first MCP server.