{"id":35094315,"url":"https://github.com/zeromicro/mcp-zero","last_synced_at":"2026-04-01T17:01:23.608Z","repository":{"id":324367266,"uuid":"1096983584","full_name":"zeromicro/mcp-zero","owner":"zeromicro","description":"Model Context Protocol (MCP) server for go-zero framework - Generate APIs, RPC services, and models with AI assistance.","archived":false,"fork":false,"pushed_at":"2026-01-31T07:01:58.000Z","size":243,"stargazers_count":38,"open_issues_count":2,"forks_count":11,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-27T23:42:26.678Z","etag":null,"topics":["ai-tools","code-generation","go-zero","golang","grpc","mcp","microservices","model-context-protocol","web-development"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zeromicro.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY_AUDIT.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-15T10:10:12.000Z","updated_at":"2026-03-24T07:30:52.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/zeromicro/mcp-zero","commit_stats":null,"previous_names":["zeromicro/mcp-zero"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/zeromicro/mcp-zero","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeromicro%2Fmcp-zero","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeromicro%2Fmcp-zero/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeromicro%2Fmcp-zero/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeromicro%2Fmcp-zero/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zeromicro","download_url":"https://codeload.github.com/zeromicro/mcp-zero/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeromicro%2Fmcp-zero/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31290538,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-tools","code-generation","go-zero","golang","grpc","mcp","microservices","model-context-protocol","web-development"],"created_at":"2025-12-27T15:04:24.314Z","updated_at":"2026-04-01T17:01:23.537Z","avatar_url":"https://github.com/zeromicro.png","language":"Go","funding_links":[],"categories":["📚 Projects (1974 total)"],"sub_categories":["MCP Servers"],"readme":"# Go-Zero MCP Tool\n\nA Model Context Protocol (MCP) tool that helps developers quickly scaffold and generate go-zero projects with ease.\n\n## Quick Start\n\n**New to mcp-zero?** Check out our [Quick Start Guide](QUICKSTART.md) for a step-by-step tutorial on getting started!\n\nThe quickstart covers:\n\n- Installation and configuration\n- Creating your first API service\n- Common use cases and workflows\n- Integration with Claude Desktop\n\n## Features\n\n### Core Service Generation\n\n- **Create API Services**: Generate new REST API services with customizable ports and styles\n- **Create RPC Services**: Generate gRPC services from protobuf definitions\n- **Generate API Code**: Convert API specification files to Go code\n- **Generate Models**: Create database models from various sources (MySQL, PostgreSQL, MongoDB, DDL)\n- **Create API Specs**: Generate sample API specification files\n\n### Advanced Features\n\n- **Analyze Projects**: Analyze existing go-zero projects to understand structure and dependencies\n- **Manage Configuration**: Generate configuration files with proper structure validation\n- **Generate Templates**: Create middleware, error handlers, and deployment templates\n- **Query Documentation**: Access go-zero concepts and migration guides from other frameworks\n- **Validate Input**: Comprehensive validation for API specs, protobuf definitions, and configurations\n\n## Prerequisites\n\n1. **Go** (1.19 or later)\n\n2. **go-zero CLI (goctl)**: Install with `go install github.com/zeromicro/go-zero/tools/goctl@latest`\n\n3. **Claude Desktop** (or other MCP-compatible client)\n\nFor detailed installation instructions, see the [Quick Start Guide](QUICKSTART.md).\n\n## Installation\n\n1. Create a new directory for your MCP tool:\n\n   ```bash\n   mkdir go-zero-mcp \u0026\u0026 cd go-zero-mcp\n   ```\n\n2. Initialize Go module:\n\n   ```bash\n   go mod init go-zero-mcp\n   ```\n\n3. Install dependencies:\n\n   ```bash\n   go get github.com/modelcontextprotocol/go-sdk\n   go get gopkg.in/yaml.v3\n   ```\n\n4. Save the main tool code as `main.go`\n\n5. Build the tool:\n\n   ```bash\n   go build -o go-zero-mcp main.go\n   ```\n\n## Configuration for Claude Desktop\n\nAdd this configuration to your Claude Desktop MCP settings:\n\n### macOS\n\nEdit `~/Library/Application Support/Claude/claude_desktop_config.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"mcp-zero\": {\n      \"command\": \"/path/to/your/mcp-zero\",\n      \"env\": {\n        \"GOCTL_PATH\": \"/Users/yourname/go/bin/goctl\"\n      }\n    }\n  }\n}\n```\n\n### Linux\n\nEdit `~/.config/Claude/claude_desktop_config.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"mcp-zero\": {\n      \"command\": \"/path/to/your/mcp-zero\",\n      \"env\": {\n        \"GOCTL_PATH\": \"/usr/local/bin/goctl\"\n      }\n    }\n  }\n}\n```\n\n### Windows\n\nEdit `%APPDATA%\\Claude\\claude_desktop_config.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"mcp-zero\": {\n      \"command\": \"C:\\\\path\\\\to\\\\your\\\\mcp-zero.exe\",\n      \"env\": {\n        \"GOCTL_PATH\": \"C:\\\\Go\\\\bin\\\\goctl.exe\"\n      }\n    }\n  }\n}\n```\n\n## Available Tools\n\n### 1. create_api_service\n\nCreates a new go-zero API service.\n\n**Parameters:**\n\n- `service_name` (required): Name of the API service\n- `port` (optional): Port number (default: 8888)\n- `style` (optional): Code style - \"go_zero\" or \"gozero\" (default: \"go_zero\")\n- `output_dir` (optional): Output directory (default: current directory)\n\n### 2. create_rpc_service\n\nCreates a new go-zero RPC service from protobuf definition.\n\n**Parameters:**\n\n- `service_name` (required): Name of the RPC service\n- `proto_content` (required): Protobuf definition content\n- `output_dir` (optional): Output directory (default: current directory)\n\n### 3. generate_api_from_spec\n\nGenerates go-zero API code from an API specification file.\n\n**Parameters:**\n\n- `api_file` (required): Path to the .api specification file\n- `output_dir` (optional): Output directory (default: current directory)\n- `style` (optional): Code style - \"go_zero\" or \"gozero\" (default: \"go_zero\")\n\n### 4. generate_model\n\nGenerates database model code from database schema.\n\n**Parameters:**\n\n- `source_type` (required): Source type - \"mysql\", \"postgresql\", \"mongo\", or \"ddl\"\n- `source` (required): Database connection string or DDL file path\n- `table` (optional): Specific table name (for database sources)\n- `output_dir` (optional): Output directory (default: \"./model\")\n\n### 5. create_api_spec\n\nCreates a sample API specification file.\n\n**Parameters:**\n\n- `service_name` (required): Name of the API service\n- `endpoints` (required): Array of endpoint objects with method, path, and handler\n- `output_file` (optional): Output file path (default: service_name.api)\n\n### 6. analyze_project\n\nAnalyzes an existing go-zero project structure and dependencies.\n\n**Parameters:**\n\n- `project_dir` (required): Path to the project directory\n- `analysis_type` (optional): Type of analysis - \"api\", \"rpc\", \"model\", or \"full\" (default: \"full\")\n\n### 7. generate_config\n\nGenerates configuration files for go-zero services.\n\n**Parameters:**\n\n- `service_name` (required): Name of the service\n- `service_type` (required): Service type - \"api\" or \"rpc\"\n- `config_type` (optional): Configuration type - \"dev\", \"test\", or \"prod\" (default: \"dev\")\n- `output_file` (optional): Output file path (default: etc/{service_name}.yaml)\n\n### 8. generate_template\n\nGenerates common code templates for go-zero services.\n\n**Parameters:**\n\n- `template_type` (required): Template type - \"middleware\", \"error_handler\", \"dockerfile\", \"docker_compose\", or \"kubernetes\"\n- `service_name` (required): Name of the service\n- `output_path` (optional): Output file path (uses defaults based on template type)\n\n### 9. query_docs\n\nQueries go-zero documentation and migration guides.\n\n**Parameters:**\n\n- `query` (required): Natural language query about go-zero concepts or migration\n- `doc_type` (optional): Documentation type - \"concept\", \"migration\", or \"both\" (default: \"both\")\n\n### 10. validate_input\n\nValidates API specs, protobuf definitions, or configuration files.\n\n**Parameters:**\n\n- `input_type` (required): Input type - \"api_spec\", \"proto\", or \"config\"\n- `content` (required): Content to validate\n- `strict` (optional): Enable strict validation mode (default: false)\n\n## Usage Examples\n\n### Creating a New API Service\n\n```text\nPlease create a new go-zero API service called \"user-service\" on port 8080\n```\n\n### Creating an RPC Service\n\n```text\nCreate a new go-zero RPC service called \"auth-service\" with this protobuf definition:\n\nsyntax = \"proto3\";\n\npackage auth;\n\noption go_package = \"./auth\";\n\nservice AuthService {\n  rpc Login(LoginRequest) returns (LoginResponse);\n  rpc Logout(LogoutRequest) returns (LogoutResponse);\n}\n\nmessage LoginRequest {\n  string username = 1;\n  string password = 2;\n}\n\nmessage LoginResponse {\n  string token = 1;\n  int64 expires_at = 2;\n}\n\nmessage LogoutRequest {\n  string token = 1;\n}\n\nmessage LogoutResponse {\n  bool success = 1;\n}\n```\n\n### Generating Models from Database\n\n```text\nGenerate go-zero models from my MySQL database with connection string \"user:password@tcp(localhost:3306)/mydb\"\n```\n\n### Creating an API Specification\n\n```text\nCreate an API specification for a \"blog-service\" with these endpoints:\n- GET /api/posts (handler: GetPostsHandler)\n- POST /api/posts (handler: CreatePostHandler)\n- GET /api/posts/:id (handler: GetPostHandler)\n- PUT /api/posts/:id (handler: UpdatePostHandler)\n- DELETE /api/posts/:id (handler: DeletePostHandler)\n```\n\n### Analyzing a Project\n\n```text\nAnalyze my go-zero project in /path/to/myproject to understand its structure\n```\n\n### Generating Configuration\n\n```text\nGenerate a production configuration file for my \"order-service\" API service\n```\n\n### Generating Templates\n\n```text\nGenerate a middleware template for my \"auth-service\"\n```\n\n### Querying Documentation\n\n```text\nHow do I implement JWT authentication in go-zero?\n```\n\n```text\nHow do I migrate from Express.js to go-zero?\n```\n\n### Validating Input\n\n```text\nValidate this API spec file at /path/to/service.api with strict mode enabled\n```\n\n## Project Structure\n\nAfter building, your MCP server will have the following structure:\n\n```text\nmcp-zero/\n├── main.go                    # Entry point and tool registration\n├── tools/                     # Tool implementations\n│   ├── create_api_service.go\n│   ├── create_rpc_service.go\n│   ├── generate_api.go\n│   ├── generate_model.go\n│   ├── create_api_spec.go\n│   ├── analyze_project.go\n│   ├── generate_config.go\n│   ├── generate_template.go\n│   ├── query_docs.go\n│   └── validate_input.go\n├── internal/                  # Internal packages\n│   ├── analyzer/             # Project analysis\n│   ├── validation/           # Input validation\n│   ├── security/             # Credential handling\n│   ├── templates/            # Code templates\n│   ├── docs/                 # Documentation database\n│   ├── logging/              # Structured logging\n│   └── metrics/              # Performance metrics\n└── tests/                     # Test suites\n    ├── integration/\n    └── unit/\n```\n\n## Architecture\n\nThe MCP server is built with:\n\n- **MCP SDK**: Uses github.com/modelcontextprotocol/go-sdk for protocol implementation\n- **Transport**: stdio-based communication with Claude Desktop\n- **Code Generation**: Leverages go-zero's goctl CLI tool for generating production-ready code\n- **Validation**: Comprehensive input validation for safety and correctness\n- **Security**: Safe credential handling with environment variable substitution\n- **Observability**: Built-in logging and metrics for monitoring tool performance\n\n## Best Practices\n\n1. **Service Naming**: Use lowercase with hyphens (e.g., \"user-service\", \"auth-api\")\n2. **Port Configuration**: Choose unique ports for each service (8080-8090 range recommended)\n3. **Code Style**: Stick to \"go_zero\" style for consistency with official conventions\n4. **Configuration**: Use environment-specific configs (dev, test, prod)\n5. **Documentation**: Query docs regularly to stay aligned with go-zero best practices\n6. **Validation**: Always validate inputs before generation to catch errors early\n\n## Troubleshooting\n\n### Common Issues\n\n1. **goctl command not found**: Make sure goctl is installed and in your PATH\n2. **Permission denied**: Ensure the MCP tool executable has proper permissions\n3. **Database connection errors**: Verify connection strings and database accessibility\n\n### Debug Mode\n\nTo enable debug logging, set the environment variable:\n\n```bash\nexport MCP_DEBUG=1\n```\n\n## Contributing\n\nFeel free to extend this tool with additional go-zero features such as:\n\n- Dockerfile generation\n- Kubernetes manifest generation\n- Docker Compose file creation\n- API documentation generation\n- Testing template creation\n\n## License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\nCopyright (c) 2025 go-zero team\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeromicro%2Fmcp-zero","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzeromicro%2Fmcp-zero","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeromicro%2Fmcp-zero/lists"}