openapi-mcp
Use this server to inspect and compare local OpenAPI specifications safely and efficiently.
Run read-only synchronous JavaScript against a resolved OpenAPI
specand built-in helpers (helpers.op,helpers.example,helpers.schemaRefs) viaopenapi_query, optionally scoping to a workspace/root andspec_pathand limiting output bytes.Compare two local OpenAPI specs (
base_spec_pathvstarget_spec_path) viaopenapi_diffto classify semantic contract changes into breaking and non-breaking categories.Both tools are read-only, non-destructive, idempotent, and closed-world, with configurable UTF-8 output budgets.
Supports inspecting and querying Swagger 2.0 API specifications, including endpoint and schema indexes, diagnostics, and semantic contract diffs.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@openapi-mcp Which endpoint creates an order, and what does its 422 response schema look like?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
openapi-mcp
Local Code Mode OpenAPI server, CLI, and contract engine for AI coding agents and CI.
openapi-mcp is a local Model Context Protocol (MCP) server, CLI, and reusable TypeScript engine for OpenAPI 3.0/3.1 and Swagger 2.0 specifications. It lets AI coding agents and CI pipelines inspect endpoints, schemas, and contract diffs without loading entire specification files into context.
Key Capabilities
Monorepo Spec Discovery (
openapi://specs/catalog) — Scans workspaces for OpenAPI entry files while skipping symlinks, unreadable directories (EACCES/EPERM), and build or dependency folders (node_modules,vendor,dist,.git, etc.).Indexed Endpoints & Paginated Search (
openapi://endpoints/index,openapi://endpoints/search) — Summarizes HTTP methods, paths,2xx/4xx/5xxstatus codes, error bodies, auth schemes, deprecation flags, and{ file, line }source locations, soft-capped at64 KB.Schema Index & Reverse References (
openapi://schemas/index,openapi://schemas/search) — Listscomponents.schemas/definitionswith required fields, properties,unusedSchemas, source locations, and reverseusedByoperation references.Single-Pass Contract Diagnostics (
openapi://spec/diagnostics,openapi-mcp check) — Reports broken$refs, duplicateoperationIds, undeclared path parameters, unknown security schemes, and missing error contracts in one pass.Sandboxed Query Engine (
openapi_query) — Runs read-only JavaScript in QuickJS WASM against frozenspecand built-inhelpers(helpers.op,helpers.example,helpers.schemaRefs).Semantic Contract Diff (
openapi_diff,openapi-mcp diff) — Compares two local specifications and classifies changes intobreakingandnonBreaking.MCP Prompts & Agent Skill — Ships four guided prompts (
sync-frontend-api,audit-error-contracts,review-breaking-changes,generate-test-fixtures) and a portable Agent Skill at skills/use-openapi-mcp/SKILL.md.
Related MCP server: LockSpec
Installation
Standalone Binary (Recommended)
Install precompiled single-file binaries for Linux, macOS, or Windows with SHA-256 verification (no Node.js or Bun required):
Linux & macOS:
curl -fsSL https://raw.githubusercontent.com/Shironim/openapi-mcp/master/scripts/install.sh | shWindows (PowerShell):
irm https://raw.githubusercontent.com/Shironim/openapi-mcp/master/scripts/install.ps1 | iexYou can also download archives directly from GitHub Releases (openapi-mcp-linux-x64, openapi-mcp-linux-arm64, openapi-mcp-darwin-x64, openapi-mcp-darwin-arm64, openapi-mcp-windows-x64.exe, and checksums.txt).
Via npm or Bun
Requires Node.js >=18.20.0 or Bun >=1.4.3:
npm install -g @dimassetoid/openapi-mcp
# or
bun add -g @dimassetoid/openapi-mcpOr run without global installation:
npx @dimassetoid/openapi-mcp serve
# or
bunx @dimassetoid/openapi-mcp serveQuick Start
MCP Client Setup
Add openapi-mcp to your MCP client configuration (for example .mcp.json):
{
"mcpServers": {
"openapi-mcp": {
"command": "openapi-mcp",
"args": ["serve", "--root", "/path/to/repo"]
}
}
}Once connected, ask your agent:
Which endpoint creates an order, what does its
422validation schema look like, and what is a valid example payload?
CI & Local CLI
Run contract diagnostics or breaking-change checks directly in your terminal or CI pipeline:
openapi-mcp check --root . --spec openapi.yml --strict
openapi-mcp diff openapi.yml openapi-v2.yml --fail-on-breakingCLI Reference
openapi-mcp <command> [options]Command | Description |
| Start the MCP server over |
| Validate an OpenAPI spec and report contract issues |
| Compare two local OpenAPI specs for breaking changes |
Option | Description |
| Workspace root directory (defaults to current directory) |
| Path to OpenAPI spec file ( |
| Exit with code |
| Exit with code |
| Output results as JSON ( |
| Show help message (written to |
| Show version number (written to |
Documentation
Development
bun install
bun run typecheck
bun test
bun run build
bun run compile:all # Build standalone binaries into release/
sh scripts/verify-package.sh # Verify npm tarball, TypeScript consumer, and stdio smoke testLicense
Available Tools
2 toolsopenapi_diffARead-onlyIdempotent
Compare two local OpenAPI specs (base_spec_path vs target_spec_path) and classify semantic contract changes into breaking vs non-breaking.
Inputs: base_spec_path (required), target_spec_path (required), root, max_bytes.
openapi_queryBRead-onlyIdempotent
Query the resolved, read-only OpenAPI spec using synchronous JavaScript against spec and built-in helpers (helpers.op, helpers.example, helpers.schemaRefs).
Inputs: code (required), root, max_bytes, spec_path.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
openapi_query is a single-spec read/inspection tool, while openapi_diff explicitly takes two specs and classifies breaking vs non-breaking changes; the action and input shape differences make misselection unlikely.
Both tools use the same `<domain>_<action>` pattern (openapi_query, openapi_diff) with lowercase snake_case, giving a fully predictable convention that would scale if more tools were added.
Two tools is slightly thin, but the design is coherent: openapi_query is a general-purpose escape hatch over `spec`/`helpers`, and openapi_diff covers the one specialized workflow (contract comparison) that a generic query tool handles poorly.
Read-side inspection via arbitrary JS query plus semantic diff is a solid core, but obvious adjacent operations are absent — spec validation/linting, loading specs from URLs or registries, and any write/edit capability for the spec itself.
Maintenance
Related MCP Connectors
Paid OpenAPI audit and API change detection for agents. $0.10 USDC per analysis via x402 on Base.
Discover, compare, and monitor 1,400+ APIs directly from your AI coding agent.
Discover, compare, route, and execute machine-accessible capabilities for AI agents.
Detect breaking changes, generate changelogs, diff, and validate OpenAPI specs.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI to scan and query local OpenAPI/Swagger documentation, listing API groups and endpoints, and generating TypeScript type definitions for specific endpoints.-
- AlicenseNot gradedqualityCmaintenanceProvides AI coding agents with accurate OpenAPI contract details to prevent hallucinated API calls, supporting multi-version pinning, endpoint discovery, and request validation.42 npmApache 2.0
- FlicenseAqualityDmaintenanceEnables LLMs to dereference and query OpenAPI/Swagger specifications, search endpoints and schemas, validate payloads, extract security schemes, and generate production-ready integration code in multiple languages.8-
- AlicenseNot gradedqualityCmaintenanceEnables agents to analyze OpenAPI contracts for deterministic integration risks, plan auth, sync, action, and webhook candidates, and diff contract versions for likely breaking changes through read-only tools.MIT