📦
Fastmcp Openapi
this is demo app to create MCP server
0 installs
Trust: 34 — Low
Docs
Ask AI about Fastmcp Openapi
Powered by Claude · Grounded in docs
I know everything about Fastmcp Openapi. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Loading tools...
Reviews
Documentation
FastMCP OpenAPI
A simple Model Context Protocol (MCP) server that automatically generates tools from OpenAPI specifications using FastMCP.
Features
- Automatic Tool Generation: Converts OpenAPI endpoints into MCP tools automatically
- Flexible Input: Load OpenAPI specs from URLs or local files
- Simple CLI: Easy-to-use command-line interface with click
- Configurable: Customizable base URL, timeouts, and server names
Installation
Option 1: Direct GitHub URL (Easiest)
uvx git+https://github.com/jfouret/fastmcp-openapi.git --base-url https://api.example.com --openapi-url https://api.example.com/openapi.json
Option 2: Clone and Install
git clone https://github.com/jfouret/fastmcp-openapi.git
cd fastmcp-openapi
uv pip install -e .
Usage
Command Line Options
fastmcp-openapi --help
Required:
--base-url: Base URL for the API (e.g.,https://api.example.com)
OpenAPI Source (one required):
--openapi-url: URL to fetch the OpenAPI specification from--openapi-file: Local path to OpenAPI specification file
Optional:
--name: Custom name for the MCP server (default: "OpenAPI MCP Server")--timeout: Request timeout in seconds (default: 30.0)
Examples
From URL
fastmcp-openapi \
--base-url https://api.example.com \
--openapi-url https://api.example.com/openapi.json \
--name "My API Server"
From Local File
fastmcp-openapi \
--base-url https://api.example.com \
--openapi-file ./openapi.json \
--timeout 60.0
Using uvx (Recommended)
uvx git+https://github.com/jfouret/fastmcp-openapi.git \
--base-url https://api.example.com \
--openapi-url https://api.example.com/openapi.json
MCP Configuration
Add to your MCP client configuration:
{
"mcpServers": {
"my-api": {
"command": "uvx",
"args": [
"git+https://github.com/jfouret/fastmcp-openapi.git",
"--base-url", "https://api.example.com",
"--openapi-url", "https://api.example.com/openapi.json",
"--name", "My API Server"
]
}
}
}
How It Works
- Load OpenAPI Spec: Fetches the OpenAPI specification from a URL or loads from a local file
- Create HTTP Client: Sets up an HTTP client with the specified base URL
- Generate Tools: Uses FastMCP's
from_openapi()to automatically convert all API endpoints into MCP tools - Run Server: Starts the MCP server, making all API endpoints available as tools
Supported OpenAPI Features
FastMCP automatically handles:
- All HTTP Methods: GET, POST, PUT, DELETE, PATCH, etc.
- Path Parameters: Dynamic URL segments
- Query Parameters: URL query strings with proper serialization
- Request Bodies: JSON payloads for POST/PUT requests
- Headers: Custom headers and authentication
- Response Schemas: Type validation and documentation
Authentication
Configure authentication on the HTTP client by setting appropriate headers:
# For APIs requiring Bearer tokens, you can extend the server
# or configure authentication in your environment
Requirements
- Python 3.11+
- FastMCP 2.9.2+
- httpx 0.28.1+
- click 8.2.1+
License
MIT License
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
