O
Openapi MCP
MCP server by broisnischal
Created 4/8/2026
Updated about 4 hours ago
README
Repository documentation and setup instructions
OpenAPI MCP Server (Hono + Node.js)
This project exposes an MCP server over HTTP using Hono at /mcp.
It gives three tools:
api_search: find operations from an OpenAPI specapi_execute: call one operation byoperationId(ormethod + path)session: store and read session variables (token, ids, etc.)
Requirements
- Node.js 18+ installed
Install
npm install
Run
npm run dev
Server endpoints:
http://localhost:3000/http://localhost:3000/healthhttp://localhost:3000/mcp
Configure environment (optional)
OPENAPI_SPEC_URL: OpenAPI JSON URL (default:https://ag.nischal-dahal.com.np/api-docs-json)OPENAPI_SPEC_FILE: path to cached OpenAPI fileOPENAPI_SPEC_OFFLINE=1: force offline mode and only use cached fileAPI_BASE_URL: override API base URL used for executionPORT: HTTP server port (default3000)
If the spec URL is temporarily unavailable (for example 502), the MCP server now stays alive and returns a structured tool error with recovery hints instead of crashing.
Use with an MCP client
Add an MCP server entry that points to this URL:
{
"mcpServers": {
"openapi-hono": {
"url": "https://dx.lexicon.website/mcp",
"env": {
"OPENAPI_SPEC_URL": "https://ag.nischal-dahal.com.np/api-docs-json"
}
}
}
}
Where to set the OpenAPI spec URL
You can set the spec URL in two ways:
- Server default (recommended): set
OPENAPI_SPEC_URLbefore starting server.
OPENAPI_SPEC_URL="https://your-api.com/openapi.json" npm run dev
- Per request override: pass
specUrlinapi_searchorapi_executearguments.
{
"name": "api_search",
"arguments": {
"query": "users list",
"specUrl": "https://your-api.com/openapi.json"
}
}
Typical usage flow
- Find operations:
{
"name": "api_search",
"arguments": {
"query": "login auth token",
"limit": 10
}
}
- Execute operation:
{
"name": "api_execute",
"arguments": {
"operationId": "auth_login",
"body": {
"email": "user@example.com",
"password": "secret"
},
"extractVariables": {
"token": "$.data.token"
}
}
}
- Reuse stored session token automatically (or inspect with
sessiontool):
{
"name": "session",
"arguments": {
"action": "getVariables"
}
}
Quick Setup
Installation guide for this server
Install Package (if required)
npx @modelcontextprotocol/server-openapi-mcp
Cursor configuration (mcp.json)
{
"mcpServers": {
"broisnischal-openapi-mcp": {
"command": "npx",
"args": [
"broisnischal-openapi-mcp"
]
}
}
}