Skip to main content

Universal API to MCP Server Converter with LangGraph Orchestration

Project description

API2MCP

Universal API to MCP Server Converter with LangGraph Orchestration

CI PyPI version Python versions License: MIT Coverage

Convert any REST/GraphQL API into a fully functional MCP (Model Context Protocol) server, and orchestrate intelligent multi-API workflows using LangGraph.

Features

  • 🔄 Automatic Conversion: OpenAPI, GraphQL, Postman → MCP Server
  • 🔐 Enterprise Security: OAuth 2.0, API keys, secret management
  • 🧠 Intelligent Orchestration: LangGraph-powered multi-API workflows
  • 💾 State Persistence: Checkpoint-based workflow recovery
  • 🔌 Extensible: Plugin architecture for custom integrations

Quick Start

# Install
pip install api2mcp

# Generate MCP server from OpenAPI spec
api2mcp generate --spec openapi.yaml --output ./server

# Run the server
api2mcp serve ./server

LangGraph 1.0 Orchestration

from api2mcp import MCPToolRegistry, PlannerGraph
from langchain_anthropic import ChatAnthropic
from langgraph.checkpoint.sqlite import SqliteSaver

# Register MCP servers
registry = MCPToolRegistry()
await registry.connect_server("github", github_config)
await registry.connect_server("jira", jira_config)

# Create orchestrator with official checkpointer
orchestrator = PlannerGraph(
    model=ChatAnthropic(model="claude-sonnet-4-5-20250929"),
    tool_registry=registry,
    api_names=["github", "jira"],
    checkpointer=SqliteSaver.from_conn_string("workflows.db"),
    execution_mode="mixed"  # parallel for independent steps
)

# Run complex workflow
result = await orchestrator.run(
    "Sync all GitHub bugs to Jira project SUPPORT"
)

Documentation

Development

Prerequisites

  • Python 3.11+
  • pip or any PEP 517-compatible build tool

Setup

# Clone and install in editable mode with dev dependencies
git clone https://github.com/manavghosh/api2mcp.git
cd api2mcp
pip install -e ".[dev]"

Optional extras

pip install -e ".[dev,graphql]"    # add GraphQL parser support
pip install -e ".[dev,postgres]"   # add PostgreSQL checkpointer
pip install -e ".[dev,docs]"       # add MkDocs documentation tooling

Running tests

pytest                        # run full test suite
pytest tests/unit/            # unit tests only
pytest -m "not e2e"           # skip end-to-end tests
pytest --no-cov               # skip coverage (faster)

Linting and type-checking

ruff check .                  # lint
ruff format .                 # format
mypy src/                     # type-check

Building the package

pip install build
python -m build               # produces dist/*.whl and dist/*.tar.gz

Building the documentation site

pip install -e ".[docs]"
mkdocs serve                  # live-reload preview at http://127.0.0.1:8000
mkdocs build --strict         # static build into site/

Project Structure

api2mcp/
├── src/api2mcp/         # Source code
│   ├── orchestration/   # LangGraph integration
│   │   ├── adapters/    # MCP-to-LangChain adapters
│   │   ├── graphs/      # Workflow patterns
│   │   └── state/       # State management
│   └── ...
├── tests/               # Test suite
├── docs/                # Documentation source (MkDocs)
├── examples/            # Usage examples
└── demo/                # Runnable demos

Acknowledgements

API2MCP was built with the assistance of Claude (Anthropic). The product vision, architecture decisions, specifications, and every design trade-off were directed by the project author. Claude served as the implementation tool — the same way a framework or a compiler is a tool.

Key open source projects that power API2MCP:

Project Role
LangGraph Orchestration graph engine
MCP SDK Model Context Protocol runtime
Pydantic Data validation
httpx Async HTTP client
Click CLI framework
Rich Terminal output
MkDocs Material Documentation site

Contributing

Contributions are welcome! Please read CONTRIBUTING.md and our Code of Conduct before submitting a pull request.

License

MIT License - see LICENSE for details.

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

api2mcp-0.1.0.tar.gz (547.2 kB view details)

Uploaded Source

Built Distribution

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

api2mcp-0.1.0-py3-none-any.whl (281.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: api2mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 547.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for api2mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9a2a39e1707aab0b5b2a21ac716e1b9fb125823e7b64bfab272ab98f0806ec3f
MD5 c1af8a355091c7ef3037cd344f2e803d
BLAKE2b-256 c9e0b40ea35791c590609d9d777589d916d58d2f60a09cbae0ca81f4d9349959

See more details on using hashes here.

Provenance

The following attestation bundles were made for api2mcp-0.1.0.tar.gz:

Publisher: release.yml on manavghosh/api2mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: api2mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 281.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for api2mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3811115c0f2a1ee50fd1cecb5f6ec0f71ae4fd1a3e33a5836473d559fa323834
MD5 ee27020fa9da208ef28aeffeb92330bf
BLAKE2b-256 0424fd2408c1247c07592fdcd4594dd0d5f01e986e32722d35b066f128b6b984

See more details on using hashes here.

Provenance

The following attestation bundles were made for api2mcp-0.1.0-py3-none-any.whl:

Publisher: release.yml on manavghosh/api2mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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