Prerequisites
Before installing FastMCP, ensure you have:- Node.js - Version 18 or higher recommended
- Package manager - npm, yarn, or pnpm
Install FastMCP
Install thefastmcp package using your preferred package manager:
@modelcontextprotocol/sdk- The official MCP SDKzod- 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
Using the CLI
FastMCP includes a CLI for testing and debugging servers:--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