
openapi-mcp-gateway
by mroops0111
OpenAPI MCP Gateway
Mount any OpenAPI (Swagger) spec as a Model Context Protocol (MCP) server, or expose an existing FastAPI app the same way. Multiple APIs in one process, each with its own mount path and auth.
<p align="center"> <img src="architecture.png" alt="OpenAPI MCP Gateway architecture: MCP clients (Claude Desktop, Cursor, AI agents) connect over stdio / SSE / streamable-http to the gateway, which at startup ingests OpenAPI specs or FastAPI apps and exposes them as MCP tools, meta-tools, and resources, then per call authorizes with bearer / API key / OAuth2 and emits MCP-native output, calling upstream REST APIs over HTTP or an in-process FastAPI app over ASGI." width="100%"> </p>uvx openapi-mcp-gateway --spec https://petstore3.swagger.io/api/v3/openapi.json
# Server live at http://127.0.0.1:8000/api/mcp
- Multi-Spec, Multi-Auth. Mount GitHub, an OAuth2 SaaS, and your internal API side by side, each with its own bearer / API key / OAuth2 auth and token namespace.
- FastAPI-Native. Decorate routes with
@mcp_toolto expose them in-process over ASGI, no extra hop and no second spec to maintain. - Dynamic Exposure. Front a huge spec with three
list → get → callmeta-tools instead of hundreds of schemas, so it never blows the LLM's context window. - Resource Auto-Promotion. Set
mode: autoand eligible GETs register as MCP resources instead of tools, keeping the tool list small while reads stay addressable by URI. - Spec-Compliant Authorization. Audience-bound tokens with no silent passthrough to upstreams, plus protocol-native
annotationsandstructuredContenton every tool. - Tool Name and Description Overrides. Rewrite ugly
operationIds and empty descriptions in YAML, no fork required. - Pluggable Token Store. Memory by default, switch to Redis to share OAuth credential state across replicas. It holds OAuth tokens and client registrations, never MCP protocol sessions, so single-replica or non-OAuth deployments do not need it.
- Every Transport. Streamable HTTP and stdio on the same binary, from Claude Desktop and Cursor to any other MCP client. SSE still works but is deprecated in the 2026-07-28 spec, so new deployments should choose streamable HTTP.
Installation
Add the gateway to your project with uv:
uv add openapi-mcp-gateway
Optional extras:
uv add "openapi-mcp-gateway[redis]" # Redis token store, used for auth memoization
Requires Python 3.11+.
Quick Start
1. Public API, No Auth
# `uv run` assumes you ran `uv add openapi-mcp-gateway` (see Installation above).
# To skip the install, swap in `uvx openapi-mcp-gateway` to run the published package directly.
uv run openapi-mcp-gateway --spec https://petstore3.swagger.io/api/v3/openapi.json --name petstore
Connect an MCP client to http://127.0.0.1:8000/petstore/mcp.
2. Bearer Token
export GITHUB_TOKEN="ghp_..."
uv run openapi-mcp-gateway \
--spec https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.json \
--name github \
--auth-type bearer \
--auth-token '${GITHUB_TOKEN}'
For an API-key header, use config so the header name is explicit:
servers:
- name:
Related servers

n8n
Updated todayby n8n-io
Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.
NOASSERTION★ 199,059

mcp-server-fetch
OfficialUpdated todayA Model Context Protocol server providing tools to fetch and convert web content for usage by LLMs
★ 89,138

@modelcontextprotocol/server-filesystem
OfficialUpdated todayMCP server for filesystem access
SEE LICENSE IN LICENSE★ 89,138