OpenAPI REST MCP Server
Enables CRUD requests and Swagger/OpenAPI-based endpoint and schema discovery against FastAPI applications that expose an OpenAPI spec.
Enables CRUD requests and Swagger/OpenAPI-based endpoint and schema discovery against .NET APIs that expose an OpenAPI/Swagger spec.
Enables CRUD requests and Swagger/OpenAPI-based endpoint and schema discovery against Node-based REST APIs that expose an OpenAPI/Swagger spec.
Enables CRUD requests and Swagger/OpenAPI-based endpoint and schema discovery against Spring APIs that expose an OpenAPI/Swagger spec.
Provides CRUD tools and endpoint/schema discovery for REST APIs described by OpenAPI/Swagger specs, including fetching and summarizing Swagger documents and inlining $ref schemas.
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 REST MCP Server create a new user named John Doe with email john@example.com"
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.
Quick Start • Installation • Usage • Configuration • Troubleshooting • Contributing
OpenAPI REST MCP Server
A Model Context Protocol (MCP) server that lets Claude AI talk to any OpenAPI/Swagger REST API through CRUD operations — works with .NET, Node, Spring, FastAPI and more. Flexible per-environment authentication (including zero-config auto-login), ${ENV_VAR} secret injection, fuzzy endpoint search, and $ref-inlined schema discovery.
🇹🇷 Türkçe için README.tr.md
Quick Start
Claude Desktop — add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{ "mcpServers": { "openapi-rest": { "command": "npx", "args": ["-y", "openapi-rest-mcp", "--config", "/path/to/config.json"] } } }Claude Code:
npm install openapi-rest-mcp
claude mcp add openapi-rest openapi-rest-mcp -- --config /absolute/path/to/config.jsonThen copy and fill in config.json — see Configuration.
Related MCP server: mcp-openapi
Features
All HTTP methods | GET, POST, PUT, DELETE and PATCH against any REST API |
Swagger/OpenAPI integration | Reads the spec and inlines |
Multiple environments | Named environments (local, development, beta, production, …) with a switchable default |
Endpoint discovery | Fuzzy keyword search, tag/method filters and schema retrieval from Swagger |
Flexible auth | Per-environment |
Zero-config | Auto-discovers the login endpoint and auto-detects the token in the response |
| Finds the right token path without guessing |
Response truncation |
|
| Keeps secrets out of |
Configurable config path |
|
TLS control and caching | Per-environment TLS verification and Swagger response caching |
Requirements
Node.js 22 or later (LTS)
Any REST API with an OpenAPI/Swagger JSON endpoint (.NET, Node, Spring, FastAPI, …)
Installation
npm install -g openapi-rest-mcp # global — for Claude Desktop
npm install openapi-rest-mcp # local — for Claude Code projectsCheck that the binary runs:
npx openapi-rest-mcp --version
npx openapi-rest-mcp --helpUsage
URLs can be absolute (https://host/path) or relative to the environment's baseUrl (e.g. /users). Every tool also accepts environment (override the active one) and maxChars (0 = unlimited). api_* tools also accept includeHeaders.
Tool | Description |
| GET request |
| POST request (create) |
| PUT request (replace) |
| DELETE request |
| PATCH request (partial update) |
| Probe the login endpoint; return raw response + suggested token paths |
| Fetch & summarize Swagger doc |
| List endpoints ( |
| Endpoint detail with |
| Schema/model definition |
| Where config is looked for + whether it loaded |
| Write a starter |
Examples:
api_get("/users", { include: "profile" })
api_post("/users", { name: "John Doe", email: "john@example.com" })
api_put("/users/123", { name: "Jane Doe" })
api_delete("/users/123")
api_patch("/users/123", { email: "new@example.com" })
api_get("/reports/huge", {}, { maxChars: 0 }) // unlimited
inspect_login({ environment: "local" })
swagger_fetch({ environment: "beta" })
swagger_list_endpoints({ search: "order create", limit: 10 })
swagger_list_endpoints({ tag: "User", method: "POST" })
swagger_get_endpoint({ path: "/api/users/{id}", method: "GET" })
swagger_get_schema({ schemaName: "UserDto" })Configuration
Copy the example and edit it:
cp node_modules/openapi-rest-mcp/config.example.json config.jsonMinimal config.json:
{
"environments": {
"local": {
"baseUrl": "https://localhost:7000/api",
"swaggerUrl": "https://localhost:7000/swagger/v1/swagger.json"
}
},
"activeEnvironment": "local",
"timeout": 30000,
"headers": {
"Content-Type": "application/json",
"Accept": "application/json"
}
}Config file resolution order
--config <path>/-c <path>— CLI flagOPENAPI_MCP_CONFIG— environment variable (DOTNET_API_CONFIGalso accepted)./config.json— current working directory
openapi-rest-mcp --config /etc/openapi-mcp/config.json
OPENAPI_MCP_CONFIG=/etc/openapi-mcp/config.json openapi-rest-mcpFirst-run setup
No config yet? The server still starts — it won't crash. Configure it with the built-in tools (Claude calls them automatically):
config_init— writes a starterconfig.jsonat the resolved path (or a custompath).config_status— reports the resolved path, whether it loaded, and the active environment.
After you create/edit config.json it's picked up automatically on the next tool call — no restart needed. Keep secrets out of the file with ${ENV_VAR} placeholders.
Config field reference
Field | Scope | Default | Description |
| root | — | Map of named environments (required) |
| root | — | Default environment to use (required) |
| root |
| Request timeout in ms |
| root |
| Seconds to cache Swagger docs |
| root |
| Max chars per tool response ( |
| root | JSON defaults | Headers merged into every request |
| root / env |
| TLS verification |
| root |
| HTTP redirects to follow ( |
| root |
| Max response/request bytes (DoS guard) |
| env | — | Base URL for relative paths |
| env | — | Swagger/OpenAPI JSON URL |
| env | none | Authentication block (see below) |
Any string value may contain ${ENV_VAR} placeholders, replaced with the matching environment variable at load time.
Authentication
Auth is configured per environment via an auth object with a type. Omit the auth block entirely if your API is public.
bearer — static bearer token:
"auth": { "type": "bearer", "token": "${API_TOKEN}" }apiKey — API key in a header or query:
"auth": { "type": "apiKey", "in": "header", "headerName": "X-Api-Key", "value": "${API_KEY}" }basic — HTTP basic auth:
"auth": { "type": "basic", "username": "${API_USER}", "password": "${API_PASS}" }login — POST credentials, then reuse the returned token (cached and refreshed automatically).
loginUrl, tokenPath and the expiry fields are all optional — when omitted, the server auto-discovers the login endpoint from the Swagger spec and auto-detects the token in the response.
Zero-config (auto):
"auth": {
"type": "login",
"credentials": { "email": "${API_USER}", "password": "${API_PASS}" }
}Explicit (manual):
"auth": {
"type": "login",
"loginUrl": "https://api.example.com/api/auth/login",
"credentials": { "email": "${API_USER}", "password": "${API_PASS}" },
"tokenPath": "data.accessToken",
"expiresInPath": "data.expiresIn",
"headerName": "Authorization",
"headerPrefix": "Bearer "
}Note: if auto-detection picks the wrong token, run the
inspect_logintool — it posts your credentials and returns the raw response plus suggestedtokenPathvalues.
| Required | Description |
| recommended | Body posted to the login endpoint |
| optional | Login endpoint; auto-discovered from Swagger if omitted |
| optional | Dot-path to the token; auto-detected if omitted |
| optional | Token lifetime (seconds / response path); auto-detected if omitted |
| optional | Defaults to |
| optional | Login request method (default |
Heads up: when migrating from 1.x, note that the old flat
auth: { email, password }is no longer supported. Move those values into anauthobject — most APIs map totype: "login"ortype: "basic".
Multiple environments
Define as many environments as you need and switch via activeEnvironment (or pass environment to any tool).
{
"environments": {
"local": { "baseUrl": "https://localhost:7000/api", "swaggerUrl": "https://localhost:7000/swagger/v1/swagger.json" },
"development": { "baseUrl": "https://dev-api.example.com/api", "swaggerUrl": "https://dev-api.example.com/swagger/v1/swagger.json" },
"beta": { "baseUrl": "https://beta-api.example.com/api", "swaggerUrl": "https://beta-api.example.com/swagger/v1/swagger.json" },
"production": {
"baseUrl": "https://api.example.com/api",
"swaggerUrl": "https://api.example.com/swagger/v1/swagger.json",
"rejectUnauthorized": true,
"auth": { "type": "bearer", "token": "${PROD_API_TOKEN}" }
}
},
"activeEnvironment": "local"
}Troubleshooting
No config found — run the config_init tool, then fill in config.json.
Relative URL requires a baseUrl — add baseUrl to the environment.
Failed to fetch Swagger — check that swaggerUrl is reachable from the machine running the server.
Login ... failed — check loginUrl, credentials and tokenPath; run inspect_login to see the raw response.
TLS / certificate errors — set rejectUnauthorized: false for that environment.
Security
The server holds API credentials and forwards them on the model's behalf:
Host allowlist: auth tokens are attached only when the target host matches the environment's
baseUrl/swaggerUrl/loginUrl. Calls to unrelated absolute URLs are sent without credentials.No redirects by default (
maxRedirects: 0) so auth can't be carried to another host; setmaxRedirectsin config to opt in.inspect_loginmasks token/password values in its output;config_initonly writes inside the project/config directory; response headers are omitted unless you passincludeHeaders: true.Keep secrets in
${ENV_VAR}placeholders, not literals;config.jsonis git-ignored.
Development
git clone https://github.com/sametbrr/openapi-rest-mcp.git
cd openapi-rest-mcp
npm install
npm start # run the server
npm run dev # auto-reload
npm test # mock-API smoke testPublishing
Pushing a vX.Y.Z git tag triggers the GitHub Actions workflow that publishes to npm and creates a GitHub Release. The tag must match the version in package.json. Publishing uses npm trusted publishing (OIDC) from the protected npm environment, so no npm token is stored, and every release carries a provenance statement.
git tag v2.1.0
git push origin v2.1.0Links
Contributing
Questions and ideas: Discussions
Bugs: issue tracker
Pull requests: read the contribution guide first
Security reports: follow the security policy, not a public issue
License
MIT — see LICENSE.
Available Tools
12 toolsapi_deleteC
DELETE request to an API endpoint
Inputs: url (required), data, params, headers, +3 more.
api_getC
GET request to an API endpoint
Inputs: url (required), params, headers, maxChars, +2 more.
api_patchB
PATCH request to an API endpoint
Inputs: url (required), data (required), params, headers, +3 more.
api_postC
POST request to an API endpoint
Inputs: url (required), data (required), params, headers, +3 more.
api_putC
PUT request to an API endpoint
Inputs: url (required), data (required), params, headers, +3 more.
config_initA
Write a starter config.json (from config.example.json) so the user can fill it in. Writes to the resolved config path by default; will not overwrite unless force is true.
Inputs: path, force, maxChars.
config_statusA
Report where the config is looked for, whether it was found/loaded, the active environment, and the available environments. Use this to diagnose setup issues.
Inputs: maxChars.
inspect_loginA
POST credentials to the login endpoint and return the raw response plus suggested token paths. Use this to discover the right auth.tokenPath (and verify auto-discovered loginUrl) without committing config.
Inputs: loginUrl, maxChars, credentials, environment.
swagger_fetchC
Fetch and summarize Swagger/OpenAPI documentation for an environment
Inputs: maxChars, environment.
swagger_get_endpointC
Get detailed information about a specific endpoint from Swagger
Inputs: path (required), method (required), maxChars, environment, +1 more.
swagger_get_schemaC
Get a schema/model definition from Swagger documentation
Inputs: schemaName (required), maxChars, environment, resolveRefs.
swagger_list_endpointsB
List API endpoints from Swagger. Optionally fuzzy-search by keyword and/or filter by tag and method.
Inputs: tag, limit, method, search, +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
The api_* tools are cleanly separated by HTTP verb, and config_status/config_init and inspect_login have clear unique roles. The only soft overlap is between swagger_fetch (whole-spec summary) and swagger_list_endpoints (filtered endpoint listing), plus inspect_login vs api_post, but descriptions make the intended use cases distinguishable.
All names use snake_case with a domain prefix (api_, swagger_, config_) plus a verb, which is predictable and readable. The mix of prefixes is natural for this surface, though inspect_login breaks the prefix pattern and api_get-style verb-last ordering differs from swagger_list_endpoints verb-first ordering.
Twelve tools is well within the sweet spot for an OpenAPI/REST client. Each tool maps to a distinct capability (five HTTP methods, four swagger-inspection helpers, config diagnostics, login probing) with no filler.
CRUD coverage via HTTP verbs is complete, and swagger fetching/listing/detail/schema plus config init/status cover discovery and setup. Minor gaps remain: no HEAD/OPTIONS support, and no way to update or reset config or manage multiple environments beyond what config_init/status imply.
Maintenance
Related MCP Connectors
Turn any task into the right API calls: discover, evaluate, and integrate public APIs.
Connect ChatGPT or Claude to your CRM, store or shipping API. Keys stay out of the chat.
Build, debug and break hosted mock APIs from Claude: endpoints, stateful CRUD data, OpenAPI import, response variants and fault injection.
Point Gecko at an OpenAPI spec; get first-call-correct, auth-hidden agent tools.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables interaction with any REST API through token or login authentication, with automatic Swagger/OpenAPI documentation integration for endpoint discovery and comprehensive HTTP request support.7MIT
- AlicenseNot gradedqualityCmaintenanceEnables 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.14 npmMIT
- AlicenseNot gradedqualityCmaintenanceBridges any OpenAPI 3.x REST API to Claude Code by automatically generating one tool per endpoint from your spec, with full argument validation and auth support.5 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables Claude to discover and call any REST API from an OpenAPI/Swagger spec or Postman collection at runtime, with authentication, workflows, and prebuilt registry support.MIT