Universal API to MCP Server Converter with LangGraph Orchestration
Convert any REST/GraphQL API into a fully functional MCP (Model Context Protocol) server, and orchestrate intelligent multi-API workflows using LangGraph.
API2MCP v0.1.0 is a complete framework, not a preview. Here's what's available today:
Core Pipeline
- OpenAPI 3.0/3.1, Swagger 2.0, GraphQL SDL, and Postman Collection parsers
- MCP Tool Generator with full JSON Schema type mapping
- Streamable HTTP and stdio transports (MCP spec 2025-03-26 compliant)
Security & Infrastructure
- Authentication: API key, Bearer, Basic, OAuth 2.0 (client credentials + PKCE)
- Secret management: environment variables, OS keychain, HashiCorp Vault, AWS Secrets Manager, encrypted file store
- Input validation: SQL injection and command injection protection
- Rate limiting (token bucket, per-tool configurable), circuit breaker, connection pooling, response caching (memory and Redis)
LangGraph Orchestration
- ReactiveGraph, PlannerGraph, ConversationalGraph
- MCP Tool Adapter (MCP β LangChain StructuredTool) with colon namespacing
- Checkpointing: MemorySaver, SqliteSaver, PostgresSaver
- End-to-end streaming via LangGraph astream_events v2
- Multi-model support: Anthropic, OpenAI, Google Gemini
Developer Experience
- Interactive setup wizard (
api2mcp wizard) - Hot reload dev server (
api2mcp dev) - In-process testing framework (MCPTestClient, CoverageReporter)
- VS Code integration (launch configs, tasks, schema validation)
- Plugin system with lifecycle hooks, template registry, CLI export and diff commands
- π 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
# Install
pip install api2mcp
# Generate MCP server from OpenAPI spec
api2mcp generate --spec openapi.yaml --output ./server
# Run the server
api2mcp serve ./serverfrom 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"
)- Python 3.11+
- pip or any PEP 517-compatible build tool
# Clone and install in editable mode with dev dependencies
git clone https://github.com/manavghosh/api2mcp.git
cd api2mcp
pip install -e ".[dev]"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 toolingpytest # 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)ruff check . # lint
ruff format . # format
mypy src/ # type-checkpip install build
python -m build # produces dist/*.whl and dist/*.tar.gzpip install -e ".[docs]"
mkdocs serve # live-reload preview at http://127.0.0.1:8000
mkdocs build --strict # static build into site/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
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 |
Contributions are welcome! Please read CONTRIBUTING.md and our Code of Conduct before submitting a pull request.
MIT License - see LICENSE for details.
API2MCP is an independent personal project created and maintained solely by Manav Ghosh in a personal capacity. It is not affiliated with, sponsored by, endorsed by, or in any way associated with any current or former employer, client, or organisation. All design decisions, source code, documentation, and expressed opinions are those of the author alone and do not represent the views or intellectual property of any third party.