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.

apitomcp generate demo

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

Then chat with your API in Cursor:

Using TheMovieDB MCP server in Cursor

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-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

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.3.tar.gz (6.3 MB 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.3-py3-none-any.whl (43.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: apitomcp-0.1.3.tar.gz
  • Upload date:
  • Size: 6.3 MB
  • 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.3.tar.gz
Algorithm Hash digest
SHA256 4097c5496b646d9ad9bd46df8dd7282dd35cd03063770373f286fcf112549884
MD5 b9f5d96ecbd82d9324b9c85e030a1ef3
BLAKE2b-256 9c701fe44b411c977831e3441b75ebbf6a40be54d7140817a3cb035fae167195

See more details on using hashes here.

File details

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

File metadata

  • Download URL: apitomcp-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 43.2 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 87b83e2285a9d2003e773a8f592180e2d72020ad9215f0c3e228451e71c8f27c
MD5 24ba296197932d25d08b800372e29aa8
BLAKE2b-256 b10f856b0ab7bfbca33bb0f5ff44a2a0ed7753e7d8d63c2764b2a4319bd5a546

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