Skip to content

Incorrect diff content and PR sync handling in MCP Bitbucket integration - reverses the added and deleted lines of code- interprets the lines added as deleted and vice versa #84

@shivanirana113

Description

@shivanirana113

Title:

Incorrect diff content and PR sync handling in MCP Bitbucket integration


Description:

Hi,

The MCP server for fetching PRs from Bitbucket appears to be misconfigured. When it retrieves the diff content, it incorrectly interprets the changes:

  • Added lines are shown as deleted.
  • Deleted lines are shown as added.

This inversion causes significant issues for PR reviews, especially when using agentic IDEs.

Additionally, if the PR is not synced with the master branch, the MCP fetch results are miscalculated. The reported number of changed lines does not match the actual changes in the PR.


Expected Behavior:

  • MCP should correctly distinguish between added and deleted lines in PR diffs.
  • MCP should properly handle unsynced PRs and retrieve accurate change data.

Actual Behavior:

  • Diff content is inverted (added ↔ deleted).
  • Incorrect change count when the PR is behind master.

Steps to Reproduce:

  1. Open a PR in Bitbucket that is a few commits behind master.
  2. Use MCP to fetch the PR diff.
  3. Observe:
    • Added lines are shown as deleted.
    • Deleted lines are shown as added.
    • Line count mismatch with Bitbucket UI.

Environment:

  • MCP Server: mcp-server-atlassian-bitbucket
  • IDE: (e.g. Cursor)
  • Bitbucket: (Cloud/Data Center)
  • Version: (if applicable)

Additional Context:

This issue severely impacts automated PR review workflows and agentic IDE integrations that rely on accurate diff content.

Can this be fixed or added to the roadmap?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions