mcp -openapi
MCP Server from OpenAPI specification
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:
-
Clone the repository: git clone https://github.com/mandarpaithankar/mcp-openapi-server.git cd mcp-openapi-server
-
Install dependencies and build (Go modules are used): go mod tidy
-
Build the server (or use the provided build script if available): chmod +x build.sh ./build.sh
-
Run the server with your OpenAPI spec (example): ./mcp-openapi-server -spec /path/to/your/openapi-spec.json
-
(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
trpc-agent-go
trpc-agent-go is a powerful Go framework for building intelligent agent systems using large language models (LLMs) and tools.
station
Station is our open-source runtime that lets teams deploy agents on their own infrastructure with full control.
tiger-cli
Tiger CLI is the command-line interface for Tiger Cloud. It includes an MCP server for helping coding agents write production-level Postgres code.
gopls
MCP server for golang projects development: Expand AI Code Agent ability boundary to have a semantic understanding and determinisic information for golang projects.
kubernetes
A Model Context Protocol (MCP) server for the Kubernetes API.
gcp-cost
💰 An MCP server that enables AI assistants to estimate Google Cloud costs, powered by Cloud Billing Catalog API and built with Genkit for Go