Relay your APIs to AI in seconds
npm install
npm run build
Run with Petstore API:
SWAGGER_SOURCE=url \
SWAGGER_URL=https://petstore.swagger.io/v2/swagger.json \
AUTH_TYPE=none \
node dist/index.js
Expected output:
Loaded API: Swagger Petstore (v1.0.7)
Base URL: https://petstore.swagger.io/v2
Endpoints loaded: 20
Tools available: 20
Relay MCP Server running on stdio
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"relay-petstore": {
"command": "node",
"args": [
"/Users/rodin/Workspace/algovate/lab/relay/dist/index.js"
],
"env": {
"SWAGGER_SOURCE": "url",
"SWAGGER_URL": "https://petstore.swagger.io/v2/swagger.json",
"AUTH_TYPE": "none"
}
}
}
}
Restart Claude Desktop
Test it: Ask Claude to “List all available pets from the petstore”
{
"command": "node",
"args": ["./dist/index.js"],
"env": {
"SWAGGER_SOURCE": "url",
"SWAGGER_URL": "https://petstore.swagger.io/v2/swagger.json",
"AUTH_TYPE": "none"
}
}
{
"command": "node",
"args": ["./dist/index.js"],
"env": {
"SWAGGER_SOURCE": "url",
"SWAGGER_URL": "https://api.example.com/openapi.json",
"AUTH_TYPE": "bearer",
"AUTH_TOKEN": "your-secret-token"
}
}
{
"command": "node",
"args": ["./dist/index.js"],
"env": {
"SWAGGER_SOURCE": "url",
"SWAGGER_URL": "https://api.example.com/swagger.json",
"AUTH_TYPE": "apikey",
"AUTH_API_KEY": "your-api-key",
"AUTH_API_KEY_NAME": "X-API-Key",
"AUTH_API_KEY_IN": "header"
}
}
{
"command": "node",
"args": ["./dist/index.js"],
"env": {
"SWAGGER_SOURCE": "file",
"SWAGGER_FILE": "./specs/my-api.yaml",
"API_BASE_URL": "https://api.myservice.com",
"AUTH_TYPE": "basic",
"AUTH_USERNAME": "user",
"AUTH_PASSWORD": "pass"
}
}
Variable | Required | Default | Description |
---|---|---|---|
SWAGGER_SOURCE |
Yes | url |
Source type: file or url |
SWAGGER_URL |
If source=url | - | URL to OpenAPI spec |
SWAGGER_FILE |
If source=file | - | Path to OpenAPI spec file |
API_BASE_URL |
No | From spec | Override base URL for API calls |
AUTH_TYPE |
No | none |
Auth type: none , apikey , bearer , basic |
AUTH_TOKEN |
If bearer | - | Bearer token |
AUTH_API_KEY |
If apikey | - | API key value |
AUTH_API_KEY_NAME |
If apikey | X-API-Key |
API key header/param name |
AUTH_API_KEY_IN |
If apikey | header |
Where to send key: header or query |
AUTH_USERNAME |
If basic | - | Basic auth username |
AUTH_PASSWORD |
If basic | - | Basic auth password |
TIMEOUT |
No | 30000 |
Request timeout in milliseconds |
The server generates tool names from API endpoints:
GET /pets
→ get_pets
POST /pets
→ post_pets
GET /pets/{petId}
→ get_pets_petid
PUT /users/{id}/profile
→ put_users_id_profile
If the OpenAPI spec has operationId
, that will be used instead (cleaned up to be valid identifier).