Skip to main content

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

  1. Scrapes API documentation (handles multi-page docs, finds all endpoints)
  2. Generates OpenAPI 3.1 specs using LLMs (parallel processing for speed)
  3. Detects authentication requirements (OAuth2, Bearer tokens, API keys)
  4. Creates MCP servers that Cursor can use as tools
  5. 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 settings
  • servers/<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

apitomcp-0.1.0.tar.gz (34.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

apitomcp-0.1.0-py3-none-any.whl (39.4 kB view details)

Uploaded Python 3

File details

Details for the file apitomcp-0.1.0.tar.gz.

File metadata

  • Download URL: apitomcp-0.1.0.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

Hashes for apitomcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 db0409d8b9c6bf8222faa814f73c9f96176578dccbfba5bb3ac94e8dd89d9db8
MD5 d5e2a1896a7b45692d7136035f159e82
BLAKE2b-256 03673cd48a7727d308b1f5e89d9ec0c5276af66ac0a182b2a795ecca8d8b4fa7

See more details on using hashes here.

File details

Details for the file apitomcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: apitomcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 39.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for apitomcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 48b26c8586193fbb60277ab1b6f0c20ac5c46ee67faf26a3a15e9ed2f2bfcf6b
MD5 23c26258c4ae1a546d4d64907f967611
BLAKE2b-256 84e425c2bc538fc740ed1d8bac6f564441cc620534aefb3264805aa1535ed0c7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page