{"id":26775475,"url":"https://github.com/rethunk-tech/mcp-golang","last_synced_at":"2025-03-29T03:18:28.989Z","repository":{"id":284878505,"uuid":"956291658","full_name":"Rethunk-Tech/mcp-golang","owner":"Rethunk-Tech","description":"A Model Context Protocol (MCP) server that provides Go language tools for LLMs to analyze, test, and format Go code.","archived":false,"fork":false,"pushed_at":"2025-03-28T05:55:34.000Z","size":1080,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T06:28:40.057Z","etag":null,"topics":["ai","code-tools","go","golang","llm","mcp","model-context-protocol","static-analysis"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/Rethunk-Tech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-28T02:27:43.000Z","updated_at":"2025-03-28T05:55:38.000Z","dependencies_parsed_at":"2025-03-28T06:38:42.288Z","dependency_job_id":null,"html_url":"https://github.com/Rethunk-Tech/mcp-golang","commit_stats":null,"previous_names":["rethunk-tech/mcp-golang"],"tags_count":0,"template":false,"template_full_name":"Rethunk-Tech/mcp-template-node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rethunk-Tech%2Fmcp-golang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rethunk-Tech%2Fmcp-golang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rethunk-Tech%2Fmcp-golang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rethunk-Tech%2Fmcp-golang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rethunk-Tech","download_url":"https://codeload.github.com/Rethunk-Tech/mcp-golang/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246131335,"owners_count":20728303,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","code-tools","go","golang","llm","mcp","model-context-protocol","static-analysis"],"created_at":"2025-03-29T03:18:28.247Z","updated_at":"2025-03-29T03:18:28.980Z","avatar_url":"https://github.com/Rethunk-Tech.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MCP Golang\n\nA Model Context Protocol (MCP) server that provides Go language tools for LLMs to analyze, test, and format Go code.\n\n## What is MCP?\n\nThe Model Context Protocol (MCP) is a standardized way for applications to provide context to Large Language Models (LLMs). Learn more at the [Model Context Protocol Website](https://modelcontextprotocol.github.io/).\n\n## Features\n\n- TypeScript implementation with strict type checking\n- Full set of Go code analysis tools:\n  - `go_find_dead_code`: Find unused code in Go projects\n  - `go_vet`: Run Go's static analyzer\n  - `go_format`: Format Go code\n  - `go_lint`: Run Go linting\n  - `go_test`: Run Go tests\n  - `go_mod_tidy`: Clean up Go module dependencies\n- Comprehensive error handling and validation\n- Passes tool output directly to the LLM\n\n## Prerequisites\n\n- Node.js 18 or later\n- npm or yarn\n- Go 1.18 or later\n- The following Go tools installed:\n  - `golint`: `go install golang.org/x/lint/golint@latest`\n  - `deadcode`: `go install github.com/remyoudompheng/go-misc/deadcode@latest`\n\n## Project Structure\n\n```shell\nmcp-golang/\n├── build/                # Compiled JavaScript files\n├── cmd/                  # Example Go code for testing\n│   └── example/          # Simple Go application\n├── src/\n│   ├── __tests__/        # Integration tests and test utilities\n│   ├── errors/           # Custom error classes\n│   ├── tools/            # MCP tool implementations\n│   │   ├── goTools.ts    # Go tools for LLM\n│   │   └── noteTools.ts  # Example note tools\n│   ├── types/            # TypeScript type definitions\n│   └── index.ts          # Main server entry point\n├── package.json          # Project configuration\n├── tsconfig.json         # TypeScript configuration\n└── README.md             # Project documentation\n```\n\n## Getting Started\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/Rethunk-Tech/mcp-golang.git\n   cd mcp-golang\n   ```\n\n2. Install dependencies:\n\n   ```bash\n   yarn install\n   ```\n\n3. Build and run the server:\n\n   ```bash\n   yarn build\n   yarn start\n   ```\n\n## Development\n\n- Start TypeScript compiler in watch mode: `yarn dev`\n- Lint your code: `yarn lint`\n- Fix linting issues: `yarn lint:fix`\n- Run tests: `yarn test`\n\n## Testing with MCP Inspector\n\nFor standalone testing, use the MCP Inspector tool:\n\n```bash\nyarn inspector\n```\n\nThis will open an interactive session where you can test your MCP tools.\n\n## Available Go Tools\n\n### Find Dead Code\n\n```js\ngo_find_dead_code({\n  wd: \"/path/to/go/project\",\n  path: \"./...\"\n})\n```\n\nFinds unused code in Go projects.\n\n| Parameter | Type | Description | Default |\n|-----------|------|-------------|---------|\n| `wd` | string | Working directory where the command will be executed | (required) |\n| `path` | string | Path pattern to analyze (e.g., \"./...\", \"./pkg/...\", specific file) | \"./...\" |\n\n### Go Vet\n\n```js\ngo_vet({\n  wd: \"/path/to/go/project\",\n  path: \"./...\"\n})\n```\n\nRuns Go's built-in static analyzer to find potential issues.\n\n| Parameter | Type | Description | Default |\n|-----------|------|-------------|---------|\n| `wd` | string | Working directory where the command will be executed | (required) |\n| `path` | string | Path pattern to analyze (e.g., \"./...\", \"./pkg/...\", specific file) | \"./...\" |\n\n### Format Go Code\n\n```js\ngo_format({\n  wd: \"/path/to/go/project\",\n  path: \"./...\",\n  write: true\n})\n```\n\nFormats Go code. Set `write` to true to modify files directly.\n\n| Parameter | Type | Description | Default |\n|-----------|------|-------------|---------|\n| `wd` | string | Working directory where the command will be executed | (required) |\n| `path` | string | Path pattern of files to format (e.g., \"./...\", \"./pkg/...\", specific file) | \"./...\" |\n| `write` | boolean | Whether to write changes directly to the source files (true) or just output the diff (false) | false |\n\n### Lint Go Code\n\n```js\ngo_lint({\n  wd: \"/path/to/go/project\",\n  path: \"./...\"\n})\n```\n\nRuns the Go linter to check for style and potential issues.\n\n| Parameter | Type | Description | Default |\n|-----------|------|-------------|---------|\n| `wd` | string | Working directory where the command will be executed | (required) |\n| `path` | string | Path pattern to lint (e.g., \"./...\", \"./pkg/...\", specific file) | \"./...\" |\n\n### Run Go Tests\n\n```js\ngo_test({\n  wd: \"/path/to/go/project\",\n  path: \"./...\"\n})\n```\n\nRuns Go tests with verbose output.\n\n| Parameter | Type | Description | Default |\n|-----------|------|-------------|---------|\n| `wd` | string | Working directory where the command will be executed | (required) |\n| `path` | string | Path pattern for tests to run (e.g., \"./...\", \"./pkg/...\", specific package) | \"./...\" |\n\n### Tidy Go Module Dependencies\n\n```js\ngo_mod_tidy({\n  wd: \"/path/to/go/project\"\n})\n```\n\nCleans up Go module dependencies.\n\n| Parameter | Type | Description | Default |\n|-----------|------|-------------|---------|\n| `wd` | string | Working directory where the command will be executed (should contain go.mod file) | (required) |\n\n## Using with Cursor or Claude Desktop\n\nTo integrate this MCP server with Cursor or Claude Desktop, add the following configuration to your `mcp.json` file:\n\n```json\n{\n  \"mcpServers\": {\n    \"mcp-golang\": {\n      \"command\": \"cmd\",\n      \"args\": [\n        \"/c\",\n        \"node C:\\\\path\\\\to\\\\mcp-golang\\\\build\\\\index.js\"\n      ],\n      \"enabled\": true\n    }\n  }\n}\n```\n\nMake sure to replace `C:\\\\path\\\\to\\\\mcp-golang` with the actual path to your installation, using double backslashes for Windows paths.\n\nYou can then access the tools in Cursor or Claude Desktop with the following names:\n\n- `mcp_go_find_dead_code`\n- `mcp_go_vet`\n- `mcp_go_format`\n- `mcp_go_lint`\n- `mcp_go_test`\n- `mcp_go_mod_tidy`\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on how to contribute to this project.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frethunk-tech%2Fmcp-golang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frethunk-tech%2Fmcp-golang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frethunk-tech%2Fmcp-golang/lists"}