{"_id":"@ahhm/gitlab-mcp","_rev":"2-30c976db66f9f232f990363a1bfbc438","name":"@ahhm/gitlab-mcp","dist-tags":{"latest":"0.2.1"},"versions":{"0.2.0":{"name":"@ahhm/gitlab-mcp","version":"0.2.0","keywords":["mcp","model-context-protocol","gitlab","merge-request","comments","ai","llm","code-review"],"author":{"name":"Amirhossein"},"license":"MIT","_id":"@ahhm/gitlab-mcp@0.2.0","maintainers":[{"name":"ahhm","email":"amirhanife84@gmail.com"}],"homepage":"https://github.com/AmirhosseinHanifehzadeh/gitlab-mcp#readme","bugs":{"url":"https://github.com/AmirhosseinHanifehzadeh/gitlab-mcp/issues"},"bin":{"gitlab-mcp":"dist/index.js","ahhm-gitlab-mcp":"dist/index.js"},"dist":{"shasum":"708131d1f8690955f814a28e6709eb80cc60fb49","tarball":"https://registry.npmjs.org/@ahhm/gitlab-mcp/-/gitlab-mcp-0.2.0.tgz","fileCount":4,"integrity":"sha512-DkJhizW9lHt6I/ARqc5WENmauwTQZy4IaGkbllDGh1IsPqNIfrStQNH2cACMMZOr81KuPG8toI/k0/X0U+AI5Q==","signatures":[{"sig":"MEQCIGe20fYHPWyLHY3RukPKC3GTqkyUEnI2A4aZa5Oyhi7ZAiAsS9Q2d55SgqQmVIYHur90acZCD/tWSDjVZ7411dIAgg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":19035},"main":"dist/index.js","type":"module","engines":{"node":">=18.0.0"},"gitHead":"d7a791046cd4581afa53aa40306b1dcb3d7ed25a","scripts":{"build":"tsc -p tsconfig.json","start":"node dist/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"ahhm","email":"amirhanife84@gmail.com"},"repository":{"url":"git+https://github.com/AmirhosseinHanifehzadeh/gitlab-mcp.git","type":"git"},"_npmVersion":"11.5.1","description":"MCP server exposing a tool to fetch GitLab merge request comments.","directories":{},"_nodeVersion":"24.7.0","dependencies":{"zod":"^3.23.8","@modelcontextprotocol/sdk":"^1.21.1"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.6.3","@types/node":"^22.9.0"},"_npmOperationalInternal":{"tmp":"tmp/gitlab-mcp_0.2.0_1762608397843_0.1964699646256678","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@ahhm/gitlab-mcp","version":"0.2.1","type":"module","description":"MCP server exposing a tool to fetch GitLab merge request comments.","main":"dist/index.js","bin":{"gitlab-mcp":"dist/index.js","ahhm-gitlab-mcp":"dist/index.js"},"scripts":{"build":"tsc -p tsconfig.json","start":"node dist/index.js","prepublishOnly":"npm run build"},"keywords":["mcp","model-context-protocol","gitlab","merge-request","comments","ai","llm","code-review"],"author":{"name":"Amirhossein"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/AmirhosseinHanifehzadeh/gitlab-mcp.git"},"bugs":{"url":"https://github.com/AmirhosseinHanifehzadeh/gitlab-mcp/issues"},"homepage":"https://github.com/AmirhosseinHanifehzadeh/gitlab-mcp#readme","engines":{"node":">=18.0.0"},"dependencies":{"@modelcontextprotocol/sdk":"^1.21.1","zod":"^3.23.8"},"devDependencies":{"@types/node":"^22.9.0","typescript":"^5.6.3"},"_id":"@ahhm/gitlab-mcp@0.2.1","gitHead":"5563cc89c3298a3a77e7ce41123fad4caaf61c82","_nodeVersion":"24.7.0","_npmVersion":"11.5.1","dist":{"integrity":"sha512-sJ1HD2l+1adAwulMUSVAog16ezkBh1wrcQDReUdw2pMxSuQDg2GEmHZy9aPozoypAytPccdrOf3OjB4bQ7Rpcg==","shasum":"a23e32635b52d268037e4abfde1d71ffab62447f","tarball":"https://registry.npmjs.org/@ahhm/gitlab-mcp/-/gitlab-mcp-0.2.1.tgz","fileCount":4,"unpackedSize":19055,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHuWkkcurjvBI44gfOLrKeAy/WB1tHaG6pjecohdRwD7AiAW8XI+cCSDjRuq7+b05snnv0wbI1qI1M3N1SkH5K8Ysw=="}]},"_npmUser":{"name":"ahhm","email":"amirhanife84@gmail.com"},"directories":{},"maintainers":[{"name":"ahhm","email":"amirhanife84@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/gitlab-mcp_0.2.1_1762609140332_0.1760798150463696"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-08T13:26:37.746Z","modified":"2025-11-08T13:39:00.711Z","0.2.0":"2025-11-08T13:26:38.081Z","0.2.1":"2025-11-08T13:39:00.519Z"},"bugs":{"url":"https://github.com/AmirhosseinHanifehzadeh/gitlab-mcp/issues"},"author":{"name":"Amirhossein"},"license":"MIT","homepage":"https://github.com/AmirhosseinHanifehzadeh/gitlab-mcp#readme","keywords":["mcp","model-context-protocol","gitlab","merge-request","comments","ai","llm","code-review"],"repository":{"type":"git","url":"git+https://github.com/AmirhosseinHanifehzadeh/gitlab-mcp.git"},"description":"MCP server exposing a tool to fetch GitLab merge request comments.","maintainers":[{"name":"ahhm","email":"amirhanife84@gmail.com"}],"readme":"# GitLab MR Comments MCP Server\n\nA Model Context Protocol (MCP) server that fetches merge request comments from GitLab, including file names, line numbers, and comment text.\n\n## Features\n\n- Fetches comments from GitLab merge requests via the GitLab API\n- Returns structured data with:\n  - File name (if comment is on a specific file)\n  - Line number (if comment is on a specific line)\n  - Comment text\n  - Author information\n  - Creation timestamp\n  - Resolution status\n- Supports pagination\n- Optional filtering of resolved comments\n- SSL verification control\n\n## Installation\n\n```bash\nnpm install\nnpm run build\n```\n\n## Configuration\n\nSet the following environment variables:\n\n### Required\n\n- `GITLAB_HOST` or `GITLAB_BASE_URL`: Your GitLab instance URL (e.g., `https://gitlab.com`)\n- `GITLAB_TOKEN` or `GITLAB_PERSONAL_ACCESS_TOKEN`: Your GitLab personal access token\n\n### Optional\n\n- `GITLAB_SSL_VERIFY`: SSL certificate verification. Set to `0`, `false`, or `no` to disable (default: enabled)\n\n## Usage\n\n### As an MCP Server\n\nAdd to your MCP client configuration (e.g., Claude Desktop, Cline):\n\n```json\n{\n  \"mcpServers\": {\n    \"gitlab-mr-comments\": {\n      \"command\": \"node\",\n      \"args\": [\"/path/to/gitlab-mr-comments/dist/index.js\"],\n      \"env\": {\n        \"GITLAB_HOST\": \"https://gitlab.com\",\n        \"GITLAB_TOKEN\": \"your-gitlab-token-here\"\n      }\n    }\n  }\n}\n```\n\n### Using with AI Assistants\n\nWhen you paste a GitLab merge request URL to an AI assistant that has this MCP server configured, the AI should automatically:\n\n1. Parse the URL to extract the project path and MR IID\n2. Call the tool with the correct parameters\n3. Return the comments in a readable format\n\n**Example prompt:**\n\n```\nShow me the comments from this merge request:\nhttps://mars-gitlab.systemgroup.net/mars/general-market/-/merge_requests/7380\n```\n\nThe AI will extract:\n\n- Project: `mars/general-market`\n- MR IID: `7380`\n\nAnd call the tool accordingly.\n\n### Tool: `gitlab.get_merge_request_comments`\n\nFetches comments for a specific merge request.\n\n#### Parameters\n\n- `project_id` (string): Numeric project ID or full path (e.g., `\"123\"` or `\"mygroup/myproject\"`)\n- `merge_request_iid` (string): Internal IID of the merge request (e.g., `\"456\"`)\n- `per_page` (number, optional): Number of discussions per page (1-100, default: GitLab default of 20)\n- `page` (number, optional): Page of discussions to fetch (default: 1)\n- `include_resolved` (boolean, optional): Include resolved comments (default: `false`)\n\n#### Extracting Parameters from a GitLab URL\n\nGiven a merge request URL like:\n\n```\nhttps://mars-gitlab.systemgroup.net/mars/general-market/-/merge_requests/7380\n```\n\nExtract the parameters as:\n\n- `project_id`: `\"mars/general-market\"` (the path between the domain and `/-/merge_requests/`)\n- `merge_request_iid`: `\"7380\"` (the number after `/merge_requests/`)\n\n**Example:**\n\n```javascript\n{\n  \"project_id\": \"mars/general-market\",\n  \"merge_request_iid\": \"7380\"\n}\n```\n\n#### Example Response\n\n```json\n[\n  {\n    \"file\": \"src/index.ts\",\n    \"line\": 42,\n    \"text\": \"Consider refactoring this function for better readability\",\n    \"author\": \"john.doe\",\n    \"created_at\": \"2024-11-08T10:30:00.000Z\",\n    \"resolved\": false\n  },\n  {\n    \"file\": \"README.md\",\n    \"line\": 10,\n    \"text\": \"This documentation needs to be updated\",\n    \"author\": \"jane.smith\",\n    \"created_at\": \"2024-11-07T14:20:00.000Z\",\n    \"resolved\": true\n  },\n  {\n    \"file\": null,\n    \"line\": null,\n    \"text\": \"Overall, this looks good to merge!\",\n    \"author\": \"bob.wilson\",\n    \"created_at\": \"2024-11-08T09:00:00.000Z\",\n    \"resolved\": false\n  }\n]\n```\n\n## Development\n\n### Build\n\n```bash\nnpm run build\n```\n\n### Run\n\n```bash\nnpm start\n```\n\n## API Details\n\nThis server uses the GitLab REST API v4:\n\n- Endpoint: `/api/v4/projects/{project_id}/merge_requests/{merge_request_iid}/discussions`\n- Authentication: Personal Access Token via `PRIVATE-TOKEN` header\n\n## Debugging & Troubleshooting\n\n### Viewing Logs\n\nAll logs are written to **stderr** with the prefix `[MCP]`. When running in an MCP client, these logs will typically appear in the client's log file or console.\n\n**Example logs on startup:**\n\n```\n[MCP] ====================================\n[MCP] GitLab MR Comments MCP Server\n[MCP] Version: 0.1.0\n[MCP] ====================================\n[MCP] Node version: v20.x.x\n[MCP] Platform: linux\n[MCP] CWD: /path/to/project\n[MCP] Creating stdio transport...\n[MCP] Connecting server to transport...\n[MCP] ====================================\n[MCP] Server successfully connected!\n[MCP] Ready to receive tool calls\n[MCP] ====================================\n```\n\n**Example logs when tool is called:**\n\n```\n[MCP] Tool called with args: {\n  \"project_id\": \"mygroup/myproject\",\n  \"merge_request_iid\": 123\n}\n[MCP] Starting fetchMergeRequestComments\n[MCP] Resolving GitLab host from environment\n[MCP] Resolved host: https://gitlab.com\n[MCP] Resolving GitLab token from environment\n[MCP] Token found (length: 20)\n[MCP] SSL verification: enabled (default)\n[MCP] Project ID: mygroup%2Fmyproject\n[MCP] MR IID: 123\n[MCP] Request URL: https://gitlab.com/api/v4/projects/mygroup%2Fmyproject/merge_requests/123/discussions\n[MCP] Sending request to GitLab API...\n[MCP] Response status: 200 OK\n[MCP] Parsing response JSON...\n[MCP] Received 5 discussions\n[MCP] Include resolved: false\n[MCP] Processed 12 comments\n[MCP] Successfully fetched 12 comments\n```\n\n### Common Issues\n\n#### 1. Environment Variables Not Set\n\n**Symptom:**\n\n```\n[MCP] ERROR: GITLAB_HOST environment variable not set\n[MCP] Available env vars: []\n```\n\n**Solution:** Make sure to set `GITLAB_HOST` and `GITLAB_TOKEN` in your MCP client configuration:\n\n```json\n{\n  \"env\": {\n    \"GITLAB_HOST\": \"https://gitlab.com\",\n    \"GITLAB_TOKEN\": \"your-token-here\"\n  }\n}\n```\n\n#### 2. Authentication Error\n\n**Symptom:**\n\n```\n[MCP] Response status: 401 Unauthorized\n[MCP] Error response body: {\"message\":\"401 Unauthorized\"}\n```\n\n**Solution:**\n\n- Check that your GitLab token is valid\n- Ensure the token has `api` or `read_api` scope\n- Verify you're using the correct token for your GitLab instance\n\n#### 3. Project Not Found\n\n**Symptom:**\n\n```\n[MCP] Response status: 404 Not Found\n[MCP] Error response body: {\"message\":\"404 Project Not Found\"}\n```\n\n**Solution:**\n\n- Verify the project ID or path is correct\n- Ensure you have access to the project\n- For project paths with special characters, they will be automatically URL-encoded\n\n#### 4. SSL Certificate Issues\n\n**Symptom:**\n\n```\nError: self signed certificate in certificate chain\n```\n\n**Solution:** Disable SSL verification (for development/testing only):\n\n```json\n{\n  \"env\": {\n    \"GITLAB_SSL_VERIFY\": \"0\"\n  }\n}\n```\n\n### Testing Locally\n\nUse the included test script to verify your configuration:\n\n```bash\n# Set environment variables\nexport GITLAB_HOST=\"https://gitlab.com\"\nexport GITLAB_TOKEN=\"your-token-here\"\n\n# Run test\n./test-mcp.sh\n```\n\nThe server will start and show you all initialization logs. Press Ctrl+C to stop.\n\n### Checking MCP Client Logs\n\nDifferent MCP clients store logs in different locations:\n\n**Claude Desktop (macOS):**\n\n```bash\ntail -f ~/Library/Logs/Claude/mcp*.log\n```\n\n**Claude Desktop (Linux):**\n\n```bash\ntail -f ~/.config/Claude/logs/mcp*.log\n```\n\n**Cline (VS Code):**\n\n- Check the VS Code Output panel\n- Select \"Cline\" from the dropdown\n\n## License\n\nMIT\n","readmeFilename":"README.md"}