Convert any API documentation into an MCP server
Project description
api-to-mcp
Convert any API documentation into an MCP server for Cursor in minutes.
Point it at API docs, and it scrapes, generates an OpenAPI spec, and creates a fully functional MCP server you can chat with.
Quickstart
# Install
pip install apitomcp
# First-time setup (configure your LLM provider)
apitomcp init
# Generate an MCP server from any API docs
apitomcp generate
# Install to Cursor
apitomcp install
Restart Cursor and start chatting with your API.
What It Does
- Scrapes API documentation (handles multi-page docs, finds all endpoints)
- Generates OpenAPI 3.1 specs using LLMs (parallel processing for speed)
- Detects authentication requirements (OAuth2, Bearer tokens, API keys)
- Creates MCP servers that Cursor can use as tools
- Handles OAuth2 token refresh automatically
Features
- Multi-page scraping - Crawls linked pages to find all API endpoints
- Parallel LLM processing - Generates specs for many endpoints simultaneously
- Smart auth detection - Analyzes docs to detect OAuth2, Bearer, or API key auth
- OAuth2 token refresh - Automatically refreshes expired tokens
- Interactive CLI - Clean prompts for configuration
- Multiple LLM providers - OpenRouter, Anthropic, OpenAI, Gemini
Commands
| Command | Description |
|---|---|
apitomcp init |
First-time setup - configure LLM provider and API key |
apitomcp generate |
Generate an MCP server from API documentation |
apitomcp list |
Show all generated servers |
apitomcp install |
Install servers to Cursor |
apitomcp delete |
Remove a generated server |
apitomcp auth |
Update LLM settings |
apitomcp output |
Export server files to current directory |
apitomcp run <name> |
Run a server (used by Cursor, not manually) |
Example
$ apitomcp generate
# Enter: https://developer.spotify.com/documentation/web-api
# It scrapes 150+ pages, finds 99 API operations
# Generates OpenAPI spec in parallel
# Detects OAuth2 client credentials auth
# Prompts for your Spotify client ID and secret
$ apitomcp install
# Adds the server to Cursor's MCP config
# Restart Cursor, then ask: "Get me Taylor Swift's top tracks"
How It Works
API Docs URL
│
▼
┌─────────────┐
│ Scraper │ BeautifulSoup + MarkItDown
│ (multi-page)│ Extracts endpoints & auth info
└─────────────┘
│
▼
┌─────────────┐
│ Generator │ LLM generates OpenAPI specs
│ (parallel) │ for each endpoint
└─────────────┘
│
▼
┌─────────────┐
│ Validator │ Validates against OpenAPI 3.1
│ │ Auto-retries on errors
└─────────────┘
│
▼
┌─────────────┐
│ Runner │ FastMCP creates tools from spec
│ │ Handles auth & token refresh
└─────────────┘
Supported LLM Providers
- OpenRouter - Access to Claude, GPT, Gemini models
- Anthropic - Claude Sonnet, Haiku, Opus
- OpenAI - GPT-5.2, GPT-5.2 Mini
- Gemini - Gemini 3 Pro, Gemini 2.5 Flash
Requirements
- Python 3.13+
- API key for one of the supported LLM providers
Configuration
Config is stored in ~/.apitomcp/:
config.json- LLM provider settingsservers/<name>/- Generated server files
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file apitomcp-0.1.1.tar.gz.
File metadata
- Download URL: apitomcp-0.1.1.tar.gz
- Upload date:
- Size: 34.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95492bb137711fae543967c48392b37eb6daade463c76b1c8cdce20c777150a5
|
|
| MD5 |
bf3baf982af2b5ed3ebf1532d8e5ae74
|
|
| BLAKE2b-256 |
e92930fab9410d699f4db8d6ac3c226ee627c5a934644ab4ee8da548ee19ee59
|
File details
Details for the file apitomcp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: apitomcp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 39.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98a89ca988838b50ac1e1cb5db1aab1a2f906b1c5b16aed12bb568a49ae68748
|
|
| MD5 |
c80e4903516f4f50acb8ab193eeff646
|
|
| BLAKE2b-256 |
413b2b0599127b1de00afea7e19ed509ba2691e9c228d70d5c2ce6722e48becf
|