AI Agents
JetLab — GitLab exposes its merge request tools through a Model Context Protocol (MCP) server, so an AI coding agent can browse merge requests, read diffs, and comment on the changes without leaving your IDE. Any MCP-capable agent works; the examples below use Claude Code.
AI agent support is experimental and still evolving. Your feedback is very welcome — reach us through the support portal or by email.
An agent's comments are not published right away: each is created as a pending comment, stored on GitLab but visible only to you until you publish them all with Finish review or discard them. See Reviews.
Requirements
- A JetBrains IDE (2025.2 or later) with the bundled MCP Server plugin, which is enabled by default.
- A configured GitLab repository (see Managing Repositories). The tools are available only while at least one repository is configured.
- For workflows where the agent checks out a branch, the repository must be associated with a local VCS root.
Connecting an Agent
- In the IDE, open Settings | Tools | MCP Server and click Enable MCP Server.
- In the Clients Auto-Configuration section, click Auto-Configure next to your agent. Claude Code, Claude Desktop, Cursor, VS Code, and others are supported. For a client that isn't listed, use Copy SSE Config or Copy Stdio Config from the Manual Client Configuration section instead.
- Start your agent — for example, run Claude Code in the IDE's built-in terminal so it operates inside your project. The JetLab — GitLab tools become available, prefixed with
gitlab_.
Starting a Review from the Toolbar
Instead of writing a prompt yourself, click AI Review in the merge request details panel toolbar: the plugin generates the prompt for the scope you choose and starts the agent. If you edit the prompt, do it last — changing the agent, the scope, or the checkout regenerates it.
The action appears only when the IDE finds an agent to run the review:
- Terminal — Claude Code or Codex, started in a new terminal tab. Offered when the CLI is on your
PATHand its MCP configuration points at this IDE's server (see Connecting an Agent). - AI Chat — a new JetBrains AI Assistant chat in one of its agent modes. Requires the JetBrains AI Assistant plugin; modes that don't run an agent can't use the tools and are not offered.
Select Check out branch in the dialog to run the review with the branch checked out, so the agent reads the whole project at the reviewed revision instead of the diff alone. This requires the repository to be associated with a local VCS root; if the checkout fails, the review is not started.
Available Tools
Describe what you want in plain language and the agent picks the right tools. If you have other MCP servers connected, naming the tools in your prompt keeps the agent on the plugin's tools instead of reading the merge request over the web.
| Tool | Purpose |
|---|---|
gitlab_list_my_merge_requests | List open merge requests where you are the author, assignee, or reviewer. |
gitlab_get_merge_request | Get a merge request's summary, changed files, discussions, and commits. |
gitlab_get_file_diff | Get the diff of a single changed file. |
gitlab_add_comment | Comment on the changes or reply to a discussion. Created as a pending review comment. |
Pointing the Agent at a Merge Request
The agent needs to know which merge request to work on. The easiest way is to paste its link into your prompt:
- Use Copy Link — from the merge request's toolbar or its right-click menu in the GitLab Merge Requests tool window — and paste the URL into your prompt.
- Or, if you have the merge request's branch checked out, just refer to "the current merge request" — the agent resolves it from the checked-out branch.
Reviewing a New Merge Request
Paste the merge request link and ask the agent to review it. The branch doesn't have to be checked out — the diff is read from GitLab.
Review this GitLab merge request and leave inline comments on it for any bugs,
correctness problems, or risky changes you find:
https://gitlab.com/group/project/-/merge_requests/123
For a more thorough review, check out the branch first with Checkout Branch and add "the branch is checked out — use the whole project for context" to your prompt: the agent can then read the full files instead of the diff alone. Checkout requires the repository to be associated with a local VCS root.
Reviewing Part of a Merge Request
To re-review only what the author pushed since your last pass, tell the agent what to look at — the tools don't track what you've already reviewed. If you don't know the exact commit or version, ask the agent to list the merge request's commits or versions first.
By commit — review a single commit's changes:
Review the changes in commit <hash> of this GitLab merge request and leave inline
comments on any issues:
https://gitlab.com/group/project/-/merge_requests/123
By version — GitLab records each push to the merge request as a numbered version. Review what changed between versions; omit the starting version to compare from the target branch, or the ending version to compare up to the latest:
Review what changed in this GitLab merge request since version 2 and leave inline
comments on any issues:
https://gitlab.com/group/project/-/merge_requests/123
Addressing Review Comments as the Author
When you're the author, the agent can apply the requested changes locally while you stay in control of what gets committed and what gets sent back to the reviewers.
1. Let the agent make the changes. If the merge request's branch isn't checked out yet, check it out first with Checkout Branch. Then the agent reads the discussions and edits the working tree — without committing.
This is my GitLab merge request:
https://gitlab.com/group/project/-/merge_requests/123
Read the open review comments and update the code to address them. Don't commit
or push — I'll review and commit the changes myself.
2. Review and commit in the IDE. Inspect the agent's edits, then commit and push as usual.
3. Let the agent reply to the discussions. After your push, ask the agent to respond to each thread it addressed.
I've committed and pushed the changes. Post a reply on the GitLab merge request to
each review comment you addressed, noting what changed.
The replies are added as pending comments on the existing discussions, so they go out when you finish the review.
Disabling the Tools
To turn the JetLab — GitLab tools off for AI agents, open Settings | Tools | MCP Server | Exposed Tools and disable the gitlab_ tools. To turn off all MCP access, clear Enable MCP Server on the Settings | Tools | MCP Server page.
Troubleshooting
If the gitlab_ tools don't appear in your agent:
- Confirm Enable MCP Server is on in Settings | Tools | MCP Server, and re-run Auto-Configure for your client.
- Check that the
gitlab_tools are enabled under Settings | Tools | MCP Server | Exposed Tools. - Confirm a repository is configured for JetLab — GitLab — the tools are available only when at least one repository is set up.