← Back to articles

GitLab MCP for Claude Code

Another quick note following Sentry MCP in Claude Code.

If you already use Claude Code for code reviews on a local branch, connecting it to GitLab lets you fetch MR context and post review comments without leaving the CLI.

glab, the GitLab CLI tool, offers an MCP server for interacting with GitLab, for example in Claude Code. Still experimental at the time of writing.

Installing glab is straightforward on Ubuntu using sudo snap install glab, then glab auth login to authenticate.

Then the MCP can be set up in Claude Code using:

claude mcp add --transport stdio gitlab -- glab mcp serve

For example, asking for a code review:

> Review MR 18699

● I'll gather the MR details and diff now.

● gitlab - glab_mr_view (MCP)(args: ["18699"])
  ⎿  {
       "allow_collaboration": false,
       "allow_maintainer_to_push": false,
     … +39 lines (ctrl+o to expand)

● gitlab - glab_mr_diff (MCP)(args: ["18699"], flags: {"color":"never"})

[...]

After inspecting the diff, Claude may offer to save the review to a markdown file:

Want me to save this review to mr/review-18699.md?

You can then ask to publish the comment to the MR:

> Publish comment

● gitlab - glab_mr_note (MCP)

● Comment published on MR !18699: https://gitlab.com/example/projects/example/-/merge_requests/18699#note_3158538849

Of course the same is possible if you use gh.