Requirements
The server entrypoint,@prefecthq/fastmcp-ts/server, runs on Node.js 22 or later — serving MCP depends on Node APIs like subprocesses and the filesystem.
The client entrypoint, @prefecthq/fastmcp-ts/client, runs on Node.js 22 or later and also bundles for the browser. Any bundler that honors the package’s browser field — Vite, webpack, esbuild, Rollup — produces a build with no Node built-ins, so a web app can talk to an MCP server over HTTP. The Node-only pieces, the stdio transport and filesystem token storage, load lazily and drop out of a browser build; authenticating a browser client uses a popup or redirect OAuth flow and web-backed token storage.
Install the package
fastmcp CLI as a self-contained binary:
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: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:
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.