Metadata-Version: 2.5
Name: openapi-mcp-gateway
Version: 1.0.0
Summary: Mount any OpenAPI/Swagger API as an MCP server from one YAML file, with per-user OAuth2, token exchange, and tool shaping that turns raw endpoints into tools an LLM can actually use.
Project-URL: Homepage, https://github.com/mroops0111/openapi-mcp-gateway
Project-URL: Documentation, https://mroops0111.github.io/openapi-mcp-gateway/
Project-URL: Changelog, https://github.com/mroops0111/openapi-mcp-gateway/releases
Project-URL: Repository, https://github.com/mroops0111/openapi-mcp-gateway
Project-URL: Issues, https://github.com/mroops0111/openapi-mcp-gateway/issues
Author: Yun-Tai Yang
License: MIT
License-File: LICENSE
Keywords: ai,fastapi,gateway,jsonata,llm,mcp,model-context-protocol,oauth2,openapi
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
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.11
Requires-Dist: click>=8.5.1
Requires-Dist: fastapi>=0.165.0
Requires-Dist: httpx>=0.28.1
Requires-Dist: inflection>=0.5.1
Requires-Dist: jsonata-python>=0.7.2
Requires-Dist: jsonschema>=4.26.0
Requires-Dist: mcp>=2.0.0
Requires-Dist: pydantic-settings>=2.16.3
Requires-Dist: pydantic>=2.14.4
Requires-Dist: pyyaml>=6.0.3
Requires-Dist: snowballstemmer>=3.1.1
Requires-Dist: uvicorn[standard]>=0.54.0
Provides-Extra: dev
Requires-Dist: basedpyright>=1.39.0; extra == 'dev'
Requires-Dist: fakeredis>=2.35.0; extra == 'dev'
Requires-Dist: httpx>=0.28.1; extra == 'dev'
Requires-Dist: pyjwt[crypto]>=2.15.1; extra == 'dev'
Requires-Dist: pytest-asyncio>=1.5.0; extra == 'dev'
Requires-Dist: pytest-cov>=7.1.0; extra == 'dev'
Requires-Dist: pytest>=9.2.0; extra == 'dev'
Requires-Dist: ruff>=0.17.6; extra == 'dev'
Requires-Dist: testcontainers>=4.15.0; extra == 'dev'
Provides-Extra: embeddings
Requires-Dist: pydantic-ai-slim[openai]>=2.69.0; extra == 'embeddings'
Provides-Extra: eval
Requires-Dist: openapi-mcp-gateway-eval==1.0.0; extra == 'eval'
Provides-Extra: oidc
Requires-Dist: pyjwt[crypto]>=2.15.1; extra == 'oidc'
Provides-Extra: redis
Requires-Dist: redis>=7.4.0; extra == 'redis'
Description-Content-Type: text/markdown

![openapi-mcp-gateway. Point one YAML file at your OpenAPI specs, and each API gets its own MCP endpoint and auth.](docs/assets/cover.svg)

<p align="center">
  <a href="https://github.com/mroops0111/openapi-mcp-gateway/actions/workflows/ci.yml"><img src="https://github.com/mroops0111/openapi-mcp-gateway/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
  <a href="https://pypi.org/project/openapi-mcp-gateway/"><img src="https://img.shields.io/pypi/v/openapi-mcp-gateway.svg?v=1" alt="PyPI version"></a>
  <a href="https://pepy.tech/projects/openapi-mcp-gateway"><img src="https://static.pepy.tech/badge/openapi-mcp-gateway/month" alt="PyPI Downloads"></a>
  <a href="https://pypi.org/project/openapi-mcp-gateway/"><img src="https://img.shields.io/pypi/pyversions/openapi-mcp-gateway.svg?v=1" alt="Python Version"></a>
  <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
</p>

Mount any OpenAPI (Swagger) spec as a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server from one YAML file, with no code to write. Per-user OAuth and per-operation scopes give fine-grained access control, and tool shaping and dynamic exposure give context efficiency on large APIs. One process runs several APIs, each with its own endpoint and auth.

With [uv](https://docs.astral.sh/uv/getting-started/installation/) installed, one command serves the Petstore API:

```bash
uvx openapi-mcp-gateway serve --spec https://petstore3.swagger.io/api/v3/openapi.json --name petstore
```

Then connect any MCP client, such as Claude Code, Cursor or VS Code, to `http://127.0.0.1:8000/petstore/mcp`. [Getting Started](https://mroops0111.github.io/openapi-mcp-gateway/getting-started/) continues from there to a config file with several APIs.

## Highlights

Five things set it apart from a server generated once from a spec.

- **One Gateway for Many APIs**: one YAML file serves several OpenAPI specs, each at its own MCP endpoint with its own auth.
- **Per-User OAuth**: users sign in to the API through the gateway, or bring a token from your identity provider for the gateway to exchange.
- **Fine-Grained Access Control**: scopes assigned per operation decide which tools each client can list and call.
- **Tool Shaping**: rename operations, hide or fix parameters, and rewrite requests and responses with JSONata.
- **Dynamic Exposure**: an API with 1,000+ operations is served as three tools that search, describe and call them.

## Architecture

Each tool call is authorized, shaped and sent upstream, and its response is reshaped on the way back.

![openapi-mcp-gateway architecture. An MCP client calls an MCP endpoint, one per API, which config.yml builds at startup. Each call is authorized first, by its token and then by the scopes the operation needs, getting an upstream token from the API's authorization server or your identity provider when the mode calls for one. The request is shaped by params and JSONata and sent with the upstream credential, over HTTP to a REST API or over ASGI to a FastAPI app in the same process. The response comes back reshaped by JSONata.](docs/assets/architecture-light.svg#gh-light-mode-only) ![openapi-mcp-gateway architecture, as described above.](docs/assets/architecture-dark.svg#gh-dark-mode-only)

## Documentation

See the [documentation](https://mroops0111.github.io/openapi-mcp-gateway/) for the full guides, concepts and reference.

- [Getting Started](https://mroops0111.github.io/openapi-mcp-gateway/getting-started/) covers installation, a connected client and a config file
- [Guides](https://mroops0111.github.io/openapi-mcp-gateway/guides/authoring-with-ai/) covers AI authoring, exposure, tool shaping, authorization, scopes, identity providers, deployment and Python
- [Concepts](https://mroops0111.github.io/openapi-mcp-gateway/concepts/architecture/) covers the request path, security, context efficiency, the scope model, token lifecycles and dynamic exposure
- [Reference](https://mroops0111.github.io/openapi-mcp-gateway/reference/configuration/) lists every config field and CLI flag
- [Evaluation](https://mroops0111.github.io/openapi-mcp-gateway/evaluation/) shows how the gateway is measured and what it gains

## License

[MIT](LICENSE)
