Bitbucket MCP

MIT License
820
4
  • Linux
  • Apple

Integrations

  • Enables interaction with Bitbucket Cloud and Server APIs, providing tools for listing and retrieving repositories, managing pull requests, and working with repository content.

  • Supports working with Git repositories stored in Bitbucket, allowing access to repository content and version control operations.

Bitbucket MCP

一个模型上下文协议 (MCP) 服务器,用于与 Bitbucket Cloud 和服务器 API 集成。此 MCP 服务器使 Cursor 等 AI 助手能够与您的 Bitbucket 存储库、拉取请求和其他资源进行交互。

安全第一

这是一个安全可靠的软件包——不使用任何 DELETE 操作,因此不存在数据丢失的风险。每个拉取请求都使用 CodeQL 进行分析,以确保代码安全。

概述

查看官方 npm 软件包。该服务器实现了模型上下文协议标准,为 AI 助手提供访问 Bitbucket 数据和操作的权限。它包含以下工具:

  • 列出和检索存储库
  • 获取存储库详细信息
  • 获取拉取请求
  • 还有更多...

安装

使用 NPX(推荐)

使用此 MCP 服务器的最简单方法是通过 NPX,它允许您无需全局安装即可运行它:

# Run with environment variables BITBUCKET_URL="https://bitbucket.org/your-workspace" \ BITBUCKET_USERNAME="your-username" \ BITBUCKET_PASSWORD="your-app-password" \ npx -y bitbucket-mcp@latest

手动安装

或者,您可以全局安装它或将其作为项目的一部分安装:

# Install globally npm install -g bitbucket-mcp # Or install in your project npm install bitbucket-mcp

然后运行它:

# If installed globally BITBUCKET_URL="https://bitbucket.org/your-workspace" \ BITBUCKET_USERNAME="your-username" \ BITBUCKET_PASSWORD="your-app-password" \ bitbucket-mcp # If installed in your project BITBUCKET_URL="https://bitbucket.org/your-workspace" \ BITBUCKET_USERNAME="your-username" \ BITBUCKET_PASSWORD="your-app-password" \ npx bitbucket-mcp

配置

环境变量

使用以下环境变量配置服务器:

多变的描述必需的
BITBUCKET_URLBitbucket 基本 URL(例如“ https://bitbucket.org/your-workspace ”)是的
BITBUCKET_USERNAME您的 Bitbucket 用户名是的*
BITBUCKET_PASSWORD您的 Bitbucket 应用密码是的*
BITBUCKET_TOKEN您的 Bitbucket 访问令牌(用户名/密码的替代)
BITBUCKET_WORKSPACE未指定时使用的默认工作区

* 必须提供BITBUCKET_TOKENBITBUCKET_USERNAMEBITBUCKET_PASSWORD

创建 Bitbucket 应用程序密码

  1. 登录您的 Bitbucket 帐户
  2. 前往“个人设置”>“应用密码”
  3. 使用以下权限创建新的应用密码:
    • 存储库:阅读
    • 拉取请求:读、写
  4. 复制生成的密码并将其用作BITBUCKET_PASSWORD环境变量

与 Cursor 集成

要将此 MCP 服务器与 Cursor 集成:

  1. 打开游标
  2. 前往“设置”>“扩展程序”
  3. 点击“模型上下文协议”
  4. 添加新的 MCP 配置:
"bitbucket": { "command": "npx", "env": { "BITBUCKET_URL": "https://bitbucket.org/your-workspace", "BITBUCKET_USERNAME": "your-username", "BITBUCKET_PASSWORD": "your-app-password" }, "args": ["-y", "bitbucket-mcp@latest"] }
  1. 保存配置
  2. 使用 Cursor 中的“/bitbucket”命令访问 Bitbucket 存储库和拉取请求

使用带光标的本地构建

如果您正在本地开发并想要测试您的更改:

"bitbucket-local": { "command": "node", "env": { "BITBUCKET_URL": "https://bitbucket.org/your-workspace", "BITBUCKET_USERNAME": "your-username", "BITBUCKET_PASSWORD": "your-app-password" }, "args": ["/path/to/your/local/bitbucket-mcp/dist/index.js"] }

可用工具

此 MCP 服务器提供与 Bitbucket 仓库和拉取请求交互的工具。以下是可用操作的完整列表:

存储库操作

listRepositories

列出工作区中的存储库。

参数:

  • workspace (可选):Bitbucket 工作区名称
  • limit (可选):返回的最大存储库数量
getRepository

获取特定存储库的详细信息。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug

拉取请求操作

getPullRequests

获取存储库的拉取请求。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • state (可选):拉取请求状态( OPENMERGEDDECLINEDSUPERSEDED
  • limit (可选):返回的最大拉取请求数量
createPullRequest

创建一个新的拉取请求。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • title :拉取请求标题
  • description :拉取请求描述
  • sourceBranch :源分支名称
  • targetBranch :目标分支名称
  • reviewers (可选):审阅者用户名列表
getPullRequest

获取特定拉取请求的详细信息。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • pull_request_id :拉取请求 ID
updatePullRequest

更新拉取请求。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • pull_request_id :拉取请求 ID
  • 各种可选的更新参数(标题、描述等)
getPullRequestActivity

获取拉取请求的活动日志。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • pull_request_id :拉取请求 ID
approvePullRequest

批准拉取请求。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • pull_request_id :拉取请求 ID
unapprovePullRequest

从拉取请求中删除批准。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • pull_request_id :拉取请求 ID
declinePullRequest

拒绝拉取请求。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • pull_request_id :拉取请求 ID
  • message (可选):拒绝的原因
mergePullRequest

合并拉取请求。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • pull_request_id :拉取请求 ID
  • message (可选):合并提交消息
  • strategy (可选):合并策略( merge-commitsquashfast-forward
requestChanges

请求对拉取请求进行更改。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • pull_request_id :拉取请求 ID
removeChangeRequest

从拉取请求中删除变更请求。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • pull_request_id :拉取请求 ID

拉取请求评论操作

getPullRequestComments

列出对拉取请求的评论。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • pull_request_id :拉取请求 ID
createPullRequestComment

对拉取请求创建评论。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • pull_request_id :拉取请求 ID
  • content :评论内容
  • inline (可选):内联注释信息
getPullRequestComment

获取对拉取请求的特定评论。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • pull_request_id :拉取请求 ID
  • comment_id :评论ID
updatePullRequestComment

更新拉取请求的评论。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • pull_request_id :拉取请求 ID
  • comment_id :评论ID
  • content :更新的评论内容
deletePullRequestComment

删除对拉取请求的评论。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • pull_request_id :拉取请求 ID
  • comment_id :评论ID
resolveComment

解决拉取请求上的评论线程。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • pull_request_id :拉取请求 ID
  • comment_id :评论ID
reopenComment

重新打开拉取请求中已解决的评论线程。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • pull_request_id :拉取请求 ID
  • comment_id :评论ID

拉取请求差异操作

getPullRequestDiff

获取拉取请求的差异。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • pull_request_id :拉取请求 ID
getPullRequestDiffStat

获取拉取请求的差异统计信息。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • pull_request_id :拉取请求 ID
getPullRequestPatch

获取拉取请求的补丁。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • pull_request_id :拉取请求 ID

拉取请求任务操作

getPullRequestTasks

列出拉取请求上的任务。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • pull_request_id :拉取请求 ID
createPullRequestTask

根据拉取请求创建任务。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • pull_request_id :拉取请求 ID
  • content :任务内容
  • comment (可选):与任务关联的评论ID
  • pending (可选):任务是否处于待处理状态
getPullRequestTask

获取拉取请求上的特定任务。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • pull_request_id :拉取请求 ID
  • task_id :任务ID
updatePullRequestTask

更新拉取请求上的任务。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • pull_request_id :拉取请求 ID
  • task_id :任务ID
  • content (可选):更新的任务内容
  • state (可选):更新的任务状态
deletePullRequestTask

删除拉取请求上的任务。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • pull_request_id :拉取请求 ID
  • task_id :任务ID

其他拉取请求操作

getPullRequestCommits

列出拉取请求的提交。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • pull_request_id :拉取请求 ID
getPullRequestStatuses

列出拉取请求的提交状态。

参数:

  • workspace :Bitbucket 工作区名称
  • repo_slug :存储库 slug
  • pull_request_id :拉取请求 ID

发展

先决条件

  • Node.js 18 或更高版本
  • npm 或 yarn

设置

# Clone the repository git clone https://github.com/MatanYemini/bitbucket-mcp.git cd bitbucket-mcp # Install dependencies npm install # Build the project npm run build # Run in development mode npm run dev

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。

链接

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

模型上下文协议服务器,使 AI 助手能够通过 Bitbucket Cloud 和服务器 API 与 Bitbucket 存储库、拉取请求和其他资源进行交互。

  1. Safety First
    1. Overview
      1. Installation
        1. Using NPX (Recommended)
        2. Manual Installation
      2. Configuration
        1. Environment Variables
        2. Creating a Bitbucket App Password
      3. Integration with Cursor
        1. Using a Local Build with Cursor
      4. Available Tools
        1. Repository Operations
        2. Pull Request Operations
        3. Pull Request Comment Operations
        4. Pull Request Diff Operations
        5. Pull Request Task Operations
        6. Other Pull Request Operations
      5. Development
        1. Prerequisites
        2. Setup
      6. License
        1. Links

          Related MCP Servers

          • A
            security
            F
            license
            A
            quality
            A Model Context Protocol server that enables AI models to interact with GitHub's API, allowing for repository creation and management with descriptions, topics, and website URLs through natural language commands.
            Last updated -
            1
            JavaScript
          • -
            security
            F
            license
            -
            quality
            A Model Context Protocol server that enables AI assistants like Claude to interact with GitHub repositories, issues, and pull requests.
            Last updated -
            129
            Python
          • -
            security
            F
            license
            -
            quality
            A Model Context Protocol server that enables AI assistants to perform GitHub operations including repository management, file operations, issue tracking, and pull request creation.
            Last updated -
            1
            TypeScript
          • -
            security
            F
            license
            -
            quality
            A comprehensive Model Context Protocol server implementation that enables AI assistants to interact with file systems, databases, GitHub repositories, web resources, and system tools while maintaining security and control.
            Last updated -
            16
            TypeScript

          View all related MCP servers

          ID: n7bfg1br32