fastmcp
Verified Safeby jlowin
Overview
FastMCP is a Python framework for building and interacting with Model Context Protocol (MCP) servers. It provides client and server capabilities, enabling the creation of AI agents and services through definable tools, resources, and prompts. It supports various transports, authentication methods, logging, and background task execution, with strong integration for OpenAPI specifications.
Installation
fastmcp run <your_server_file.py>Environment Variables
- OPENAI_API_KEY
- FAST_MCP_LOG_LEVEL
- FAST_MCP_DOTENV_FILE
- FAST_MCP_SERVER_AUTH_CLIENT_ID
- FAST_MCP_SERVER_AUTH_CLIENT_SECRET
- FAST_MCP_SERVER_AUTH_TENANT_ID
- FAST_MCP_SERVER_AUTH_USER_POOL_ID
- FAST_MCP_SERVER_AUTH_BASE_URL
- FAST_MCP_SERVER_AUTH_REQUIRED_SCOPES
- HUE_BRIDGE_IP
- HUE_BRIDGE_USERNAME
- SURGE_URL
- SURGE_TOKEN
- DB_URI
- PG_USER
- PG_PASSWORD
- PG_HOST
- PG_PORT
- PG_DATABASE
- ATPROTO_HANDLE
- ATPROTO_PASSWORD
- ATPROTO_PDS_URL
- UV_PROJECT_DIR
Security Notes
The framework allows defining and executing arbitrary commands via StdioTransport (Python, Node, uv, uvx, npx). While this provides powerful extensibility, it shifts significant security responsibility to the developer regarding what commands are exposed and how input is sanitized. OAuth/authentication providers rely on environment variables for sensitive credentials (CLIENT_ID, CLIENT_SECRET, etc.), which is good practice. XSS prevention is implemented in HTML responses. Overall, it's designed to be secure when implemented carefully, but its capabilities necessitate developer vigilance.
Similar Servers
mcp-use
A full-stack framework for building Model Context Protocol (MCP) servers, MCP clients, and AI agents in both Python and TypeScript, supporting interactive UI widgets and robust debugging.
tmcp
Build Model Context Protocol (MCP) servers for AI agents, providing schema-agnostic tools, resources, and prompts, with optional OAuth 2.1 authentication and distributed session management.
mcp-interviewer
A Python CLI tool designed to evaluate, test, and generate reports on Model Context Protocol (MCP) servers to ensure compatibility and quality for LLM agent use cases.
Polymcp
A comprehensive toolkit and agent framework for building Model Context Protocol (MCP) servers and orchestrating them with Large Language Models (LLMs) across Python and TypeScript environments.