Universal OpenAPI to MCP relay server
npm install
Configure the server:
Copy env.example
to .env
:
cp env.example .env
Edit .env
with your API settings.
npm run build
npm start
The easiest way to test the server is with the public Petstore API:
SWAGGER_SOURCE=url
SWAGGER_URL=https://petstore.swagger.io/v2/swagger.json
AUTH_TYPE=none
Run the server:
npm run dev
You should see output like:
Loaded API: Swagger Petstore (v1.0.0)
Base URL: https://petstore.swagger.io/v2
Endpoints loaded: 20
Tools available: 20
Relay MCP Server running on stdio
Add to your Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"relay-petstore": {
"command": "node",
"args": [
"/Users/your-username/path/to/relay/dist/index.js"
],
"env": {
"SWAGGER_SOURCE": "url",
"SWAGGER_URL": "https://petstore.swagger.io/v2/swagger.json",
"AUTH_TYPE": "none"
}
}
}
}
Any MCP-compatible client can use this server by:
node dist/index.js
The linter may show errors before running npm install
. These will resolve after installing dependencies:
npm install
If you encounter build errors:
node_modules
and dist
directoriesnpm install
againnpm run build
“Cannot find module”:
npm run build
before npm start
“Could not determine API base URL”:
API_BASE_URL
in your .env
file“Failed to load OpenAPI spec”:
SWAGGER_URL
is accessibleFor development with auto-rebuild:
Terminal 1 (watch for changes):
npm run watch
Terminal 2 (run the server):
npm start