Metadata-Version: 2.4
Name: api2mcp
Version: 0.1.0
Summary: Universal API to MCP Server Converter with LangGraph Orchestration
Project-URL: Homepage, https://github.com/manavghosh/api2mcp
Project-URL: Documentation, https://manavghosh.github.io/api2mcp
Project-URL: Repository, https://github.com/manavghosh/api2mcp
Author-email: Manav Ghosh <manavghosh@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: api,converter,graphql,langgraph,mcp,openapi,orchestration
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.11
Requires-Dist: click>=8.1.0
Requires-Dist: cryptography>=44.0.0
Requires-Dist: httpx>=0.27.0
Requires-Dist: jinja2>=3.1.0
Requires-Dist: jsonschema>=4.23.0
Requires-Dist: keyring>=25.0.0
Requires-Dist: langchain-anthropic>=1.3.0
Requires-Dist: langchain-core>=1.2.0
Requires-Dist: langgraph-checkpoint-sqlite>=3.0.3
Requires-Dist: langgraph-checkpoint>=4.0.0
Requires-Dist: langgraph-prebuilt>=1.0.7
Requires-Dist: langgraph>=1.0.7
Requires-Dist: mcp<2,>=1.9.0
Requires-Dist: pydantic>=2.7.4
Requires-Dist: pyjwt>=2.11.0
Requires-Dist: pyyaml>=6.0.2
Requires-Dist: rich>=14.0.0
Requires-Dist: tenacity>=9.0.0
Requires-Dist: watchfiles>=1.0.0
Provides-Extra: aws
Requires-Dist: boto3>=1.35.0; extra == 'aws'
Provides-Extra: dev
Requires-Dist: mypy>=1.14.0; extra == 'dev'
Requires-Dist: pre-commit>=4.0.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=1.0.0; extra == 'dev'
Requires-Dist: pytest-cov>=7.0.0; extra == 'dev'
Requires-Dist: pytest-mock>=3.14.0; extra == 'dev'
Requires-Dist: pytest>=9.0.0; extra == 'dev'
Requires-Dist: respx>=0.22.0; extra == 'dev'
Requires-Dist: ruff>=0.9.0; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-material>=9.5.0; extra == 'docs'
Requires-Dist: mkdocs>=1.6.0; extra == 'docs'
Requires-Dist: mkdocstrings[python]>=0.27.0; extra == 'docs'
Provides-Extra: google
Requires-Dist: langchain-google-genai>=2.0.0; extra == 'google'
Provides-Extra: graphql
Requires-Dist: graphql-core>=3.2.7; extra == 'graphql'
Provides-Extra: openai
Requires-Dist: langchain-openai>=0.3.0; extra == 'openai'
Provides-Extra: postgres
Requires-Dist: asyncpg>=0.30.0; extra == 'postgres'
Requires-Dist: langgraph-checkpoint-postgres>=3.0.4; extra == 'postgres'
Requires-Dist: psycopg-pool>=3.2.0; extra == 'postgres'
Requires-Dist: psycopg[binary]>=3.2.0; extra == 'postgres'
Provides-Extra: vault
Requires-Dist: hvac>=2.0.0; extra == 'vault'
Description-Content-Type: text/markdown

# API2MCP

> Universal API to MCP Server Converter with LangGraph Orchestration

[![CI](https://github.com/manavghosh/api2mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/manavghosh/api2mcp/actions/workflows/ci.yml)
[![PyPI version](https://img.shields.io/pypi/v/api2mcp)](https://pypi.org/project/api2mcp/)
[![Python versions](https://img.shields.io/pypi/pyversions/api2mcp)](https://pypi.org/project/api2mcp/)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](./LICENSE)
[![Coverage](https://codecov.io/gh/manavghosh/api2mcp/branch/main/graph/badge.svg)](https://codecov.io/gh/manavghosh/api2mcp)

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

```bash
# 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

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

- [Getting Started](./docs/getting-started.md)
- [Configuration Reference](./docs/reference/config.md)
- [CLI Reference](./docs/reference/cli.md)
- [Orchestration Tutorial](./docs/tutorials/orchestration.md)
- [Contributing Guide](./docs/contributing.md)

## Development

### Prerequisites

- Python 3.11+
- [pip](https://pip.pypa.io/) or any PEP 517-compatible build tool

### Setup

```bash
# 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

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

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

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

### Building the package

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

### Building the documentation site

```bash
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](https://claude.ai) (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](https://github.com/langchain-ai/langgraph) | Orchestration graph engine |
| [MCP SDK](https://github.com/modelcontextprotocol/python-sdk) | Model Context Protocol runtime |
| [Pydantic](https://docs.pydantic.dev/) | Data validation |
| [httpx](https://www.python-httpx.org/) | Async HTTP client |
| [Click](https://click.palletsprojects.com/) | CLI framework |
| [Rich](https://rich.readthedocs.io/) | Terminal output |
| [MkDocs Material](https://squidfunk.github.io/mkdocs-material/) | Documentation site |

## Contributing

Contributions are welcome! Please read [CONTRIBUTING.md](./CONTRIBUTING.md) and our [Code of Conduct](./CODE_OF_CONDUCT.md) before submitting a pull request.

## License

MIT License - see [LICENSE](./LICENSE) for details.
