@wojtek1150/mcp-gitlab
v1.0.0-beta.1
Published
MCP server for GitLab merge request operations — read comments, diffs, and post replies
Maintainers
Readme
@wojtek1150/mcp-gitlab
MCP server for GitLab merge request operations. Enables AI agents (Claude Code, Claude Desktop) to read MR comments with file/line context, inspect diffs, and post replies — making it possible to automatically implement review feedback.
Features
| Tool | Description |
|---|---|
| list_merge_requests | List MRs with filtering by state, author, labels |
| get_merge_request | Full details of a single MR |
| get_mr_comments | All comments/threads with file path and line number |
| get_mr_diff | Full diff or filtered to a specific file |
| get_mr_versions | Commit SHAs needed for posting inline comments |
| add_mr_comment | Post a general or inline (file+line) comment |
| reply_to_comment | Reply to an existing discussion thread |
Works with both GitLab.com and self-hosted GitLab instances.
Requirements
- Node.js 18+
- GitLab Personal Access Token with
apiscope
Installation
Option A — use directly with npx (no install)
GITLAB_TOKEN=glpat-xxx npx @wojtek1150/mcp-gitlabOption B — install globally
npm install -g @wojtek1150/mcp-gitlabOption C — clone and build
git clone https://github.com/wojtek1150/mcp-gitlab.git
cd mcp-gitlab
npm install
npm run buildConfiguration
The server is configured via environment variables:
| Variable | Required | Default | Description |
|---|---|---|---|
| GITLAB_TOKEN | ✅ | — | Personal Access Token (api scope) |
| GITLAB_URL | ❌ | https://gitlab.com | Base URL of your GitLab instance |
| GITLAB_DEFAULT_PROJECT | ❌ | — | Default project path (e.g. group/repo) |
Copy .env.example to .env and fill in your values:
cp .env.example .envGenerating a GitLab token
- Go to GitLab → User Settings → Access Tokens (or
/-/user_settings/personal_access_tokens) - Create a token with the
apiscope - Copy the token — it will only be shown once
For self-hosted GitLab, the same path applies on your instance.
Claude Code integration
Add the server to your Claude Code MCP configuration:
# Via npx (always uses latest published version)
claude mcp add gitlab -- npx -y @wojtek1150/mcp-gitlab
# With environment variables
GITLAB_TOKEN=glpat-xxx GITLAB_URL=https://your.gitlab.com \
claude mcp add gitlab -- npx -y @wojtek1150/mcp-gitlabOr add it manually to ~/.claude/settings.json:
{
"mcpServers": {
"gitlab": {
"command": "npx",
"args": ["-y", "@wojtek1150/mcp-gitlab"],
"env": {
"GITLAB_TOKEN": "glpat-xxx",
"GITLAB_URL": "https://gitlab.com",
"GITLAB_DEFAULT_PROJECT": "group/my-repo"
}
}
}
}Claude Desktop integration
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):
{
"mcpServers": {
"gitlab": {
"command": "npx",
"args": ["-y", "@wojtek1150/mcp-gitlab"],
"env": {
"GITLAB_TOKEN": "glpat-xxx",
"GITLAB_URL": "https://gitlab.com"
}
}
}
}Usage examples
Once the MCP server is connected, you can ask Claude:
"List open MRs in group/my-repo"
"Show me all unresolved review comments from MR !42 with their file and line info"
"Apply the review feedback from MR !42 — get the comments, make the fixes, then reply to each thread confirming what was changed"
"What files changed in MR !17? Show me the diff for src/auth.ts"
Typical agent workflow for implementing review feedback
1. get_mr_comments(mr_iid: 42, unresolved_only: true)
→ returns each comment with file path + line number
2. get_mr_diff(mr_iid: 42, file_path: "src/auth.ts")
→ shows the current diff for context
3. [Agent edits local files based on feedback]
4. get_mr_versions(mr_iid: 42)
→ fetches base_sha / start_sha / head_sha
5. reply_to_comment(discussion_id: "abc123", body: "Fixed — extracted validation to a helper function")
→ resolves the threadDevelopment
# Run in development mode (no build needed)
npm run dev
# Type check
npm run typecheck
# Build for production
npm run build
# Run built server
npm startPublishing
npm login
npm publish --access publicLicense
MIT
