openapi-swagger-mcp
Lets an AI agent read Swagger 2.0, OpenAPI 3.0 and OpenAPI 3.1 specs: list configured services and spec revisions, search operations by service, method, tag or query, inspect an operation's contract (path/query/header parameters and JSON, form, multipart or binary request bodies), and send real authenticated requests to the dev/UAT APIs described by the spec. Authentication can be configured per service (e.g. bearer tokens from environment variables), with support for named auth profiles, interactive sessions, anonymous calls and negative testing via header overrides.
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-swagger-mcp
Connect your AI coding agent to any Swagger 2.0 or OpenAPI 3.0 / 3.1 service from your local machine.
Most OpenAPI-to-MCP bridges generate one tool per endpoint. That works on a 10-route pet store and falls apart on a 400-route backend. openapi-swagger-mcp takes a different approach: it gives the agent 11 fixed tools to search specs, read schemas, dry-run requests, handle auth, and make real HTTP calls, no matter how many endpoints your API has.
flowchart LR
subgraph Machine["๐ป Your Machine"]
Client["๐ค MCP Client\n(Claude, Cursor, VS Code, ...)"]
Server["โ๏ธ openapi-swagger-mcp\n(11 fixed tools)"]
Inspector["๐ Local Inspector UI\n(http://127.0.0.1)"]
end
subgraph Targets["๐ Your Non-Production APIs"]
Specs["๐ OpenAPI / Swagger Specs"]
Backend["๐ API Services"]
end
Client <-->|"stdio (MCP)"| Server
Server -->|"loads & indexes"| Specs
Server <-->|"HTTP / HTTPS"| Backend
Server -.->|"read-only trace"| Inspector๐ See what your agent actually sent
Chat summaries only tell you what the model thinks happened. When an agent chains five API calls, refreshes a token, and hits a 422, you want to see the real traffic.
The built-in Local Request Inspector opens a read-only web UI on 127.0.0.1 for your active MCP session:
๐ Live activity timeline: Every MCP tool call is paired with the HTTP requests, redirects, and login/refresh runs it triggered. Offline
preview_operationchecks show up clearly with zero network traffic.๐งช Side-by-side HTTP workbench: Check full URLs, query parameters, headers, cookies, request bodies, and formatted or hex responses. Secrets injected from your config stay masked by name.
๐ Schema checks & cURL export: Spot request or response fields that broke your OpenAPI contract, and copy a ready-to-run
curlcommand for any exchange.
Related MCP server: mcp-swagger
โก Try the built-in demo in 30 seconds
Want to click around the Inspector and test the tools before wiring up your own API? Run demo as your MCP server command (requires Node.js 22.19+):
npx -y @nhan7777/openapi-swagger-mcp@0.1.5 demodemo spins up a local mock backend on 127.0.0.1 (demo-shop and demo-account), turns on the Inspector, and serves MCP over stdio. Drop that command into your MCP client, then run the --inspector-url command printed on stderr in a local terminal to watch the agent work in your browser.
๐ Quick start
1. Create an API config
Run init to generate a starter config.dev.yaml and a client snippet. It validates your inputs and never touches your editor's config files:
npx -y @nhan7777/openapi-swagger-mcp@0.1.5 init \
--service orders \
--base-url http://localhost:8080/api/v1 \
--spec http://localhost:8080/v3/api-docs \
--out config.dev.yaml \
--client claude-code๐ก Tip: Add
--bearer-env ORDERS_TOKENif your API expects a Bearer token.--clientacceptsgeneric,claude-desktop,claude-code,cursor,vscode,windsurf,cline,codex,omp, orkiro.
Prefer writing YAML by hand? Create config.dev.yaml:
inspector:
enabled: true
port: 0
services:
orders:
baseUrl: http://localhost:8080/api/v1 # full URL prefix; overrides spec servers/basePath
spec: http://localhost:8080/v3/api-docs # URL or relative file path like ./openapi.json2. Check the config
npx -y @nhan7777/openapi-swagger-mcp@0.1.5 --config /absolute/path/config.dev.yaml --check--check validates syntax, environment variables, and local file paths offline ("ok": true, exit 0). To also fetch and validate your OpenAPI specs over the network, use --check-specs.
3. Register the server in your MCP client
Add this stdio entry to your MCP client config using the absolute path to config.dev.yaml (leave --check out of args):
{
"mcpServers": {
"api-dev": {
"command": "npx",
"args": [
"-y",
"@nhan7777/openapi-swagger-mcp@0.1.5",
"--config",
"/absolute/path/config.dev.yaml"
]
}
}
}Need the exact config file path or CLI command for Claude Desktop, Claude Code, Cursor, VS Code / GitHub Copilot, Windsurf, Cline, Codex CLI, OMP, or Kiro? See the ๐ ๏ธ MCP Client Setup Guide.
4. Send a first prompt & open the Inspector
Reconnect the MCP server in your client and start with a safe, read-only prompt:
List the configured APIs, check whether the
ordersspec loaded, and showsession.sessionIdandsession.inspector.statewithout calling any API endpoints.
Next, ask the agent to look up an endpoint and dry-run a request:
Find the order details endpoint in
orders, show its required parameters, and preview a request for IDdemo-123without sending it.
If inspector.enabled is true, open the browser UI from your own terminal using the sessionId from list_apis:
npx -y @nhan7777/openapi-swagger-mcp@0.1.5 \
--config /absolute/path/config.dev.yaml \
--inspector-url --session <session-id>๐ Keep the Inspector URL private: The
#t=...fragment at the end of the URL is your local access token. Run--inspector-urlin your own terminal and open it directly in a browser, not inside the AI chat. See the ๐ Inspector Guide.
๐งญ How a typical session flows
sequenceDiagram
autonumber
actor You
participant Agent as ๐ค AI Agent
participant MCP as โ๏ธ openapi-swagger-mcp
participant API as ๐ Target API
You->>Agent: "Check order demo-123 in orders"
Agent->>MCP: list_apis / search_operations
MCP-->>Agent: matching endpoints + spec revision
Agent->>MCP: get_operation_schema (GET /orders/{id})
MCP-->>Agent: parameters, auth, response schema
Agent->>MCP: preview_operation (offline dry-run)
MCP-->>Agent: built URL, headers, validation (sent: false)
Agent->>MCP: invoke_operation
MCP->>API: GET /api/v1/orders/demo-123
API-->>MCP: 200 OK + JSON body
MCP-->>Agent: status, bodyView, schema diagnostics๐ Discover:
list_apisandsearch_operationslocate the right endpoint and current specrevision.๐ Read the contract:
get_operation_schemareturns parameters, request body shape, auth requirements, and response schemas.๐งช Dry-run:
preview_operationbuilds and validates the request locally (sent: false) without touching the network.๐ Call:
invoke_operationsends the real HTTP request (keeping intentional bad inputs intact for negative testing) and checks the response against the spec.๐ Audit: Open the Inspector to review every tool call, HTTP exchange, auth run, and payload.
โ ๏ธ Two rules to keep in mind
Point at non-production environments (local, test, or staging).
invoke_operationsends realPOST,PUT,PATCH, andDELETErequests with no undo button. Keep your MCP client's tool confirmation prompts enabled.Know what reaches your LLM provider. This server runs locally over
stdiowith zero telemetry. However, any tool output your assistant reads is sent by your MCP client to your model provider. Load credentials withfromEnvorfromFileinstead of pasting tokens into chat.
๐งฐ The 11 fixed tools
Group | Tool | What it does |
๐ Discovery |
| List configured services, spec readiness, revisions, warnings, and Inspector status |
| Search endpoints by path, operationId, text, parameters, or request/response fields | |
| Read the full contract for one operation (parameters, body, responses, auth) | |
| Reload OpenAPI specs without restarting the server (keeps the last valid snapshot if reload fails) | |
๐ Execution |
| Build and validate a request offline ( |
| Send a real HTTP request, return status/body/diagnostics, and optionally capture session auth | |
๐ Auth |
| Run a configured login/refresh recipe or reload static credentials |
| Check credential state, active profile, cookies, and errors without exposing secret values | |
| Create, inspect, or delete in-memory sessions for OTP, SSO, or imported tokens | |
๐ฆ Artifacts |
| Page through or query (via JSON Pointer) large responses and schemas stored on disk |
| Save raw bytes, UTF-8 text, or decoded base64 fields to an allowed local folder |
๐ Documentation
Guide | What you will find inside |
Turn on the local web UI, open your active session, inspect timelines and HTTP payloads, copy cURL, and fix common issues | |
Config file paths, JSON/TOML snippets, and CLI commands for 9 MCP clients | |
Multi-service setups, protected specs and | |
Bearer/Basic/API keys, | |
Request body formats, negative testing, reading/exporting large responses, search ranking & aliases, privacy boundary, and error codes | |
Copy-ready YAML recipes for every supported setup (validated against | |
Building from source, running tests and the Inspector harness, verifying packages, and publishing |
๐ฆ Alternative installs & package details
Global install:
npm install -g @nhan7777/openapi-swagger-mcp@0.1.5(binary:openapi-swagger-mcp). Always include the@nhan7777/scope; the unscopedopenapi-swagger-mcppackage on npm is a different project.Official MCP Registry: Published as
io.github.nhan7777/openapi-swagger-mcpon the Official MCP Registry. Everything runs locally on your machine; never upload private configs or tokens to third-party web hosts.License: MIT. Third-party notices are in THIRD_PARTY_NOTICES.md.
This server cannot be deployed
Maintenance
Related MCP Connectors
Discover, compare, route, and execute machine-accessible capabilities for AI agents.
AI-callable tools for API mocking, testing, monitoring, security, and automation.
Point Gecko at an OpenAPI spec; get first-call-correct, auth-hidden agent tools.
Discover, inspect and run 63,000+ agent tools from one balance. Pay per call, no subscriptions.
Related MCP Servers
- FlicenseNot gradedqualityNot gradedmaintenanceEnables AI agents to dynamically discover and interact with APIs through Swagger/OpenAPI specifications and Postman collections using a strategic four-tool approach. It streamlines API integration by providing universal tools for endpoint discovery, detailed request information, and authenticated execution.1-
- AlicenseAqualityDmaintenanceExposes Swagger/OpenAPI API documentation to AI models, enabling exploration, search, and interaction with endpoints, schemas, and execution of API calls.1426 npm2MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to discover, search, and call any REST API described by an OpenAPI or Swagger document. Supports multiple API endpoints with authentication and parameter handling.10 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables AI coding agents to discover and use Swagger/OpenAPI operations, schemas, and endpoints from configured sources, with optional API request execution and environment-based authentication.4 npm1MIT