mcpgen

command module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 3 Imported by: 0

README

MCPGEN

codecov Go

A cookiecutter for bootstrapping MCP servers in Go.

Answer a few questions → get a clean, tested, inspector-ready MCP server in seconds.

Requirements

  • Go 1.25
  • Node.js (for inspector checks)
  • npx

Quick start

go install github.com/alesr/mcpgen@latest
mcpgen

You’ll get a small interactive flow. Press Enter to accept defaults.

CLI flags

You can also run in non-interactive mode with flags:

mcpgen --help

Inspector checks in flag mode run only when stdin is a TTY (matching the existing non-interactive default of skipping inspector checks).

Examples:

mcpgen --name weather --transport stdio
mcpgen --name weather --transport http --no-inspector

What it generates

  • cmd/<server>/main.go – entrypoint
  • internal/mcpapp/ – server wiring + handlers
  • internal/mcpapp/tools/handlers/ – stub tool handler(s)
  • internal/mcpapp/prompts/ – stub prompts
  • internal/mcpapp/resources/ – stub resources
  • internal/mcpapp/stubs/ – shared stub responses
  • unit tests for tools/prompts/resources (only for enabled features)

What happens after generation

MCPGEN runs a quick sanity pipeline in this order:

  • go mod tidy
  • gofmt -w .
  • go vet ./...
  • go test ./...

If everything passes, it runs the inspector checks for any enabled features.

Customize

Start by editing:

  • internal/mcpapp/tools/handlers/handlers.go
  • internal/mcpapp/prompts/prompts.go
  • internal/mcpapp/resources/resources.go

Replace the stub logic with your real implementation.

Notes

  • Default transport is stdio (best for local tools).
  • You can switch to HTTP in the setup flow if you want a networked server.

Screenshots

TODO

  • unit tests
  • package API
  • generate middleware
  • generate http wrapper

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
app
ui

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL