Bitbucket Server MCP

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.

Integrations

  • Provides tools for managing Bitbucket Server pull requests, including creating, retrieving, merging, and declining PRs, adding comments, retrieving diffs, and managing reviews.

Bitbucket 服务器 MCP

用于管理 Bitbucket Server 拉取请求的 MCP(模型上下文协议)服务器。该服务器提供通过 MCP 协议与 Bitbucket Server API 交互的工具和资源。

要求

  • Node.js >= 16

安装

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 Bitbucket Server:

npx -y @smithery/cli install @garc33/bitbucket-server-mcp-server --client claude

手动安装

npm install

建造

npm run build

特征

该服务器为 Bitbucket Server 集成提供了以下工具:

create_pull_request

创建一个新的拉取请求。

参数:

  • project :Bitbucket 项目密钥(如果设置,则默认为 BITBUCKET_DEFAULT_PROJECT)
  • repository (必需):存储库 slug
  • title (必填):PR 标题
  • description :PR 描述
  • sourceBranch (必需):源分支名称
  • targetBranch (必填):目标分支名称
  • reviewers :审阅者用户名数组

get_pull_request

检索有关特定拉取请求的详细信息。

参数:

  • project :Bitbucket 项目密钥(如果设置,则默认为 BITBUCKET_DEFAULT_PROJECT)
  • repository (必需):存储库 slug
  • prId (必填):拉取请求 ID

merge_pull_request

合并拉取请求。

参数:

  • project :Bitbucket 项目密钥(如果设置,则默认为 BITBUCKET_DEFAULT_PROJECT)
  • repository (必需):存储库 slug
  • prId (必填):拉取请求 ID
  • message :合并提交消息
  • strategy :以下之一:
    • merge-commit (默认)
    • squash
    • fast-forward

decline_pull_request

拒绝拉取请求。

参数:

  • project :Bitbucket 项目密钥(如果设置,则默认为 BITBUCKET_DEFAULT_PROJECT)
  • repository (必需):存储库 slug
  • prId (必填):拉取请求 ID
  • message :拒绝的原因

add_comment

向拉取请求添加评论。

参数:

  • project :Bitbucket 项目密钥(如果设置,则默认为 BITBUCKET_DEFAULT_PROJECT)
  • repository (必需):存储库 slug
  • prId (必填):拉取请求 ID
  • text (必填):评论文本
  • parentId :回复的父评论 ID

get_diff

检索拉取请求的差异。

参数:

  • project :Bitbucket 项目密钥(如果设置,则默认为 BITBUCKET_DEFAULT_PROJECT)
  • repository (必需):存储库 slug
  • prId (必填):拉取请求 ID
  • contextLines :上下文行数(默认值:10)

get_reviews

获取拉取请求的审核历史记录,包括批准和审核。

参数:

  • project :Bitbucket 项目密钥(如果设置,则默认为 BITBUCKET_DEFAULT_PROJECT)
  • repository (必需):存储库 slug
  • prId (必填):拉取请求 ID

依赖项

  • @modelcontextprotocol/sdk - 用于 MCP 协议实现的 SDK
  • axios - 用于 API 请求的 HTTP 客户端
  • winston - 日志框架

配置

该服务器需要在 VSCode MCP 设置文件中进行配置。以下是示例配置:

{ "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" } } } }

环境变量

  • BITBUCKET_URL (必需):Bitbucket Server 实例的基本 URL
  • 身份验证(需要以下其中一项):
    • BITBUCKET_TOKEN :个人访问令牌
    • BITBUCKET_USERNAMEBITBUCKET_PASSWORD :基本身份验证凭据
  • BITBUCKET_DEFAULT_PROJECT :工具调用中未指定时使用的默认项目密钥

日志记录

服务器使用 Winston 将所有操作记录到bitbucket.log以进行调试和监控。

You must be authenticated.

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

通过 MCP 协议实现与 Bitbucket Server 的交互,实现拉取请求管理,支持创建、合并、评论、审核拉取请求等操作。

  1. Requirements
    1. Installation
      1. Installing via Smithery
      2. Manual Installation
    2. Build
      1. Features
        1. create_pull_request
        2. get_pull_request
        3. merge_pull_request
        4. decline_pull_request
        5. add_comment
        6. get_diff
        7. get_reviews
      2. Dependencies
        1. Configuration
          1. Environment Variables
        2. Logging
          ID: jskr5c1zq3