Skip to main content

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

Metadata

Release files for apitomcp 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for apitomcp 0.1.3
File Size Uploaded Provenance
apitomcp-0.1.3.tar.gz 6.3 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for apitomcp 0.1.3
File Interpreter ABI Platform
apitomcp-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 6.3 MB

Release files / apitomcp-0.1.3.tar.gz

Download URL apitomcp-0.1.3.tar.gz
Size 6.3 MB
Tags Source
SHA-256 checksum
How to use checksums
4097c5496b646d9ad9bd46df8dd7282dd35cd03063770373f286fcf112549884
BLAKE2b-256 checksum
How to use checksums
9c701fe44b411c977831e3441b75ebbf6a40be54d7140817a3cb035fae167195
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / apitomcp-0.1.3-py3-none-any.whl

Download URL apitomcp-0.1.3-py3-none-any.whl
Size 43.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
87b83e2285a9d2003e773a8f592180e2d72020ad9215f0c3e228451e71c8f27c
BLAKE2b-256 checksum
How to use checksums
b10f856b0ab7bfbca33bb0f5ff44a2a0ed7753e7d8d63c2764b2a4319bd5a546
Upload date
Uploaded using Trusted Publishing?
What is 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}

Security for apitomcp 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page