@jakobjoachim/gitlab-mr-mcp-client
v1.0.3
Published
MCP server for GitLab MR discussions
Readme
GitLab MR Discussions MCP Server
Local MCP server (stdio) for reading merge request discussions and replying to them.
What it does
- Resolves GitLab project from local
git originremote. - Lists unresolved MR discussion comments in an actionable format.
- Prepares dry-run reply payloads.
- Posts replies to a discussion only when
confirm=true. - Resolves and reopens MR discussion threads explicitly.
- Resolves merge request IID from current branch when
mr_iidis omitted.
Requirements
- Node.js 20+
- A GitLab Personal Access Token
read_apifor read-only usageapito post replies
Setup (local development)
npm install
npm run buildSet environment variables (see .env.example):
GITLAB_TOKEN(required)GITLAB_BASE_URL(optional fallback, for self-managed instances)GITLAB_TIMEOUT_MS(optional, default10000)
Setup (npm, recommended for users)
No clone/build required for users. Configure your MCP client to run the package via npx.
MCP client setup
Claude Code
Add this to your Claude Code MCP config:
{
"mcpServers": {
"gitlab-mr": {
"command": "npx",
"args": ["-y", "@jakobjoachim/gitlab-mr-mcp-client"]
}
}
}OpenCode
Add this to your opencode.json:
{
"mcp": {
"gitlab-mr": {
"type": "local",
"command": ["npx", "-y", "@jakobjoachim/gitlab-mr-mcp-client"]
}
}
}If your client supports env on server config, pass at least GITLAB_TOKEN.
Token injection examples
Use a shell wrapper so GITLAB_TOKEN is scoped to the MCP process invocation.
Claude Code + 1Password:
{
"mcpServers": {
"gitlab-mr": {
"command": "sh",
"args": [
"-c",
"GITLAB_TOKEN=\"$(op read 'op://vault/secret/field')\" npx -y @jakobjoachim/gitlab-mr-mcp-client"
]
}
}
}OpenCode + 1Password:
{
"mcp": {
"gitlab-mr": {
"type": "local",
"command": [
"sh",
"-c",
"GITLAB_TOKEN=\"$(op read 'op://vault/secret/field')\" npx -y @jakobjoachim/gitlab-mr-mcp-client"
]
}
}
}Claude Code + KeePassXC CLI:
{
"mcpServers": {
"gitlab-mr": {
"command": "sh",
"args": [
"-c",
"GITLAB_TOKEN=\"$(keepassxc-cli show -a Password '/path/to/vault.kdbx' 'gitlab-api-key')\" npx -y @jakobjoachim/gitlab-mr-mcp-client"
]
}
}
}OpenCode + KeePassXC CLI:
{
"mcp": {
"gitlab-mr": {
"type": "local",
"command": [
"sh",
"-c",
"GITLAB_TOKEN=\"$(keepassxc-cli show -a Password '/path/to/vault.kdbx' 'gitlab-api-key')\" npx -y @jakobjoachim/gitlab-mr-mcp-client"
]
}
}
}Host and project resolution
Resolution precedence:
- tool input
gitlab_base_url(optional override) - host inferred from
git remote get-url origin GITLAB_BASE_URLhttps://gitlab.com
Project path is inferred from the same remote (group/subgroup/project).
You can override with project_path.
MCP tool reference
mr_list_unresolved_comments
Input:
{
"mr_iid": 123,
"include_resolved": false,
"gitlab_base_url": "https://gitlab.example.com",
"project_path": "group/subgroup/project"
}mr_iid is optional. If omitted, the server resolves it from the current git branch and the opened MR source branch.
mr_prepare_reply
Input:
{
"mr_iid": 123,
"discussion_id": "abc123...",
"body": "Thanks, fixed in latest commit"
}Always dry-run. No GitLab write action.
mr_post_reply
Input:
{
"mr_iid": 123,
"discussion_id": "abc123...",
"body": "Thanks, fixed in latest commit",
"confirm": true
}Rejects when confirm is not true.
mr_resolve_thread
Input:
{
"mr_iid": 123,
"discussion_id": "abc123...",
"gitlab_base_url": "https://gitlab.example.com",
"project_path": "group/subgroup/project"
}Calls the GitLab resolve discussion endpoint and marks the thread resolved.
mr_reopen_thread
Input:
{
"mr_iid": 123,
"discussion_id": "abc123...",
"gitlab_base_url": "https://gitlab.example.com",
"project_path": "group/subgroup/project"
}Calls the GitLab resolve discussion endpoint with resolved=false.
Example MCP config (local checkout)
Use your MCP client's local stdio server config and point it to this command:
node /absolute/path/to/gitlab-mr-mcp-client/dist/index.jsIf your client supports env on server config, pass at least GITLAB_TOKEN.
Publishing
npm login
npm publish --access public --provenance=falseSmoke test before publish:
npm pack
npx -y --package ./jakobjoachim-gitlab-mr-mcp-client-1.0.1.tgz gitlab-mr-mcp-clientDevelopment
npm run devNotes
- Uses GitLab Discussions API endpoints under
/api/v4/projects/:id/merge_requests/:merge_request_iid/discussions. - Pagination is supported for listing discussions.
