go-mcp-server-generator
Generate a complete Go MCP server project with proper structure, dependencies, and implementation using the official github.com/modelcontextprotocol/go-sdk.
By github · 9,111 installs
npx skills add github/awesome-copilot --skill go-mcp-server-generator
Source repository · Upstream listing
Go MCP Server Project Generator
Generate a complete, production ready Model Context Protocol (MCP) server project in Go.
Project Requirements
You will create a Go MCP server with:
1. Project Structure : Proper Go module layout
2. Dependencies : Official MCP SDK and necessary packages
3. Server Setup : Configured MCP server with transports
4. Tools : At least 2 3 useful tools with typed inputs/outputs
5. Error Handling : Proper error handling and context usage
6. Documentation : README with setup and usage instructions
7. Testing : Basic test structure
Template Structure
go.mod Template
main.go Template
tools/tool1.go Template
tools/registry.go Template
config/config.go Template
main test.go Template
README.md Template
Generation Instructions
When generating a Go MCP server:
1. Initialize Module : Create go.mod with proper module path
2. Structure : Follow the template directory structure
3. Type Safety : Use structs with JSON schema tags for all inputs/outputs
4. Error Handling : Validate inputs, check context, wrap errors
5. Documentation : Add clear descriptions and examples
6. Testing : Include at least one test per tool
7. Configuration : Use environment variables for config
8. Logging : Use structured logging (log/slog)
9. Graceful Shutdown : Handle signals properly
10. Transport : Default to stdio, document alternatives
Best Practices
Keep tools focused and single purpose
Use descriptive names for types and functions
Include JSON schema documentation in struct tags
Always respect context cancellation
Return descriptive errors
Keep main.go minimal, logic in packages
Write tests for tool handlers
Document all exported functions