Skip to main content
Glama
Bitbucket Server MCP

Bitbucket Server MCP

by atish23

Bitbucket Server MCP

Bitbucket Server MCP Infographic

MCP (Model Context Protocol) server for Bitbucket Server Pull Request management. This server provides tools and resources to interact with the Bitbucket Server API through the MCP protocol.

Requirements

  • Node.js >= 16

Related MCP server: Bitbucket MCP Server

Installation

Manual Installation

npm install

Build

npm run build

Features

The server provides the following tools for Bitbucket Server integration:

create_pull_request

Creates a new pull request.

Parameters:

  • project: Bitbucket project key (defaults to BITBUCKET_DEFAULT_PROJECT if set)

  • repository (required): Repository slug

  • title (required): PR title

  • description: PR description

  • sourceBranch (required): Source branch name

  • targetBranch (required): Target branch name

  • reviewers: Array of reviewer usernames

get_pull_request

Retrieves detailed information about a specific pull request.

Parameters:

  • project: Bitbucket project key (defaults to BITBUCKET_DEFAULT_PROJECT if set)

  • repository (required): Repository slug

  • prId (required): Pull request ID

merge_pull_request

Merges a pull request.

Parameters:

  • project: Bitbucket project key (defaults to BITBUCKET_DEFAULT_PROJECT if set)

  • repository (required): Repository slug

  • prId (required): Pull request ID

  • message: Merge commit message

  • strategy: One of:

    • merge-commit (default)

    • squash

    • fast-forward

decline_pull_request

Declines a pull request.

Parameters:

  • project: Bitbucket project key (defaults to BITBUCKET_DEFAULT_PROJECT if set)

  • repository (required): Repository slug

  • prId (required): Pull request ID

  • message: Reason for declining

add_comment

Adds a comment to a pull request.

Parameters:

  • project: Bitbucket project key (defaults to BITBUCKET_DEFAULT_PROJECT if set)

  • repository (required): Repository slug

  • prId (required): Pull request ID

  • text (required): Comment text

  • parentId: Parent comment ID for replies

get_diff

Retrieves the diff for a pull request.

Parameters:

  • project: Bitbucket project key (defaults to BITBUCKET_DEFAULT_PROJECT if set)

  • repository (required): Repository slug

  • prId (required): Pull request ID

  • contextLines: Number of context lines (default: 10)

get_reviews

Fetches the review history of a pull request, including approvals and reviews.

Parameters:

  • project: Bitbucket project key (defaults to BITBUCKET_DEFAULT_PROJECT if set)

  • repository (required): Repository slug

  • prId (required): Pull request ID

Dependencies

  • @modelcontextprotocol/sdk - SDK for MCP protocol implementation

  • axios - HTTP client for API requests

  • winston - Logging framework

Configuration

The server requires configuration in the VSCode MCP settings file. Here's a sample configuration:

{
  "mcpServers": {
    "bitbucket": {
      "command": "node",
      "args": ["/path/to/bitbucket-server/build/index.js"],
      "env": {
        "BITBUCKET_URL": "https://your-bitbucket-server.com",
        // Authentication (choose one):
        // Option 1: Personal Access Token
        "BITBUCKET_TOKEN": "your-access-token",
        // Option 2: Username/Password
        "BITBUCKET_USERNAME": "your-username",
        "BITBUCKET_PASSWORD": "your-password",
        // Optional: Default project
        "BITBUCKET_DEFAULT_PROJECT": "your-default-project"
      }
    }
  }
}

Environment Variables

  • BITBUCKET_URL (required): Base URL of your Bitbucket Server instance

  • Authentication (one of the following is required):

    • BITBUCKET_TOKEN: Personal access token

    • BITBUCKET_USERNAME and BITBUCKET_PASSWORD: Basic authentication credentials

  • BITBUCKET_DEFAULT_PROJECT: Default project key to use when not specified in tool calls

Logging

The server logs all operations to bitbucket.log using Winston for debugging and monitoring purposes.

Available Tools

7 tools
add_commentC

Add a comment to a pull request

Inputs: prId (required), text (required), repository (required), project, +1 more.

create_pull_requestC

Create a new pull request

Inputs: title (required), repository (required), sourceBranch (required), targetBranch (required), +3 more.

decline_pull_requestC

Decline a pull request

Inputs: prId (required), repository (required), message, project.

get_diffB

Get pull request diff

Inputs: prId (required), repository (required), project, contextLines.

get_pull_requestB

Get pull request details

Inputs: prId (required), repository (required), project.

get_reviewsC

Get pull request reviews

Inputs: prId (required), repository (required), project.

merge_pull_requestC

Merge a pull request

Inputs: prId (required), repository (required), message, project, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 7 tools

    Disambiguation5/5

    Each tool maps to a distinct action on the pull request resource (create, get, merge, decline, diff, reviews, comment) with no overlapping verbs. The server is narrowly scoped to PRs, so even shorter names like get_diff and get_reviews are unambiguous in context.

    Naming Consistency4/5

    All tools use snake_case verb_noun patterns, which is consistent and predictable. Minor deviation: three tools (add_comment, get_diff, get_reviews) omit the pull_request noun while the rest include it, creating slight asymmetry.

    Tool Count5/5

    Seven tools is a well-scoped size for a PR-focused MCP server. Each tool covers a meaningful lifecycle operation and none appear redundant or trivial.

    Completeness3/5

    Core PR lifecycle actions are covered (create, get, merge, decline, diff, reviews, comment), but there is no list_pull_requests tool and no way to update or approve a PR or edit/delete comments. The inability to discover PRs is a notable gap that forces agents to work around the surface.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      A
      maintenance
      Facilitates interaction with Bitbucket Server for pull request management using the MCP protocol, supporting operations such as creating, merging, commenting, and reviewing pull requests.
      28
      161 npm
      70
      Apache 2.0
    • A
      license
      A
      quality
      D
      maintenance
      Enables management of Bitbucket Cloud pull requests through natural language, including creating, reviewing, approving, and commenting on PRs with automatic default reviewer support.
      79
      1
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      Enables interaction with Bitbucket Server/Data Center (Stash) for project and repository discovery, pull request management, code review, and code search.
      18
      MIT