Skip to main content

AI Agents

Bitbucket Integration Pro exposes its pull request tools through a Model Context Protocol (MCP) server, so an AI coding agent can browse pull requests, read diffs, and comment on the changes without leaving your IDE. Any MCP-capable agent works; the examples below use Claude Code.

info

AI agent support is experimental and still evolving. Your feedback is very welcome — reach us through the support portal or by email.

When the agent comments on a pull request, it doesn't publish the comment right away. Each comment is created as a pending comment — part of a review that is stored on Bitbucket but visible only to you until you publish it. You review the pending comments in the IDE and publish them all at once with Finish review, or discard them. See Reviews for how the pending-review workflow works.

Requirements

  • A JetBrains IDE (2025.2 or later) with the bundled MCP Server plugin, which is enabled by default.
  • A configured Bitbucket 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

  1. In the IDE, open Settings | Tools | MCP Server and click Enable MCP Server.
  2. 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.
  3. Start your agent — for example, run Claude Code in the IDE's built-in terminal so it operates inside your project. The Bitbucket Integration Pro tools become available, prefixed with bitbucket_.

Available Tools

You don't call these directly — describe what you want in plain language and the agent picks the right tools.

ToolPurpose
bitbucket_list_my_pull_requestsList open pull requests where you are the author or a reviewer.
bitbucket_get_pull_requestGet a pull request's summary, changed files, discussions, and commits.
bitbucket_get_file_diffGet the diff of a single changed file.
bitbucket_add_commentComment on the changes or reply to a discussion. Created as a pending review comment.

Pointing the Agent at a Pull Request

The agent needs to know which pull request to work on. The easiest way is to paste its link into your prompt:

  • Use Copy Link — from the pull request's toolbar or its right-click menu in the Bitbucket Pull Requests tool window — and paste the URL into your prompt.
  • Or, if you have the pull request's branch checked out, just refer to "the current pull request" — the agent resolves it from the checked-out branch.

Reviewing a New Pull Request

Paste the pull request link and ask the agent to review it. The branch doesn't have to be checked out — the diff is read from Bitbucket — though checking it out first produces a more thorough review (see the tip below).

Review this Bitbucket pull request and leave inline comments on it for any bugs,
correctness problems, or risky changes you find:
https://bitbucket.org/workspace/repo/pull-requests/123

The agent fetches the changed files and existing discussions, reads each diff, and adds inline comments. Open the pull request in the Bitbucket Pull Requests tool window to see the pending comments in the Discussions tab, then publish them all at once with Finish review or discard them.

tip

For a more thorough review, check out the pull request's branch first with Checkout Branch, then tell the agent to use it — for example, add "the branch is checked out — use the whole project for context" to your prompt. The agent can then read the full files and use IDE context such as inspections and find-usages, instead of the diff alone. Checkout requires the repository to be associated with a local VCS root.

Reviewing Part of a Pull Request

By default the agent reviews the whole pull request. You can also scope the review to part of it — for example, to re-review only what the author pushed since your last pass. The tools don't track what you've already reviewed, so tell the agent what to look at. If you don't know the exact commit, ask the agent to list the pull request's commits first.

A single commit — review just that commit's changes:

Review the changes in commit <hash> of this Bitbucket pull request and leave inline
comments on any issues:
https://bitbucket.org/workspace/repo/pull-requests/123

Since a commit — review everything added after a given commit, up to the latest:

Review everything added to this Bitbucket pull request since commit <hash>, and
leave inline comments on any issues:
https://bitbucket.org/workspace/repo/pull-requests/123

To review a range instead, name both ends — for example, "review the changes between commit A and commit B."

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 pull 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 Bitbucket pull request:
https://bitbucket.org/workspace/repo/pull-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 from the IDE as usual. This keeps you in control of the code that lands.

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 Bitbucket pull request to
each review comment you addressed, noting what changed.

The replies are added as pending comments on the existing discussions. Review them in the Discussions tab and publish them all at once with Finish review.

Disabling the Tools

To turn the Bitbucket Integration Pro tools off for AI agents, open Settings | Tools | MCP Server | Exposed Tools and disable the bitbucket_ tools. To turn off all MCP access, clear Enable MCP Server on the Settings | Tools | MCP Server page.

Troubleshooting

If the bitbucket_ 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 bitbucket_ tools are enabled under Settings | Tools | MCP Server | Exposed Tools.
  • Confirm a repository is configured for Bitbucket Integration Pro — the tools are available only when at least one repository is set up.