MCP server/ai-tools

mcp-openapi-runner MCP Server

Turn any OpenAPI spec into MCP tools for Claude — instantly.

saurav61091/mcp-openapi ↗by saurav61091updated
1

Add it to Claude Code

claude mcp add mcp-openapi -- npx -y mcp-openapi --spec https://petstore3.swagger.io/api/v3/openapi.json
2

Make your agent remember this setup

mcp-openapi's config, env vars, and the gotchas you hit — recalled in every future Claude Code, Cursor, and Codex session.

npx conare@latest

Free · one command · indexes the sessions already on disk. Set up in the browser instead →

What it does

  • Instant conversion of OpenAPI 3.x specs into Claude tools
  • Automatic resolution of all $ref references
  • Supports both JSON and YAML specification formats
  • Built-in authentication support for Bearer, API Key, and Basic Auth
  • Two-tool design for clear discover-and-call workflows

Tools 2

list_endpointsReturns all operations grouped by tag with operationIds, methods, paths, and required parameters
call_endpointExecutes any operation by operationId with path/query/body parameters

Environment Variables

OPENAPI_BEARER_TOKENBearer token for Authorization header
OPENAPI_API_KEYAPI key value
OPENAPI_API_KEY_HEADERHeader name for API key (default: X-Api-Key)
OPENAPI_BASIC_USERHTTP Basic auth username
OPENAPI_BASIC_PASSHTTP Basic auth password

Try it

List all available endpoints for the connected API.
Find the operation ID for creating a new user and call it with the name 'John Doe'.
Get the current status of the pet store API and list all available pets.
Call the endpoint to update the resource with ID 123 using the provided JSON body.
Original README from saurav61091/mcp-openapi

mcp-openapi

Turn any OpenAPI spec into MCP tools for Claude — instantly.

Point mcp-openapi at any OpenAPI 3.x spec and Claude can call every endpoint through natural language. No custom integration code. No manual tool definitions. One line of config.

Quick start

Add to your Claude Desktop / Cursor / Cline MCP config:

{
  "mcpServers": {
    "my-api": {
      "command": "npx",
      "args": ["-y", "mcp-openapi", "--spec", "https://petstore3.swagger.io/api/v3/openapi.json"]
    }
  }
}

That's it. Claude can now discover and call every endpoint in that API.

Example conversation

You: What pets are available, and add a new dog named Buddy

Claude: Let me check what's available first. [calls list_endpoints → sees findPetsByStatus, addPet, etc.] [calls call_endpoint with findPetsByStatus, status=available]

There are 3 pets currently available. Now I'll add Buddy... [calls call_endpoint with addPet, body {"name":"Buddy","status":"available"}]

Done! Buddy has been added with ID 12345.

Authentication

Pass credentials via environment variables:

{
  "mcpServers": {
    "my-api": {
      "command": "npx",
      "args": ["-y", "mcp-openapi", "--spec", "https://api.example.com/openapi.json"],
      "env": {
        "OPENAPI_BEARER_TOKEN": "your-token-here"
      }
    }
  }
}
Variable Description
OPENAPI_BEARER_TOKEN Bearer token → Authorization: Bearer <token>
OPENAPI_API_KEY API key value
OPENAPI_API_KEY_HEADER Header name for API key (default: X-Api-Key)
OPENAPI_BASIC_USER HTTP Basic auth username
OPENAPI_BASIC_PASS HTTP Basic auth password

Tools

mcp-openapi exposes exactly two tools:

Tool Description
list_endpoints Returns all operations grouped by tag with operationIds, methods, paths, and required parameters
call_endpoint Executes any operation by operationId with path/query/body parameters

The two-tool design means Claude always has a clear workflow: discover → call.

Using a local spec file

{
  "mcpServers": {
    "my-api": {
      "command": "npx",
      "args": ["-y", "mcp-openapi", "--spec", "/path/to/your/openapi.yaml"]
    }
  }
}

Supports both JSON and YAML specs. All $ref references are resolved automatically.

Requirements

  • Node.js 18+
  • OpenAPI 3.x spec (JSON or YAML, local file or URL)

Real-world examples

Stripe API:

["--spec", "https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.json"]

GitHub REST API:

["--spec", "https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.json"]

Your internal API:

["--spec", "http://localhost:8080/openapi.json"]

CLI usage

# From URL
npx mcp-openapi --spec https://api.example.com/openapi.json

# From file
npx mcp-openapi --spec ./openapi.yaml

# With auth
OPENAPI_BEARER_TOKEN=mytoken npx mcp-openapi --spec https://api.example.com/openapi.json

# Help
npx mcp-openapi --help

How it works

  1. At startup, loads the spec from the given URL or file path
  2. Dereferences all $ref schemas using @apidevtools/swagger-parser
  3. Registers two MCP tools with the connected client
  4. list_endpoints generates a human+LLM-readable summary of all operations
  5. call_endpoint resolves path params, builds the URL, attaches auth headers, and returns the response

License

MIT

Frequently Asked Questions

What are the key features of mcp-openapi-runner?

Instant conversion of OpenAPI 3.x specs into Claude tools. Automatic resolution of all $ref references. Supports both JSON and YAML specification formats. Built-in authentication support for Bearer, API Key, and Basic Auth. Two-tool design for clear discover-and-call workflows.

What can I use mcp-openapi-runner for?

Interacting with public APIs like Stripe or GitHub directly from Claude. Testing internal microservices by pointing to local OpenAPI files. Rapid prototyping of API integrations without writing custom client code. Automating data retrieval and updates from REST APIs using natural language.

How do I install mcp-openapi-runner?

Install mcp-openapi-runner by running: npx -y mcp-openapi --spec <url-or-path>

What MCP clients work with mcp-openapi-runner?

mcp-openapi-runner works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Conare · memory for coding agents

Turn this server into reusable context

Keep mcp-openapi-runner docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Set up free$npx conare@latest