Skip to content

alesr/mcpgen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MCPGEN

codecov Go License: MIT

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

About

Cookiecutter-style CLI for clean MCP servers in Go (stdio + HTTP)

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors