Guide

Installation & CLI

Install OpenAPI MCP via npm, Bun, or standalone binary, connect an MCP client, and run CLI checks in CI.

OpenAPI MCP is published on npm as @dimassetoid/openapi-mcp (requires Node.js >= 18.20.0 or Bun >= 1.4.3) and as standalone binaries with no runtime dependency.

Install via npm or Bun

npm install -g @dimassetoid/openapi-mcp
# or
bun add -g @dimassetoid/openapi-mcp

To run without installing globally:

npx @dimassetoid/openapi-mcp serve
# or
bunx @dimassetoid/openapi-mcp serve

Install as a Standalone Binary

Linux & macOS:

curl -fsSL https://raw.githubusercontent.com/Shironim/openapi-mcp/master/scripts/install.sh | sh

Windows (PowerShell):

irm https://raw.githubusercontent.com/Shironim/openapi-mcp/master/scripts/install.ps1 | iex

Connect to an MCP Client

Add openapi-mcp to .mcp.json or your MCP client configuration:

{
  "mcpServers": {
    "openapi-mcp": {
      "command": "openapi-mcp",
      "args": ["serve", "--root", "/path/to/repo"]
    }
  }
}

Single Spec vs. Monorepo

  • Single spec: If your spec lives at the workspace root, api/, or docs/ as openapi.yml, openapi.yaml, or openapi.json, OpenAPI MCP detects it automatically. You can also pin a path with --spec api/openapi.yml.
  • Multiple specs: In a monorepo, omit --spec and let agents read openapi://specs/catalog, then pass spec_path on individual tool or resource requests.

CLI Reference (Local & CI)

Use the CLI directly in pre-commit hooks or CI pipelines to validate specs and block breaking changes:

# Fail on validation errors or warnings
openapi-mcp check --root . --spec openapi.yml --strict

# Fail if any breaking change is introduced
openapi-mcp diff openapi.yml openapi-v2.yml --fail-on-breaking
CommandDescription
openapi-mcp serve [--root <dir>] [--spec <path>]Start the MCP server over stdio.
openapi-mcp check [--root <dir>] [--spec <path>] [--strict] [--json]Validate a spec; exits 1 on errors (or on warnings when --strict is set).
openapi-mcp diff <base> <target> [--root <dir>] [--fail-on-breaking] [--json]Compare two local specs; exits 1 on breaking changes when --fail-on-breaking is set.
openapi-mcp -h | --helpPrint CLI help to stderr.
openapi-mcp -v | --versionPrint installed version to stderr.