Skip to main content
Glama

Bitbucket MCP

npm version License: MIT

一个用于 Bitbucket Cloud 的模型上下文协议 (MCP) 服务器。使 AI 助手能够管理仓库、拉取请求、流水线等。

安装

选项 1:使用 npx(推荐)

无需安装。直接运行:

npx @icy-r/bitbucket-mcp

选项 2:全局安装

npm install -g @icy-r/bitbucket-mcp
bitbucket-mcp

选项 3:本地开发

git clone https://github.com/icy-r/bitbucket-mcp.git
cd bitbucket-mcp
pnpm install
pnpm build
node dist/index.js

Related MCP server: mcp-bitbucket

MCP 客户端配置

Cursor IDE

添加到您的 Cursor MCP 设置中(Windows 上为 ~/.cursor/mcp.json,路径为 %USERPROFILE%\.cursor\mcp.json):

使用 npx(推荐):

{
  "mcpServers": {
    "bitbucket": {
      "command": "npx",
      "args": ["-y", "@icy-r/bitbucket-mcp"],
      "env": {
        "BITBUCKET_AUTH_METHOD": "api_token",
        "BITBUCKET_USER_EMAIL": "your.email@example.com",
        "BITBUCKET_API_TOKEN": "your_api_token"
      }
    }
  }
}

使用本地构建:

{
  "mcpServers": {
    "bitbucket": {
      "command": "node",
      "args": ["D:\\path\\to\\bitbucket-mcp\\dist\\index.js"],
      "env": {
        "BITBUCKET_AUTH_METHOD": "api_token",
        "BITBUCKET_USER_EMAIL": "your.email@example.com",
        "BITBUCKET_API_TOKEN": "your_api_token"
      }
    }
  }
}

Claude Desktop

添加到您的 Claude Desktop 配置中(macOS 上为 ~/Library/Application Support/Claude/claude_desktop_config.json,Windows 上为 %APPDATA%\Claude\claude_desktop_config.json):

{
  "mcpServers": {
    "bitbucket": {
      "command": "npx",
      "args": ["-y", "@icy-r/bitbucket-mcp"],
      "env": {
        "BITBUCKET_AUTH_METHOD": "api_token",
        "BITBUCKET_USER_EMAIL": "your.email@example.com",
        "BITBUCKET_API_TOKEN": "your_api_token"
      }
    }
  }
}

其他 MCP 客户端

该服务器遵循 MCP 标准,可与任何兼容的客户端配合使用。使用上述配置模式,并根据您的平台调整路径。

身份验证

API 令牌(推荐)

  1. 前往 Bitbucket API 令牌

  2. 创建一个具有所需权限的新令牌

  3. 设置环境变量:

BITBUCKET_AUTH_METHOD=api_token
BITBUCKET_USER_EMAIL=your.email@example.com
BITBUCKET_API_TOKEN=your_api_token

应用密码

  1. 前往 Bitbucket 应用密码

  2. 创建一个具有所需权限的新应用密码

  3. 使用 basic 验证方法,并输入您的用户名和应用密码

环境变量

变量

描述

必需

BITBUCKET_AUTH_METHOD

api_token, oauth, basic

是

BITBUCKET_USER_EMAIL

您的 Atlassian 邮箱

用于 api_token

BITBUCKET_API_TOKEN

API 令牌

用于 api_token

BITBUCKET_USERNAME

Bitbucket 用户名

用于 basic 验证

BITBUCKET_APP_PASSWORD

应用密码

用于 basic 验证

BITBUCKET_WORKSPACE

默认工作空间(当工具调用省略 workspace 时使用)

否

BITBUCKET_OUTPUT_FORMAT

json, toon, compact

否

可用工具

工具

操作

bitbucket_workspaces

list, get, list_projects, list_members

bitbucket_repositories

list, get, create, delete, fork, get_file, list_source

bitbucket_pull_requests

list, get, create, update, merge, approve, unapprove, decline, list_comments, add_comment, get_diff

bitbucket_branches

list_branches, get_branch, create_branch, delete_branch, list_tags, get_tag, create_tag

bitbucket_commits

list, get, get_diff, get_diffstat

bitbucket_pipelines

list, get, trigger, trigger_custom, stop, list_steps, get_step, get_logs, get_config, set_enabled, list_variables, get_variable, create_variable, update_variable, delete_variable

bitbucket_issues

list, get, create, update, delete, list_comments, add_comment, vote, unvote, watch, unwatch

bitbucket_webhooks

list, get, create, update, delete, list_workspace, get_workspace, create_workspace, update_workspace, delete_workspace

输出格式

使用 format 参数控制响应的详细程度:

格式

描述

节省 Token

json

完整 JSON 输出

0%

toon

紧凑的 TOON 格式

~50%

compact

仅包含必要字段

~76%

使用示例:

{ "action": "list", "workspace": "my-workspace", "format": "compact" }

示例

列出工作空间中的仓库

{
  "action": "list",
  "workspace": "my-workspace"
}

创建拉取请求

{
  "action": "create",
  "workspace": "my-workspace",
  "repo_slug": "my-repo",
  "title": "Feature: Add new functionality",
  "source_branch": "feature/new-feature",
  "destination_branch": "main"
}

触发流水线

{
  "action": "trigger",
  "workspace": "my-workspace",
  "repo_slug": "my-repo",
  "branch_name": "main"
}

默认工作空间

在您的环境中设置 BITBUCKET_WORKSPACE,以在每次工具调用时跳过 workspace 参数:

{ "action": "list", "repo_slug": "my-repo" }

开发

# Clone the repository
git clone https://github.com/icy-r/bitbucket-mcp.git
cd bitbucket-mcp

# Install dependencies
pnpm install

# Build
pnpm build

# Run tests
pnpm test

# Run in development mode (watch)
pnpm dev

# Lint and format
pnpm lint
pnpm format

要求

  • Node.js >= 20.0.0

  • pnpm (用于开发)

许可证

MIT

Available Tools

8 tools
bitbucket_branchesB

Manage Bitbucket branches and tags. Actions:

  • list_branches: List all branches in a repository

  • get_branch: Get details of a specific branch

  • create_branch: Create a new branch from a commit/ref

  • delete_branch: Delete a branch

  • list_tags: List all tags in a repository

  • get_tag: Get details of a specific tag

  • create_tag: Create a new tag

Inputs: action (required), repo_slug (required), workspace, branch_name, +8 more.

bitbucket_commitsB

Manage Bitbucket commits and diffs. Actions:

  • list: List commits in a repository

  • get: Get details of a specific commit

  • get_diff: Get diff between two refs (e.g., "branch1..branch2" or "commit1..commit2")

  • get_diffstat: Get diffstat (summary of changes) between two refs

Inputs: action (required), repo_slug (required), workspace, commit_hash, +8 more.

bitbucket_issuesB

Manage Bitbucket issue tracking. Actions:

  • list: List issues in a repository

  • get: Get details of a specific issue

  • create: Create a new issue

  • update: Update an existing issue

  • delete: Delete an issue

  • list_comments: List comments on an issue

  • add_comment: Add a comment to an issue

  • vote: Vote for an issue

  • unvote: Remove vote from an issue

  • watch: Watch an issue for notifications

  • unwatch: Stop watching an issue

Inputs: action (required), repo_slug (required), workspace, issue_id, +12 more.

bitbucket_pipelinesA

Manage Bitbucket Pipelines CI/CD. Actions:

  • list: List pipelines in a repository

  • get: Get details of a specific pipeline

  • trigger: Trigger a new pipeline run on a branch

  • trigger_custom: Trigger a custom pipeline with a specific pattern

  • stop: Stop a running pipeline

  • list_steps: List steps of a pipeline

  • get_step: Get details of a specific step

  • get_logs: Get logs for a pipeline step

  • get_config: Get pipeline configuration (enabled status)

  • set_enabled: Enable or disable pipelines for a repository

  • list_variables: List pipeline variables

  • get_variable: Get a specific pipeline variable

  • create_variable: Create a pipeline variable

  • update_variable: Update a pipeline variable

  • delete_variable: Delete a pipeline variable

Inputs: action (required), repo_slug (required), workspace, pipeline_uuid, +14 more.

bitbucket_pull_requestsB

Manage Bitbucket pull requests. Actions:

  • list: List pull requests in a repository

  • get: Get pull request details

  • create: Create a new pull request

  • update: Update a pull request

  • merge: Merge a pull request

  • approve: Approve a pull request

  • unapprove: Remove approval from a pull request

  • decline: Decline a pull request

  • list_comments: List comments on a pull request

  • add_comment: Add a comment to a pull request

  • get_diff: Get the diff of a pull request

Inputs: action (required), repo_slug (required), workspace, pr_id, +18 more.

bitbucket_repositoriesC

Manage Bitbucket repositories. Actions:

  • list: List repositories in a workspace

  • get: Get repository details

  • create: Create a new repository

  • delete: Delete a repository

  • fork: Fork a repository

  • get_file: Get file content from a repository

  • list_source: List files/directories in a repository path

Inputs: action (required), workspace, repo_slug, q, +13 more.

bitbucket_webhooksB

Manage Bitbucket webhooks for repositories and workspaces. Actions:

  • list: List webhooks for a repository

  • get: Get details of a specific webhook

  • create: Create a new webhook

  • update: Update an existing webhook

  • delete: Delete a webhook

  • list_workspace: List webhooks for a workspace

  • get_workspace: Get a workspace webhook

  • create_workspace: Create a workspace webhook

  • update_workspace: Update a workspace webhook

  • delete_workspace: Delete a workspace webhook

Inputs: action (required), workspace, repo_slug, webhook_uuid, +8 more.

bitbucket_workspacesB

Manage Bitbucket workspaces. Actions:

  • list: List all accessible workspaces

  • get: Get details of a specific workspace

  • list_projects: List projects in a workspace

  • list_members: List members of a workspace

Inputs: action (required), workspace, page, pagelen, +1 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool covers a distinct Bitbucket domain (branches, commits, issues, pipelines, pull requests, repositories, webhooks, workspaces) with no overlap in primary functionality. An agent can easily select the correct tool for a task.

    Naming Consistency5/5

    All tools follow a consistent 'bitbucket_<domain>' pattern, and within each tool, action names are short, clear verbs. The naming scheme is predictable and uniform across the entire set.

    Tool Count5/5

    With 8 tools covering the major Bitbucket features, the count is well-scoped for the platform's complexity. Each tool represents a natural grouping of related actions, avoiding unnecessary fragmentation or lumping.

    Completeness5/5

    The tool surface covers all core Bitbucket operations: source control (branches, commits), collaboration (PRs, issues), CI/CD (pipelines), repository management, webhooks, and workspaces. Critical workflows like create/update/delete are present where applicable.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Enables LLMs to interact with Bitbucket repositories to manage pull requests, branches, and commits through the Model Context Protocol. It supports repository operations such as searching code, accessing file contents, and comparing branches using natural language.
      16
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI systems to securely interact with self-hosted Bitbucket repositories, pull requests, projects, and code through the Model Context Protocol.
      23
      Apache 2.0