Skip to main content

Convert any API documentation into an MCP server

Project description

api-to-mcp

Python PyPI License

Convert any API documentation into an MCP server in minutes.

Point it at API docs, and it scrapes, generates an OpenAPI spec, creates a fully functional MCP server you can chat with, and installs it to Cursor or Claude Desktop.

Installation

pip install apitomcp

Or with uv:

uv pip install apitomcp

Quickstart

# Install
pip install apitomcp

# First-time setup (configure your LLM provider)
apitomcp init

# Generate an MCP server from any API docs
apitomcp generate

Restart Cursor/ Claude Desktop 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 or Claude Desktop
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 (typically used by Cursor or Claude Desktop, 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

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
  • Anthropic
  • OpenAI
  • Gemini

Requirements

  • Python 3.10+
  • 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

Contributing

Contributions are welcome! If you find a bug or have a feature request, please open an issue. Pull requests are also appreciated—I'll review them as time allows.

Author

Built by @andrew_masek_

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.2.tar.gz (260.4 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.2-py3-none-any.whl (42.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: apitomcp-0.1.2.tar.gz
  • Upload date:
  • Size: 260.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for apitomcp-0.1.2.tar.gz
Algorithm Hash digest
SHA256 acc60a130fb95b98e0838ec88ee68c5a02b1c9f6a7aee59689eb1728cd728814
MD5 2831df21c15352785a584680e602840d
BLAKE2b-256 4c3f795908d6595af44636ef09ad1d7eb32a26caed5779474023f54b94528490

See more details on using hashes here.

File details

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

File metadata

  • Download URL: apitomcp-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 42.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for apitomcp-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8b6dcd51ae198af3429a13409d1a7ce1887aa7a96595052bb492d788e877e45a
MD5 8fb6b22b7cb0de91fb5708e026b6ba3d
BLAKE2b-256 b76a7b2b84dc32a2236161228ebb69bf159aaad349f89a428e4eb30cbfd20057

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