Introduction
Local OpenAPI MCP server, CLI, and reusable TypeScript engine for AI coding agents and CI pipelines.
OpenAPI MCP (@dimassetoid/openapi-mcp) is a local MCP server, CLI, and TypeScript engine for OpenAPI 3.0, OpenAPI 3.1, and Swagger 2.0 specifications.
Instead of pasting thousands of lines of YAML or JSON into an AI prompt, agents inspect compact indexes, run sandboxed queries against resolved schemas, and compare API versions locally.
Why OpenAPI MCP Exists
Working with API specifications in AI-assisted workflows usually breaks down in three ways:
- Context overflow — Loading an entire
openapi.ymlfile into a prompt consumes thousands of tokens just to check one endpoint or error response. - Scattered
$reffiles — Multi-file specs split parameters, request bodies, and shared schemas across directories, making plain text search unreliable. - Silent breaking changes — Removing an enum value, changing a field from optional to required, or dropping a status code is easy to miss during code review.
OpenAPI MCP keeps the full specification local and exposes only the exact contract, sample payload, or diff the agent or CI check asks for.
How It Works
OpenAPI MCP provides four complementary surfaces built on a single TypeScript engine:
| Surface | What it gives you |
|---|---|
| MCP Resources | Compact, paginated indexes for specs, endpoints, schemas, and single-pass validation diagnostics. |
| MCP Tools | openapi_query for sandboxed JavaScript queries and openapi_diff for breaking-change analysis. |
| MCP Prompts | Four guided workflows for frontend API alignment, error contract audits, diff reviews, and test fixtures. |
| CLI & Engine | serve, check, and diff commands for local terminals and CI, plus @dimassetoid/openapi-mcp/engine. |
Supported Specifications
- OpenAPI 3.1: Full local
$refresolution, sibling keywords alongside$refpreserved viaallOf, and deterministic JSON examples. - OpenAPI 3.0: YAML and JSON parsing with 1-based
{ file, line }source locations and merged path + operation parameters. - Swagger 2.0: Support for
definitionsschemas, reverse usage tracking, diagnostics, and semantic diffing. - Monorepos: Automatic workspace spec catalog (
openapi://specs/catalog) with per-requestspec_pathselection.
Scope & Limits
OpenAPI MCP performs read-only local analysis on your specification files.
- Remote
$refURLs (http://,https://) and paths escaping the workspace root are blocked for security. - Queries run in an isolated QuickJS WASM sandbox and never make network requests or execute against live API servers.
- Always run your project's own API tests alongside static spec checks.