
Dynamic MCP server that auto-generates tools from OpenAPI/Swagger specs
Dynamic MCP server that auto-generates tools from OpenAPI/Swagger specs
·
A dynamic Model Context Protocol (MCP) server that automatically discovers and generates tools from any REST API using OpenAPI/Swagger specifications. Point it at any OpenAPI spec and it instantly exposes every endpoint as an MCP tool — zero manual configuration.
For full documentation, guides, and examples, visit:
https://nife.io/mcp_opensource
pip install nife-restapi-mcp-serverThere are four ways to configure the server. They are applied in priority order — higher entries win:
| Priority | Method | Best for |
|---|---|---|
| 1 | CLI arguments | One-off runs, testing |
| 2 | Environment variables | Docker, CI/CD, shell scripts |
| 3 | .env file | Local development |
| 4 | Defaults | Nothing required by default |
restapi-mcp-server --base-url https://api.example.com --spec-url https://api.example.com/openapi.json --token mytokenAll available flags:
--base-url URL REST API base URL (required if not set via env)
--spec-url URL OpenAPI/Swagger spec URL or local file path (required if not set via env)
--token TOKEN API access token for bearer authentication
--auth-type TYPE Authentication type: bearer, apikey, basic, none (default: bearer)
--mode stdio|http Server mode (default: stdio)
--port PORT HTTP port, only used in http mode (default: 8080)
--host HOST HTTP host, only used in http mode (default: 0.0.0.0)
--log-level LEVEL Logging level: DEBUG, INFO, WARNING, ERROR (default: INFO)
--env-file PATH Path to a custom .env file
--version Show version and exitexport REST_API_BASE_URL=https://api.example.com
export OPENAPI_SPEC_URL=https://api.example.com/openapi.json
export API_ACCESS_TOKEN=your_token_here
export MCP_MODE=stdio
restapi-mcp-server.env FileCreate a .env file in your working directory:
REST_API_BASE_URL=https://api.example.com
OPENAPI_SPEC_URL=https://api.example.com/openapi.json
API_ACCESS_TOKEN=your_token_here
AUTH_TYPE=bearer
MCP_MODE=stdio
LOG_LEVEL=INFOThen just run:
restapi-mcp-serverNo .env file needed. Pass everything via the env block in claude_desktop_config.json:
{
"mcpServers": {
"restapi": {
"command": "restapi-mcp-server",
"env": {
"REST_API_BASE_URL": "https://api.example.com",
"OPENAPI_SPEC_URL": "https://api.example.com/openapi.json",
"API_ACCESS_TOKEN": "your_token_here",
"MCP_MODE": "stdio",
"ENABLE_HTTP_ENDPOINT": "false"
}
}
}
}Claude Desktop injects the env block values directly into the process — this is the standard MCP pattern.
| Variable | Required | Default | Description |
|---|---|---|---|
REST_API_BASE_URL | Yes | — | REST API base URL |
OPENAPI_SPEC_URL | Yes | — | OpenAPI/Swagger spec URL or local file path |
AUTH_TYPE | No | bearer | Auth method: bearer, apikey, basic, none |
API_ACCESS_TOKEN | No | — | Bearer token for auth |
API_KEY_HEADER | No | X-API-Key | Header name for API key auth |
API_KEY_VALUE | No | — | API key value |
BASIC_AUTH_USERNAME | No | — | Username for basic auth |
BASIC_AUTH_PASSWORD | No | — | Password for basic auth |
MCP_MODE | No | stdio | stdio or http |
ENABLE_HTTP_ENDPOINT | No | true | Enable HTTP health/metrics endpoints |
MCP_SERVER_PORT | No | 8080 | HTTP server port |
MCP_SERVER_HOST | No | 0.0.0.0 | HTTP server host |
LOG_LEVEL | No | INFO | Logging verbosity |
REQUEST_TIMEOUT | No | 30 | Request timeout in seconds |
SCHEMA_CACHE_TTL | No | 3600 | Schema cache TTL in seconds |
stdio) — for Claude Desktop, Cursor, MCP clientsrestapi-mcp-server --base-url https://api.example.com --spec-url https://api.example.com/openapi.json --mode stdioCommunicates via stdin/stdout. No HTTP server is started. This is the default.
restapi-mcp-server --base-url https://api.example.com --spec-url https://api.example.com/openapi.json --mode http --port 8080Starts an HTTP server with health and metrics endpoints:
GET / — server infoGET /health — health checkGET /metrics — server metricsGET /schema — OpenAPI schema summaryGET /tools — all generated toolsGET /api/endpoints — all API endpointsAUTH_TYPE=bearer
API_ACCESS_TOKEN=your_tokenAUTH_TYPE=apikey
API_KEY_HEADER=X-API-Key
API_KEY_VALUE=your_keyAUTH_TYPE=basic
BASIC_AUTH_USERNAME=username
BASIC_AUTH_PASSWORD=passwordAUTH_TYPE=nonedocker build -t restapi-mcp-server .
docker run -p 8080:8080 \
-e REST_API_BASE_URL=https://api.example.com \
-e OPENAPI_SPEC_URL=https://api.example.com/openapi.json \
-e API_ACCESS_TOKEN=your_token \
-e MCP_MODE=http \
restapi-mcp-serverOr with Docker Compose:
cp .env.example .env # fill in your values
docker-compose upThe server dynamically generates the following tool types:
Named by HTTP method and path: <method>_<path_parts>
Examples:
get_userspost_usersget_users_by_iddelete_users_by_idput_users_by_idlist_available_endpoints — list all endpoints (filterable by method or path)get_endpoint_info — detailed info about a specific endpointget_schema_info — OpenAPI schema summary or specific model detailsexecute_custom_request — run any HTTP request with full controlhealth_check — server health and schema statusSupported spec sources:
list_available_endpoints, get_endpoint_info, get_schema_info tools built in[ERROR] REST API base URL not configured
Set REST_API_BASE_URL via any method above. The most common fix:
restapi-mcp-server --base-url https://your-api.com[ERROR] OpenAPI spec URL not configured
Set OPENAPI_SPEC_URL via any method above:
restapi-mcp-server --spec-url https://your-api.com/openapi.jsonPort already in use
Change the port:
restapi-mcp-server --mode http --port 9090Docker container exits immediately
Make sure you're using HTTP mode:
docker run -e MCP_MODE=http -e REST_API_BASE_URL=... -e OPENAPI_SPEC_URL=... restapi-mcp-serverSchema not loading
MIT
Pick your client and paste the snippet. Each one is the same server, written the way that client expects it.
claude mcp add restapi -- restapi-mcp-server{
"mcpServers": {
"restapi": {
"env": {
"MCP_MODE": "",
"API_ACCESS_TOKEN": "",
"OPENAPI_SPEC_URL": "",
"REST_API_BASE_URL": "",
"ENABLE_HTTP_ENDPOINT": ""
},
"command": "restapi-mcp-server"
}
}
}code --add-mcp '{"name":"restapi","env":{"MCP_MODE":"","API_ACCESS_TOKEN":"","OPENAPI_SPEC_URL":"","REST_API_BASE_URL":"","ENABLE_HTTP_ENDPOINT":""},"command":"restapi-mcp-server"}'[mcp_servers.restapi]
command = "restapi-mcp-server"Runs locally on your device. Your client starts the server itself, so nothing has to be hosted.
Paste this prompt into your agent. It reads this page and does the setup for you.
Read https://aiagentslisting.com/mcp/rest-api-mcp-server to learn what the "REST API MCP Server" MCP server does and how to install it. Add it to my coding agent's MCP configuration as documented on that page, then confirm the server connects and list the tools it exposes.Agents can also browse this directory over MCP at https://aiagentslisting.com/api/mcp
docker run -p 8080:8080
docker run -e MCP_MODE=http -e REST_API_BASE_URL=... -e OPENAPI_SPEC_URL=... restapi-mcp-serverThis server runs locally, so we can't read its tool list over the web yet.
We could not run this server: it ships no npx package for our sandbox and no public endpoint. The four checks that need a live server are left out, and the grade tops out at B until one exists.
Maintain this server? Claiming proves you own the listing and earns the last 4 points.
Claim this listingPaste this line near the top of your repository's README. The badge always renders the current score.
[](https://aiagentslisting.com/mcp/rest-api-mcp-server)Nothing comparable is listed yet.
No tagged releases on record.
Connect to the AI Agents Listing MCP server at https://aiagentslisting.com/api/mcp using the HTTP transport and complete the sign-in when it asks. Then call the submit_review tool for the listing "rest-api-mcp-server" with a rating from 1 to 5 and a short note on what worked and what did not.No reviews yet
Be the first to share your experience with this tool.
One email a week. New agents, MCP servers and skills, and what is actually getting traction.