openapi-to
This go package will consume some open api specs, and generate code for an mcp server.
claude mcp add --transport stdio djpiper28-openapi-to-mcp-server docker run -i djpiper28/openapi-to-mcp-server \ --env OUTPUT_DIR="Path inside the container to place the generated MCP server (if supported by image)" \ --env OPENAPI_SPEC_URL="URL to the OpenAPI specification to generate the MCP server from"
How to use
This MCP server implementation is a Go-based tool designed to consume an OpenAPI specification and generate code for an MCP (Minecraft Protocol) server. It automates the translation of API definitions into server-side scaffolding, handlers, and types that can be wired into an MCP runtime. To use it, provide the OpenAPI specification you want to base your MCP server on, then run the generator to produce the resulting MCP server code or artifacts. Once generated, integrate the output into your MCP runtime, build or run the server binary, and start serving clients that conform to the generated API surface. If the tool supports generation from a URL or local file, you can point it to either location as your source of truth for the API design.
How to install
Prerequisites:
- Docker installed on your machine (or Go toolchain if using a local build via Go).
- Access to the OpenAPI specification you want to base your MCP server on.
Using Docker (recommended if a prebuilt image is provided):
- Pull and run the image with your OpenAPI spec configured via environment variables.
- If the image supports mounting or URL-based specs, provide OPENAPI_SPEC_URL accordingly.
- Retrieve the generated server artifacts from the container or designated output directory.
Example steps:
- Ensure Docker is running.
- Run the generator container with your spec URL:
docker run -i
-e OPENAPI_SPEC_URL=https://example.com/api/openapi.yaml
-e OUTPUT_DIR=/out
djpiper28/openapi-to-mcp-server - If the image writes to a mounted volume, mount a local directory to /out to retrieve the generated code.
Alternative (Go-based local build, if available):
- Install Go from https://golang.org/dl/
- Clone the repository: git clone https://github.com/djpiper28/openapi-to-mcp-server.git
- Navigate to the project directory: cd openapi-to-mcp-server
- Build: go build ./...
- Run: ./openapi-to-mcp-server --spec https://example.com/openapi.yaml --output ./generated-mcp
- Retrieve and integrate the generated MCP server code from the output directory.
Additional notes
Tips:
- Ensure your OpenAPI spec is valid and follows the conventions expected by the generator (schemas, paths, and components).
- If using Docker, verify that the container has network access to fetch the OpenAPI spec URL or that you mount a local file path.
- Some generators require specific versions of the OpenAPI spec (e.g., OpenAPI 3.0 vs 3.1); check the image documentation for compatibility.
- Output artifacts may include server skeletons, types, and handler stubs which you will need to implement with your MCP runtime.
- If you encounter permission or file path issues, confirm that the output directory is writable by the container or the Go binary.
- Environment variables can often be extended for authentication, spec caching, or custom templates; consult the image or repository README for supported vars.
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