mcpgen
by lyeslabs·★ 90·Score 44
mcpgen is a Go tool that generates MCP server boilerplate from OpenAPI 3 specifications.
Overview
mcpgen is a command-line tool that transforms OpenAPI specifications into production-ready MCP server boilerplate. It supports both YAML and JSON OpenAPI 3.0 specifications and generates complete Go code including server initialization, tool registration, and handler skeletons with JSON schemas and response templates. The tool handles complex schema constructs, validation constraints, and multiple content types, making it easy to expose existing APIs as AI agent tools. It offers optional generation of HTTP clients and Go types, simplifying implementation logic within handlers.
Try asking AI
After installing, here are 6 things you can ask your AI assistant:
When to choose this
Choose mcpgen when you have existing OpenAPI documentation and want to rapidly expose those APIs as MCP tools without manually implementing server scaffolding.
When NOT to choose this
Don't choose mcpgen if you need to support protocols other than OpenAPI or if you're working with APIs that can't be described with OpenAPI specifications.
Comparable tools
Installation
Install mcpgen:
go install github.com/lyeslabs/mcpgen/cmd/mcpgen@latestOnce installed, generate an MCP server from your OpenAPI spec:
mcpgen --input openapi.yaml --output generated-serverIn Claude Desktop, configure the generated server by adding to claude_desktop_config.json:
{
"mcpServers": {
"my-api-server": {
"command": "go",
"args": ["run", "/path/to/generated-server/main.go"]
}
}
}FAQ
- What OpenAPI versions are supported?
- mcpgen supports OpenAPI 3.0 specifications in both YAML and JSON formats.
- Can I generate HTTP clients along with the MCP server?
- Yes, use the --includes flag with 'httpclient,types' to generate both a Go HTTP client and corresponding types.
- What complex schema constructs does mcpgen handle?
- It handles arrays, nested structures, type unions, oneOf/anyOf/allOf combinators, recursive type definitions, and validation constraints.
Compare mcpgen with
Last updated · Auto-generated from public README + GitHub signals.