openapi-mcp-runtime
Supports Swagger 2.0 API definitions, converting each documented operation into an MCP tool that can call the live API with typed arguments, authentication, and optional GET caching.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
openapi-mcp-runtime
Turn any OpenAPI 3.0, 3.1 or Swagger 2.0 document into a live Model Context Protocol server. Every API operation becomes an agent-callable tool, with authentication, caching and typed arguments. No wrapper code, no code-generation step.
npx openapi-mcp-runtime ./petstore.yaml[openapi-mcp] Loaded OpenAPI 3.0.3 from ./petstore.yaml — 19 tool(s) exposed.
[openapi-mcp] Base URL: https://petstore3.swagger.io/api/v3
[openapi-mcp] Transport: stdio (JSON-RPC over stdin/stdout)What it does
openapi-mcp-runtime is a runtime, not a generator. It loads a spec,
dereferences every $ref, and serves tools that proxy the live API.
Reads OpenAPI 3.0.x, 3.1.x and Swagger 2.0 documents (JSON or YAML), from disk or a URL.
Serves tools over stdio (Claude Desktop, Cursor, CLI agents) or Streamable HTTP (remote clients, custom integrations).
Applies the spec's security:
apiKey(header/query/cookie), HTTPbearer, HTTPbasic, and OAuth2 client credentials.Builds tool arguments from the spec's schemas, so agents get JSON Schema hints for path, query, header and body values.
Optionally caches
GETresponses for a TTL.Ships a CLI and a typed ESM library in one package.
How it compares
| codegen-only converters | |
OpenAPI 3.0 / 3.1 / Swagger 2.0 | yes | often 3.1 only |
Runs directly, no build step | yes | no |
apiKey / bearer / basic / OAuth2 | yes | varies |
GET response caching | yes | rarely |
stdio + Streamable HTTP | yes | usually stdio |
Typed client / type generation | yes | yes |
Related MCP server: api2mcp
Install
npm install -g openapi-mcp-runtime # global CLI
npm install openapi-mcp-runtime # library / npxRequires Node.js 18.17 or newer.
Quickstart
Serve a spec over stdio:
npx openapi-mcp-runtime ./petstore.yamlServe it over HTTP:
npx openapi-mcp-runtime ./petstore.yaml --transport http --port 8787
# MCP endpoint: http://127.0.0.1:8787/mcp
# Health check: http://127.0.0.1:8787/healthInspect the tools that would be exposed:
npx openapi-mcp-runtime ./petstore.yaml --print-toolsA sample spec lives in examples/petstore.yaml.
Integrations
Ready-made configurations and framework adapters are in
examples/integrations/:
Target | File |
Claude Desktop | |
Cursor | |
Hono | |
Express | |
Next.js (App Router) |
Claude Desktop — add to claude_desktop_config.json:
{
"mcpServers": {
"petstore": {
"command": "npx",
"args": ["-y", "openapi-mcp-runtime", "./examples/petstore.yaml"]
}
}
}Cursor — add to .cursor/mcp.json:
{
"mcpServers": {
"petstore": {
"command": "npx",
"args": ["-y", "openapi-mcp-runtime", "./examples/petstore.yaml"]
}
}
}CLI reference
Option | Description |
| Transport to serve (default |
| HTTP port (default |
| HTTP host (default |
| Override the server URL from the spec. |
| Extra header, repeatable. |
| Bearer token for |
| Basic auth credentials. |
| Value for an |
| OAuth2 client credentials, repeatable. |
| OAuth2 scopes, repeatable. |
| Cache |
| Request timeout in milliseconds (default |
| Print generated tools as JSON and exit. |
| Write TypeScript argument types to a file. |
| Write a self-contained TypeScript client. |
| Log more detail to stderr. |
| Show help. |
| Show version. |
Logs go to stderr; --print-tools writes JSON to stdout.
Authentication
Credentials are matched to the spec's securitySchemes by name. Missing
credentials never abort the server — the request proceeds unauthenticated and
the API decides.
# apiKey scheme
npx openapi-mcp-runtime ./api.yaml --api-key apiKey=my-secret
# bearer
npx openapi-mcp-runtime ./api.yaml --bearer "$TOKEN"
# basic
npx openapi-mcp-runtime ./api.yaml --basic user:pass
# OAuth2 client credentials (tokenUrl comes from the spec)
npx openapi-mcp-runtime ./api.yaml --oauth2 myOAuth=client-id:client-secret --scope myOAuth=read,write
# static header, environment variable expanded at startup
npx openapi-mcp-runtime ./api.yaml --header "X-Tenant=$TENANT_ID"Library
import {
createHandler,
createRuntime,
executeTool,
loadSpec,
startHttpServer,
} from "openapi-mcp-runtime";
const spec = await loadSpec("./petstore.yaml"); // file or URL, $refs resolved
const runtime = createRuntime(spec, { baseUrl: "https://api.example.com" });
const tool = runtime.tools.find((candidate) => candidate.name === "listPets");
const result = await executeTool(tool, { limit: 10 }, {
baseUrl: runtime.baseUrl,
auth: { bearer: process.env.TOKEN },
security: tool.security,
securitySchemes: runtime.securitySchemes,
cacheTtl: 60,
});
const handler = createHandler({ tools: runtime.tools, execute });
await startHttpServer(handler, { port: 8787 });Generated types and client
npx openapi-mcp-runtime ./api.yaml --generate-types ./api-types.ts
npx openapi-mcp-runtime ./api.yaml --generate-client ./api-client.tsimport { callTool } from "./api-client.ts";
const pets = await callTool("listPets", { limit: 10 });How it works
loadSpec()parses the document and dereferences every$ref(internal, external file, remote).createRuntime()walkspaths; each operation becomes an MCP tool named after itsoperationId(or a generatedmethod_pathname), with a JSON Schema assembled from path, query, header and body definitions.createHandler()implements the MCP JSON-RPC surface:initialize,tools/list,tools/call,resources/list,prompts/list.startStdioServer()orstartHttpServer()exposes the handler to clients.
Operations can be hidden from MCP with x-mcp-exclude: true.
Development
npm install
npm test # build + run the test suite (node:test)
npm run build # compile TypeScript to dist/
npm run dev # watch modeThe test suite covers the spec parser, tool conversion, request building, authentication, caching, the MCP protocol, the HTTP transport and the CLI.
Publishing
Releases are automated with GitHub Actions (see
.github/workflows/publish.yml). Push a
version tag and CI builds, tests, publishes to npm with provenance, and creates
a GitHub release.
Contributing
Issues and pull requests are welcome. Please open an issue before large changes
so the design can be discussed. Keep the test suite green: npm test.
Trademark
The name japofc and the project branding are trademarks of japofc. The MIT license covers the code only and does not grant any rights to the name or branding. Forks and derivative works must keep the copyright notice and license text, and must not present themselves as official releases. See TRADEMARK.md.
License and attribution
MIT License. Copyright (c) 2026 japofc — author and maintainer.
Docs: docs/index.html · Source: src/ · Tests: test/
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Point Gecko at an OpenAPI spec; get first-call-correct, auth-hidden agent tools.
Generate a typed SDK, CLI, and MCP server from any OpenAPI or GraphQL spec, and keep them current.
Host any HTTP API as a standard MCP server; auto-distribute to 12+ mainstream agent platforms.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceConverts any OpenAPI 3.x spec into a live MCP server, making every endpoint a validated tool that AI agents can call without writing glue code.7 npmMIT
- AlicenseNot gradedqualityCmaintenanceServes any OpenAPI 3.x/Swagger 2.x API as a local MCP server over stdio, converting every operation into a tool that proxies requests to the upstream API with configurable headers and fixed parameters.10 npm4MIT
- AlicenseNot gradedqualityCmaintenanceTurns any OpenAPI 3.x spec into an MCP server that exposes one validated tool per API operation, so AI agents can discover and call a REST API over stdio or Streamable HTTP. It is read-only by default, with allow/deny lists, environment-based auth, timeouts and response truncation for safe agent access.MIT
- AlicenseNot gradedqualityCmaintenanceTurns any API with an OpenAPI 3.0/3.1/3.2 spec into callable MCP tools: it generates a tool per supported operation, validates arguments, and forwards authenticated requests, served over stdio or local HTTP or embedded as a library. No hand-written tool per endpoint is required.MIT