Get the FREE Ultimate OpenClaw Setup Guide →

mcp -openapi

MCP Server from OpenAPI specification

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio mandar-p-mcp-server-openapi ./mcp-openapi-server -spec /path/to/your/openapi-spec.json \
  --env AUTH_BEARER_TOKEN="Optional default token for authentication (can be overridden with -auth flag)"

How to use

This MCP OpenAPI Server automatically generates MCP tools for every operation defined in your OpenAPI 3.x specification. Each REST endpoint/method combination becomes an MCP tool that Claude can invoke. Tools are named using the server's operationId when available (for example, api_getUserById) or a method/path based name if operationId is missing. You can start the server with your OpenAPI spec, optionally supply authentication headers and a custom base URL, and Claude can then call endpoints by name or via natural language queries that map to these tools. The server handles parameter validation, builds request URLs, attaches headers (including auth), executes HTTP requests, and returns well-formatted results.

How to install

Prerequisites:

  • Go 1.21 or higher
  • An OpenAPI 3.0/3.1 JSON specification file

Installation steps:

  1. Clone the repository: git clone https://github.com/mandarpaithankar/mcp-openapi-server.git cd mcp-openapi-server

  2. Install dependencies and build (Go modules are used): go mod tidy

  3. Build the server (or use the provided build script if available): chmod +x build.sh ./build.sh

  4. Run the server with your OpenAPI spec (example): ./mcp-openapi-server -spec /path/to/your/openapi-spec.json

  5. (Optional) Run with authentication and a custom base URL: ./mcp-openapi-server -spec /path/to/your/openapi-spec.json -auth "Bearer your-token" -base-url https://api.example.com

Additional notes

Tips and common issues:

  • Ensure your OpenAPI spec is valid JSON (YAML is not supported).
  • The server supports all standard HTTP methods defined in the spec (GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS).
  • If Claude cannot find a tool by name, check that your operationId is defined in the OpenAPI spec; tools are named api_{operationId} when available.
  • For large specs, the server may take a moment to load and validate; ensure you have enough memory and consider splitting very large specs.
  • If using base-url override, keep in mind any servers object in the spec may be superseded by the -base-url flag during requests.
  • Review timeout and error handling behavior in the OpenAPI implementation to tune for production usage.

Related MCP Servers

Sponsor this space

Reach thousands of developers