Openapi MCP Gateway logo

Openapi MCP Gateway

by mroops0111

Mount OpenAPI specs or FastAPI routes as authenticated MCP endpoints with generated tools, resources, and dynamic exposure.

Install Openapi MCP Gateway

Pick your client, then add it in one click or paste the config.

STDIOPython
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "mroops0111-openapi-mcp-gateway": {
      "command": "uvx",
      "args": [
        "openapi-mcp-gateway"
      ]
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Install not yet sandbox-tested— we haven't run this command through our automated sandbox yet. Not a red flag; we're working through the catalog.

Overview

mroops0111/openapi-mcp-gateway mounts OpenAPI or Swagger specifications, and optionally an existing FastAPI app, as MCP endpoints in one process. YAML configuration assigns each API its own path, authentication, tool shaping rules, and optional resource promotion. Large specifications can use list, get, and call meta-tools instead of registering every operation as a separate schema, while eligible GET operations can become MCP resources. Reach for it when agents need controlled access to multiple REST APIs or FastAPI routes without maintaining a separate MCP implementation for each one.

Use cases

  • Mount several REST APIs behind separate MCP endpoints
  • Expose a large OpenAPI specification through dynamic meta-tools
  • Promote read-only API operations to MCP resources
  • Add OAuth2 token handling between MCP clients and upstream APIs
  • Expose FastAPI routes as MCP tools in the same process

Key features

  • Multi-spec MCP mounting
  • Dynamic list/get/call exposure
  • GET-to-resource promotion
  • OAuth2 token relay and exchange
  • YAML-based tool shaping with JSONata
  • FastAPI route exposure

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked 2d ago

Recent health check succeeded.

19/24 checks healthy over the last 84d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 16d ago via OSV.dev · openapi-mcp-gateway (PyPI)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars7Stargazers on the source repository.
Last commit7d agoMost recent push to the default branch.
Directory activity3 viewsConfig copies, upvotes, and views on AllMCPs.

How Openapi MCP Gateway works

What mroops0111/openapi-mcp-gateway does

mroops0111/openapi-mcp-gateway turns OpenAPI or Swagger descriptions into MCP servers and can expose an existing FastAPI application through the same gateway. A single process can mount multiple APIs, with each one receiving a separate endpoint at /{name}/mcp. The gateway can also apply per-API authentication, request and response transformations, and exposure settings from YAML rather than requiring changes to the source specifications.

Generated operations are normally presented as MCP tools. Read-only GET operations that meet the gateway's eligibility rules can instead be promoted to MCP resources, giving clients URI-addressable data and resource templates. For very large APIs, dynamic exposure groups operations behind three meta-tools: list available operations, retrieve an operation's details, and call the selected operation. This avoids placing thousands of individual tool schemas into the client's context.

How it works

At startup, the gateway reads one or more specifications and builds an MCP endpoint for each configured API. Calls are authorized, converted into upstream HTTP requests or in-process ASGI calls for FastAPI routes, and then returned to the MCP client. JSONata expressions can reshape outgoing requests and incoming responses; expressions are validated when the gateway starts.

Authentication separates access to the MCP endpoint from the credential sent to the upstream API. Supported configurations include open access, fixed bearer tokens, API-key headers, caller-token passthrough, OAuth2 client credentials, authorization code, and token exchange. Authorization-code and token-exchange flows obtain per-user upstream credentials, while client-credentials uses one service token for callers. The gateway can store OAuth tokens in memory or, with the optional Redis extra, in Redis for multi-replica deployments.

FastAPI routes can be exposed in-process with the @mcp_tool decorator, avoiding a second network hop and a separate OpenAPI specification for those routes.

Setup and configuration

Install the Python package with uv add openapi-mcp-gateway; Python 3.11 or newer is required. uvx openapi-mcp-gateway runs the published package without a local installation. A container image is also published to GHCR and can read a mounted config.yml from /config.

For a single public API, provide a specification URL and a name:

bash
uv run openapi-mcp-gateway \
  --spec https://petstore3.swagger.io/api/v3/openapi.json \
  --name petstore

The resulting MCP endpoint is available at http://127.0.0.1:8000/petstore/mcp by default. Multiple APIs are configured under servers in YAML, with options such as spec, name, base_url, exposure, and auth. Environment-variable references can supply secrets such as bearer tokens, API keys, and OAuth client credentials. Use --transport stdio for local desktop or IDE clients that launch the gateway as a subprocess.

Tools and capabilities

  • Generate MCP tools from OpenAPI operations.
  • Mount several APIs under distinct MCP paths in one process.
  • Replace individual operation exposure with dynamic list, get, and call meta-tools.
  • Promote eligible GET operations to MCP resources and resource templates.
  • Rename operation IDs and hide parameters through YAML configuration.
  • Transform requests and responses with JSONata.
  • Forward fixed credentials, API keys, caller tokens, service tokens, or per-user OAuth2 tokens.
  • Decorate FastAPI routes with @mcp_tool for in-process exposure.

Limitations and notes

Each mounted API has its own endpoint and authentication configuration, so clients must connect to the relevant path. Fixed bearer and API-key credentials are shared by callers; per-user credentials require the OAuth2 authorization-code or token-exchange flows. Redis is an optional dependency for sharing OAuth token state across replicas. The gateway's OAuth callback configuration uses the public base URL configured for the deployment.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Openapi MCP Gateway

mroops0111/openapi-mcp-gateway is an MCP server that connects AI clients to OpenAPI or Swagger APIs and existing FastAPI routes. It generates MCP tools, can expose eligible GETs as resources, and offers list, get, and call meta-tools for large specifications. Multiple APIs can run under separate endpoints with independent authentication.

Install it with `uv add openapi-mcp-gateway`, or run it directly with `uvx openapi-mcp-gateway`. Python 3.11 or newer is required. A GHCR container image is also available, and the optional `redis` extra adds Redis-backed OAuth token storage.

Define each API under the `servers` section of a YAML configuration file, giving each entry a name and specification URL. Run the gateway with `--config`; each API is then mounted at its own `/{name}/mcp` endpoint and can have separate exposure and authentication settings.

It can use client credentials for a shared service token, authorization code for per-user tokens obtained through the gateway, or token exchange through an existing issuer. The gateway sends the resulting upstream credential to the API instead of replaying the MCP client's credential against a third party.

Yes. Dynamic exposure places the API behind three meta-tools for listing operations, retrieving operation details, and making calls. This avoids registering every operation as an individual MCP tool schema and reduces the context required when connecting to a large specification.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewOpenapi MCP Gateway AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/mroops0111-openapi-mcp-gateway?style=directory)](https://allmcps.com/mcp/mroops0111-openapi-mcp-gateway)
HTML Embed
<a href="https://allmcps.com/mcp/mroops0111-openapi-mcp-gateway"><img src="https://allmcps.com/api/badge/mroops0111-openapi-mcp-gateway?style=directory" alt="Openapi MCP Gateway on AllMCPs" /></a>