MCP Catalogs
Home

mcpgen

by lyeslabs·90·Score 44

mcpgen is a Go tool that generates MCP server boilerplate from OpenAPI 3 specifications.

developer-toolsai-llmother
11
Forks
3
Open issues
12 mo ago
Last commit
2d ago
Indexed

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:

you:Transform existing REST APIs into AI-accessible tools without manual MCP implementation
you:Accelerate MCP server development for teams with existing OpenAPI documentation
you:Generate boilerplate code for MCP servers handling complex request/response schemas
you:What OpenAPI versions are supported?
you:Can I generate HTTP clients along with the MCP server?
you:What complex schema constructs does mcpgen handle?

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

openapi-to-mcpswagger-mcpapi-gateway-mcprest-mcp-generator

Installation

Install mcpgen:

go install github.com/lyeslabs/mcpgen/cmd/mcpgen@latest

Once installed, generate an MCP server from your OpenAPI spec:

mcpgen --input openapi.yaml --output generated-server

In 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

GitHub →

Last updated · Auto-generated from public README + GitHub signals.