mcpField
A
Atlassian Bitbucket MCP Server

Atlassian Bitbucket MCP Server

本地服务
github.com/aashari版本控制16434 周前更新

关于 Atlassian Bitbucket MCP Server

Atlassian Bitbucket MCP Server 是基于 Node.js 与 TypeScript 的 MCP 服务,用于让 Claude、Cursor 等 AI 助手访问 Bitbucket Cloud 的工作区、仓库和拉取请求。它通过少量通用工具调用任意 Bitbucket REST API 端点,面向开发者、团队负责人和 DevOps 工程师。

主要功能

  1. 01通过 6 个通用工具访问任意 Bitbucket API 端点
  2. 02支持 JMESPath 过滤以减少返回内容
  3. 03默认输出 TOON 格式以降低 token 消耗
  4. 04支持仓库克隆与拉取请求的查看、评论、批准和合并
  5. 05支持 API 令牌与旧版应用密码两种认证方式

适用场景

  1. 01查询工作区中的仓库、分支与提交记录
  2. 02列出待审查的拉取请求并添加评论
  3. 03比较功能分支与主分支之间的差异

MCP 相关

作为 MCP 服务运行,通过 STDIO 传输向 Claude Desktop、Cursor 等 MCP 客户端暴露 bb_get、bb_post、bb_put、bb_patch、bb_delete 与 bb_clone 工具。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

mcp.json · 通用配置
{
"mcpServers": {
"atlassian-bitbucket": {
"command": "npx",
"args": [
"-y",
"@aashari/mcp-server-atlassian-bitbucket"
]
}
}
}
启动命令npx -y @aashari/mcp-server-atlassian-bitbucket

本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。

安装包
npm@aashari/mcp-server-atlassian-bitbucket

工具

6

收录的工具列表 · 更新于 3 周前

参数类型必填说明
jqstring否用于筛选/转换响应的 JMESPath 表达式。重要:始终使用此参数仅提取所需字段,以降低令牌成本。示例:"values[*].{name: name, slug: slug}"(提取特定字段)、"values[0]"(第一个结果)、"values[*].name"(仅名称)。参见 https://jmespath.org
pathstring是Bitbucket API 端点路径(不含基础 URL)。必须以“/”开头。示例:“/workspaces”、“/repositories/{workspace}/{repo_slug}”、“/repositories/{workspace}/{repo_slug}/pullrequests/{id}”
queryParamsobject否可选的键值对查询参数。示例:{"pagelen": "25", "page": "2", "q": "state=\"OPEN\"", "fields": "values.title,values.state"}
outputFormatenum否输出格式:"toon"(默认,令牌减少 30–60%)或 "json"。TOON 针对大模型进行了优化,使用表格数组和最少语法。toon | json

详细介绍

将 AI 连接到你的 Bitbucket 仓库

将 Claude、Cursor AI 和其他 AI 助手直接连接到你的仓库、拉取请求和代码,彻底改变你使用 Bitbucket 的方式。即时获取洞察、自动化代码审查,并简化开发工作流。

NPM Version License

你可以做什么

  • 向 AI 询问代码:“我的主仓库中最新的提交是什么?”
  • 获取 PR 洞察:“显示所有待审查的开放拉取请求”
  • 搜索代码库:“查找所有使用身份验证函数的 JavaScript 文件”
  • 审查代码更改:“比较我的功能分支与 main 之间的差异”
  • 管理拉取请求:“为我的 new-feature 分支创建一个 PR”
  • 自动化工作流:“在 PR #123 中添加测试结果评论”

适用人群

  • 希望借助 AI 进行代码审查和仓库管理的开发者
  • 需要快速了解项目状态和拉取请求活动的团队负责人
  • 希望自动化仓库工作流和分支管理的DevOps 工程师
  • 希望使用自然语言与 Bitbucket 交互的所有人

要求

  • Node.js 18.0.0 或更高版本
  • Bitbucket Cloud 账号(不适用于 Bitbucket Server/Data Center)
  • 身份验证凭据:作用域 API 令牌(推荐)或应用密码(旧版)

快速开始

只需 2 分钟即可开始使用:

1. 获取 Bitbucket 凭据

IMPORTANT:Bitbucket 应用密码正在弃用,并将于 2026 年 6 月移除。我们建议在新配置中使用作用域 API 令牌。

选项 A:作用域 API 令牌(推荐——面向未来)

Bitbucket 正在弃用应用密码。请改用新的作用域 API 令牌:

  1. 前往 Atlassian API Tokens
  2. 点击 “Create API token with scopes”
  3. 选择 “Bitbucket” 作为产品
  4. 选择适当的作用域:
    • 只读访问:repository、workspace
    • 完整功能:repository、workspace、pullrequest
  5. 复制生成的令牌(以 ATATT 开头)
  6. 使用你的 Atlassian 邮箱作为用户名
选项 B:应用密码(旧版——即将弃用)

生成 Bitbucket 应用密码(旧方法):

  1. 前往 Bitbucket App Passwords
  2. 点击“Create app password”
  3. 为其命名,例如“AI Assistant”
  4. 选择以下权限:
    • 工作区:读取
    • 仓库:读取(如果希望 AI 创建 PR/评论,则还需写入)
    • 拉取请求:读取(管理 PR 时还需写入)
2. 立即试用
# Set your credentials (choose one method)

# Method 1: Scoped API Token (recommended - future-proof)
export ATLASSIAN_USER_EMAIL="[email protected]"
export ATLASSIAN_API_TOKEN="your_scoped_api_token"  # Token starting with ATATT

# OR Method 2: Legacy App Password (will be deprecated June 2026)
export ATLASSIAN_BITBUCKET_USERNAME="your_username"
export ATLASSIAN_BITBUCKET_APP_PASSWORD="your_app_password"

# List your workspaces
npx -y @aashari/mcp-server-atlassian-bitbucket get --path "/workspaces"

# List repositories in a workspace
npx -y @aashari/mcp-server-atlassian-bitbucket get --path "/repositories/your-workspace"

# Get pull requests for a repository
npx -y @aashari/mcp-server-atlassian-bitbucket get --path "/repositories/your-workspace/your-repo/pullrequests"

# Get repository details with JMESPath filtering
npx -y @aashari/mcp-server-atlassian-bitbucket get --path "/repositories/your-workspace/your-repo" --jq "{name: name, language: language}"

连接到 AI 助手

Claude Desktop 用户

将以下内容添加到 Claude 配置文件(~/.claude/claude_desktop_config.json):

选项 1:作用域 API 令牌(推荐——面向未来)

{
  "mcpServers": {
    "bitbucket": {
      "command": "npx",
      "args": ["-y", "@aashari/mcp-server-atlassian-bitbucket"],
      "env": {
        "ATLASSIAN_USER_EMAIL": "[email protected]",
        "ATLASSIAN_API_TOKEN": "your_scoped_api_token"
      }
    }
  }
}

选项 2:旧版应用密码(将于 2026 年 6 月弃用)

{
  "mcpServers": {
    "bitbucket": {
      "command": "npx",
      "args": ["-y", "@aashari/mcp-server-atlassian-bitbucket"],
      "env": {
        "ATLASSIAN_BITBUCKET_USERNAME": "your_username",
        "ATLASSIAN_BITBUCKET_APP_PASSWORD": "your_app_password"
      }
    }
  }
}

重启 Claude Desktop 后,你将在状态栏中看到 bitbucket 服务。

其他 AI 助手

大多数 AI 助手都支持 MCP。你可以选择以下方式:

选项 1:使用 npx(推荐——始终使用最新版本): 配置 AI 助手运行:npx -y @aashari/mcp-server-atlassian-bitbucket

选项 2:全局安装:

npm install -g @aashari/mcp-server-atlassian-bitbucket

然后配置 AI 助手,通过 STDIO 传输使用 MCP 服务。

支持的 AI 助手:

  • Claude Desktop(官方支持)
  • Cursor AI
  • Continue.dev
  • Cline
  • 任何兼容 MCP 的客户端
替代方案:配置文件

创建 ~/.mcp/configs.json 以进行系统级配置:

选项 1:作用域 API 令牌(推荐,面向未来)

{
  "bitbucket": {
    "environments": {
      "ATLASSIAN_USER_EMAIL": "[email protected]",
      "ATLASSIAN_API_TOKEN": "your_scoped_api_token",
      "BITBUCKET_DEFAULT_WORKSPACE": "your_main_workspace"
    }
  }
}

选项 2:旧版应用密码(将于 2026 年 6 月弃用)

{
  "bitbucket": {
    "environments": {
      "ATLASSIAN_BITBUCKET_USERNAME": "your_username",
      "ATLASSIAN_BITBUCKET_APP_PASSWORD": "your_app_password",
      "BITBUCKET_DEFAULT_WORKSPACE": "your_main_workspace"
    }
  }
}

替代配置键: 除 "bitbucket" 外,系统也接受 "atlassian-bitbucket"、"@aashari/mcp-server-atlassian-bitbucket" 或 "mcp-server-atlassian-bitbucket"。

可用工具

此 MCP 服务提供 6 个通用工具,可访问任意 Bitbucket API 端点:

工具描述参数
bb_getGET 任意 Bitbucket API 端点(读取数据)path、queryParams?、jq?、outputFormat?
bb_post向任意端点发送 POST 请求(创建资源)path、body、queryParams?、jq?、outputFormat?
bb_put向任意端点发送 PUT 请求(替换资源)path、body、queryParams?、jq?、outputFormat?
bb_patch向任意端点发送 PATCH 请求(部分更新)path、body、queryParams?、jq?、outputFormat?
bb_delete向任意端点发送 DELETE 请求(移除资源)path、queryParams?、jq?、outputFormat?
bb_clone在本地克隆仓库workspaceSlug?、repoSlug、targetPath
工具参数

所有 API 工具都支持以下通用参数:

  • path(必需):以 / 开头的 API 端点路径(系统会自动添加 /2.0 前缀)
  • queryParams(可选):查询参数的键值对(例如,{"pagelen": "25", "page": "2"})
  • jq(可选):用于筛选/转换响应的 JMESPath 表达式——强烈建议使用,以降低令牌成本
  • outputFormat(可选):"toon"(默认,可减少 30-60% 的令牌)或 "json"
  • body(POST/PUT/PATCH 必需):作为 JSON 对象的请求正文
常用 API 路径

所有路径前都会自动添加 /2.0。Bitbucket Cloud REST API 2.0 完整参考文档:https://developer.atlassian.com/cloud/bitbucket/rest/

工作区和仓库:

  • /workspaces - 列出所有工作区
  • /repositories/{workspace} - 列出工作区中的仓库
  • /repositories/{workspace}/{repo} - 获取仓库详情
  • /repositories/{workspace}/{repo}/refs/branches - 列出分支
  • /repositories/{workspace}/{repo}/refs/branches/{branch_name} - 获取/删除分支
  • /repositories/{workspace}/{repo}/commits - 列出提交
  • /repositories/{workspace}/{repo}/commits/{commit} - 获取提交详情
  • /repositories/{workspace}/{repo}/src/{commit}/{filepath} - 获取文件内容

拉取请求:

  • /repositories/{workspace}/{repo}/pullrequests - 列出 PR(GET)或创建 PR(POST)
  • /repositories/{workspace}/{repo}/pullrequests/{id} - 获取/更新/删除 PR
  • /repositories/{workspace}/{repo}/pullrequests/{id}/diff - 获取 PR 差异
  • /repositories/{workspace}/{repo}/pullrequests/{id}/comments - 列出/添加 PR 评论
  • /repositories/{workspace}/{repo}/pullrequests/{id}/approve - 批准 PR(POST)或撤销批准(DELETE)
  • /repositories/{workspace}/{repo}/pullrequests/{id}/request-changes - 请求更改(POST)
  • /repositories/{workspace}/{repo}/pullrequests/{id}/merge - 合并 PR(POST)
  • /repositories/{workspace}/{repo}/pullrequests/{id}/decline - 拒绝 PR(POST)

比较:

  • /repositories/{workspace}/{repo}/diff/{source}..{destination} - 比较分支/提交

其他资源:

  • /repositories/{workspace}/{repo}/issues - 列出/管理问题
  • /repositories/{workspace}/{repo}/downloads - 列出/管理下载项
  • /repositories/{workspace}/{repo}/pipelines - 访问 Bitbucket Pipelines
  • /repositories/{workspace}/{repo}/deployments - 查看部署
TOON 输出格式

TOON 是什么? 面向令牌的对象表示法(Token-Oriented Object Notation)是一种针对大模型优化的格式,与 JSON 相比,可减少 30-60% 的令牌消耗。它使用表格数组和精简语法,同时保留所有数据。

默认行为: 所有工具默认返回 TOON 格式。如有需要,可使用 outputFormat: "json" 覆盖此设置。

示例对比:

JSON (verbose):
{
  "values": [
    {"name": "repo1", "slug": "repo-1"},
    {"name": "repo2", "slug": "repo-2"}
  ]
}

TOON (efficient):
values:
  name  | slug
  repo1 | repo-1
  repo2 | repo-2

了解更多:https://github.com/toon-format/toon

JMESPath 筛选

所有工具都支持可选的 JMESPath(jq)筛选,用于提取特定数据并进一步降低令牌成本:

重要: 务必使用 jq 筛选响应!未经筛选的 API 响应可能非常大,令牌开销也很高。

# Get just repository names
npx -y @aashari/mcp-server-atlassian-bitbucket get \
  --path "/repositories/myworkspace" \
  --jq "values[].name"

# Get PR titles and states (custom object shape)
npx -y @aashari/mcp-server-atlassian-bitbucket get \
  --path "/repositories/myworkspace/myrepo/pullrequests" \
  --jq "values[].{title: title, state: state, author: author.display_name}"

# Get first result only
npx -y @aashari/mcp-server-atlassian-bitbucket get \
  --path "/repositories/myworkspace" \
  --jq "values[0]"

# Explore schema with one item first, then filter
npx -y @aashari/mcp-server-atlassian-bitbucket get \
  --path "/workspaces" \
  --query-params '{"pagelen": "1"}'

常见 JMESPath 模式:

  • values[*].fieldName - 从所有项目中提取单个字段
  • values[*].{key1: field1, key2: field2} - 创建自定义对象结构
  • values[0] - 仅获取第一项
  • values[:5] - 获取前 5 项
  • values[?state=='OPEN'] - 按条件筛选

完整的 JMESPath 参考:https://jmespath.org

真实场景示例

探索你的仓库

向 AI 助手提问:

  • “列出我的主工作区中的所有仓库”
  • “显示 backend-api 仓库的详细信息”
  • “feature-auth 分支的提交历史是什么?”
  • “获取 main 分支中 src/config.js 的内容”
管理拉取请求

向 AI 助手提问:

  • “显示所有需要审核的开放拉取请求”
  • “获取拉取请求 #42 的详细信息,包括代码更改”
  • “创建一个从 feature-login 到 main 分支的拉取请求”
  • “在 PR #15 中添加评论,说明测试已通过”
  • “批准拉取请求 #33”
使用分支和代码

向 AI 助手提问:

  • “比较我的功能分支和 main 分支”
  • “列出 user-service 仓库中的所有分支”
  • “显示提交 abc123 和 def456 之间的差异”

高级用法

成本优化技巧
  1. 始终使用 JMESPath 筛选 - 仅提取所需字段,尽量减少令牌用量
  2. 合理使用分页 - 设置 pagelen 查询参数以限制结果(例如,{"pagelen": "10"})
  3. 先查看架构 - 不带筛选条件获取一项,查看可用字段,然后筛选后续调用
  4. 利用 TOON 格式 - 默认的 TOON 格式相比 JSON 可节省 30-60% 的令牌
  5. 使用查询参数进行筛选 - 在返回结果之前,使用 Bitbucket 的 q 参数进行服务端筛选
查询参数示例
# Filter PRs by state
npx -y @aashari/mcp-server-atlassian-bitbucket get \
  --path "/repositories/workspace/repo/pullrequests" \
  --query-params '{"state": "OPEN", "pagelen": "5"}' \
  --jq "values[*].{id: id, title: title}"

# Search PRs by title
npx -y @aashari/mcp-server-atlassian-bitbucket get \
  --path "/repositories/workspace/repo/pullrequests" \
  --query-params '{"q": "title~\"bug\""}' \
  --jq "values[*].{id: id, title: title}"

# Filter repositories by role
npx -y @aashari/mcp-server-atlassian-bitbucket get \
  --path "/repositories/workspace" \
  --query-params '{"role": "owner", "pagelen": "10"}'

# Sort by updated date
npx -y @aashari/mcp-server-atlassian-bitbucket get \
  --path "/repositories/workspace/repo/pullrequests" \
  --query-params '{"sort": "-updated_on"}' \
  --jq "values[*].{id: id, title: title, updated: updated_on}"
处理大型响应

处理返回大量数据的 API 时:

  1. 使用稀疏字段集 - 添加 fields 查询参数:{"fields": "values.name,values.slug"}
  2. 对结果分页 - 使用 pagelen 和 page 参数
  3. 在数据源处筛选 - 使用 Bitbucket 的 q 参数进行服务端筛选
  4. 使用 JQ 后处理 - 使用 JMESPath 进一步筛选响应

组合使用所有技巧的示例:

npx -y @aashari/mcp-server-atlassian-bitbucket get \
  --path "/repositories/workspace/repo/pullrequests" \
  --query-params '{"state": "OPEN", "pagelen": "10", "fields": "values.id,values.title,values.state"}' \
  --jq "values[*].{id: id, title: title}"
AI 交互最佳实践
  1. 明确指定路径 - 使用确切的工作区/仓库 slug(区分大小写)
  2. 先用 CLI 测试 - 在 AI 环境中使用前,验证路径和身份验证
  3. 使用描述性 JQ 筛选器 - 提取有意义的字段名,以便 AI 更好地理解
  4. 排查问题时启用 DEBUG - 准确查看发送到 Bitbucket API 的内容
  5. 检查 API 限制 - Bitbucket Cloud 有速率限制;使用筛选来减少调用次数

CLI 命令

CLI 与 MCP 工具相对应,可直接在终端中使用。所有命令均返回 JSON 输出(而非 TOON;TOON 仅用于 MCP 模式)。

可用命令
# Get help
npx -y @aashari/mcp-server-atlassian-bitbucket --help

# GET request
npx -y @aashari/mcp-server-atlassian-bitbucket get \
  --path "/workspaces" \
  --jq "values[*].{name: name, slug: slug}"

# GET with query parameters
npx -y @aashari/mcp-server-atlassian-bitbucket get \
  --path "/repositories/myworkspace/myrepo/pullrequests" \
  --query-params '{"state": "OPEN", "pagelen": "10"}' \
  --jq "values[*].{id: id, title: title}"

# POST request (create a PR)
npx -y @aashari/mcp-server-atlassian-bitbucket post \
  --path "/repositories/myworkspace/myrepo/pullrequests" \
  --body '{"title": "My PR", "source": {"branch": {"name": "feature"}}, "destination": {"branch": {"name": "main"}}}' \
  --jq "{id: id, title: title}"

# POST with query parameters
npx -y @aashari/mcp-server-atlassian-bitbucket post \
  --path "/repositories/myworkspace/myrepo/pullrequests/42/comments" \
  --body '{"content": {"raw": "Looks good!"}}' \
  --query-params '{"fields": "id,content"}' \
  --jq "{id: id, content: content.raw}"

# PUT request (replace resource)
npx -y @aashari/mcp-server-atlassian-bitbucket put \
  --path "/repositories/myworkspace/myrepo" \
  --body '{"description": "Updated description", "is_private": true}'

# PATCH request (partial update)
npx -y @aashari/mcp-server-atlassian-bitbucket patch \
  --path "/repositories/myworkspace/myrepo/pullrequests/123" \
  --body '{"title": "Updated PR title"}'

# DELETE request
npx -y @aashari/mcp-server-atlassian-bitbucket delete \
  --path "/repositories/myworkspace/myrepo/refs/branches/old-branch"

# Clone repository
npx -y @aashari/mcp-server-atlassian-bitbucket clone \
  --workspace-slug myworkspace \
  --repo-slug myrepo \
  --target-path /absolute/path/to/parent/directory
命令行选项

适用于 get 和 delete 命令:

  • -p, --path <path>(必填)- API 端点路径
  • -q, --query-params <json>(可选)- 以 JSON 字符串形式提供的查询参数
  • --jq <expression>(可选)- JMESPath 筛选表达式

适用于 post、put 和 patch 命令:

  • -p, --path <path>(必填)- API 端点路径
  • -b, --body <json>(必填)- 以 JSON 字符串形式提供的请求正文
  • -q, --query-params <json>(可选)- 以 JSON 字符串形式提供的查询参数
  • --jq <expression>(可选)- JMESPath 筛选表达式

适用于 clone 命令:

  • --workspace-slug <slug>(可选)- 工作区 slug(未提供时使用默认值)
  • --repo-slug <slug>(必填)- 仓库 slug
  • --target-path <path>(必填)- 仓库将克隆到的父目录的绝对路径

调试

启用调试模式

设置 DEBUG 环境变量以查看详细日志:

# For CLI testing
DEBUG=true npx -y @aashari/mcp-server-atlassian-bitbucket get --path "/workspaces"

# For Claude Desktop - add to config
{
  "mcpServers": {
    "bitbucket": {
      "command": "npx",
      "args": ["-y", "@aashari/mcp-server-atlassian-bitbucket"],
      "env": {
        "DEBUG": "true",
        "ATLASSIAN_USER_EMAIL": "...",
        "ATLASSIAN_API_TOKEN": "..."
      }
    }
  }
}

**日志文件:**在 MCP 模式下运行时,日志会写入 ~/.mcp/data/@aashari-mcp-server-atlassian-bitbucket.[session-id].log

使用 HTTP 模式进行测试

如需交互式调试,请以 HTTP 模式运行服务,并使用 MCP Inspector:

# Set credentials first
export ATLASSIAN_USER_EMAIL="[email protected]"
export ATLASSIAN_API_TOKEN="your_token"
export DEBUG=true

# Start HTTP server with MCP Inspector
npx -y @aashari/mcp-server-atlassian-bitbucket
# Then in another terminal:
PORT=3000 npm run mcp:inspect

这将打开一个可视化界面,用于测试工具并查看请求/响应数据。

常见问题

Claude Desktop 中未显示服务:

  1. 检查配置文件语法(有效的 JSON)
  2. 完全重启 Claude Desktop
  3. 检查 Claude Desktop 日志:~/Library/Logs/Claude/mcp*.log(macOS)

工具无法使用:

  1. 启用 DEBUG 模式以查看详细错误
  2. 先使用 CLI 测试,以区分 MCP 问题和凭据问题
  3. 确认 API 路径正确(区分大小写)

故障排除

“Authentication failed” 或 “403 Forbidden”
  1. 选择正确的身份验证方式:

    • Atlassian 标准方式(推荐):使用 Atlassian 账户邮箱 + API 令牌(适用于任何 Atlassian 服务)
    • Bitbucket 专用方式(旧版):使用 Bitbucket 用户名 + 应用密码(仅适用于 Bitbucket)
  2. 对于有范围限制的 API 令牌(推荐):

    • 前往 Atlassian API Tokens
    • 确认令牌仍处于有效状态且具有正确的范围
    • 所需范围:repository、workspace(管理 PR 时添加 pullrequest)
    • 令牌应以 ATATT 开头
  3. 对于 Bitbucket 应用密码(旧版):

    • 前往 Bitbucket App Passwords
    • 确认应用密码具有正确的权限
    • 请注意:应用密码将于 2026 年 6 月弃用
  4. 验证凭据:

    # Test credentials with CLI
    export ATLASSIAN_USER_EMAIL="[email protected]"
    export ATLASSIAN_API_TOKEN="your_token"
    npx -y @aashari/mcp-server-atlassian-bitbucket get --path "/workspaces"
    
  5. 环境变量命名:

    • 有范围限制的令牌请使用 ATLASSIAN_USER_EMAIL + ATLASSIAN_API_TOKEN
    • 应用密码请使用 ATLASSIAN_BITBUCKET_USERNAME + ATLASSIAN_BITBUCKET_APP_PASSWORD
    • 不要使用 ATLASSIAN_SITE_NAME——Bitbucket Cloud 不需要它
“Resource not found” 或 “404”
  1. 检查 API 路径:

    • 路径区分大小写
    • 使用工作区 slug(来自 URL),而非显示名称
    • 示例:如果仓库 URL 为 https://bitbucket.org/myteam/my-repo,请使用 myteam 和 my-repo
  2. 确认资源存在:

    # List workspaces to find the correct slug
    npx -y @aashari/mcp-server-atlassian-bitbucket get --path "/workspaces"
    
Claude Desktop 集成问题
  1. 更新配置文件后,重启 Claude Desktop
  2. 确认配置文件位置:
    • macOS:~/.claude/claude_desktop_config.json
    • Windows:%APPDATA%\Claude\claude_desktop_config.json
获取帮助

如果问题仍未解决:

  1. 运行一个简单的测试命令,确认一切正常
  2. 查看 GitHub Issues,寻找类似问题
  3. 创建新 issue,并附上错误消息和设置详情

常见问题

我需要哪些权限?

对于 Scoped API Tokens(推荐):

  • 必需的作用域:repository、workspace
  • 管理 PR 时添加 pullrequest

对于 Bitbucket App Passwords(旧版):

  • 只读访问:Workspaces:Read、Repositories:Read、Pull Requests:Read
  • 完整功能:为 Repositories 和 Pull Requests 添加“Write”权限
我可以将其用于私有仓库吗?

可以!它同时适用于公共和私有仓库。你只需通过凭据授予相应的权限。

它适用于哪些 AI 助手?

任何支持 Model Context Protocol(MCP)的 AI 助手:

  • Claude Desktop
  • Cursor AI
  • Continue.dev
  • 以及许多其他助手
我的数据安全吗?

是的!此工具:

  • 完全在本地计算机上运行
  • 使用你自己的 Bitbucket 凭据
  • 绝不会向第三方发送你的数据
  • 只会访问你授权访问的内容

从 v1.x 迁移

Version 2.0 在架构上进行了重大变更。如果你要从 v1.x 升级:

之前(v1.x)——20 多个专用工具:

bb_ls_workspaces, bb_get_workspace, bb_ls_repos, bb_get_repo,
bb_list_branches, bb_add_branch, bb_get_commit_history, bb_get_file,
bb_ls_prs, bb_get_pr, bb_add_pr, bb_update_pr, bb_approve_pr, bb_reject_pr,
bb_ls_pr_comments, bb_add_pr_comment, bb_diff_branches, bb_diff_commits, bb_search

之后(v2.0+)——6 个通用工具:

bb_get, bb_post, bb_put, bb_patch, bb_delete, bb_clone
迁移示例
v1.x 工具v2.0+ 对应项
bb_ls_workspaces()bb_get(path: "/workspaces")
bb_ls_repos(workspace: "myteam")bb_get(path: "/repositories/myteam")
bb_get_repo(workspace: "myteam", repo: "myrepo")bb_get(path: "/repositories/myteam/myrepo")
bb_list_branches(workspace: "myteam", repo: "myrepo")bb_get(path: "/repositories/myteam/myrepo/refs/branches")
bb_add_branch(...)bb_post(path: "/repositories/.../refs/branches", body: {...})
bb_ls_prs(workspace: "myteam", repo: "myrepo")bb_get(path: "/repositories/myteam/myrepo/pullrequests")
bb_get_pr(workspace: "myteam", repo: "myrepo", id: 42)bb_get(path: "/repositories/myteam/myrepo/pullrequests/42")
bb_add_pr(...)bb_post(path: "/repositories/.../pullrequests", body: {...})
bb_update_pr(...)bb_patch(path: "/repositories/.../pullrequests/42", body: {...})
bb_approve_pr(workspace: "myteam", repo: "myrepo", id: 42)bb_post(path: "/repositories/myteam/myrepo/pullrequests/42/approve", body: {})
bb_diff_branches(...)bb_get(path: "/repositories/.../diff/branch1..branch2")
主要变更
  1. 现在所有工具都需要显式路径——虽然更繁琐,但也更灵活
  2. 使用 JMESPath 过滤——仅提取所需内容,减少令牌消耗
  3. 默认使用 TOON 格式——令牌消耗减少 30–60%(可通过 outputFormat: "json" 覆盖)
  4. 直接访问 Bitbucket API——任何 API 端点均可使用,新增功能无需修改代码

支持

需要帮助?以下是获取帮助的方式:

  1. 查看上方的故障排除部分——其中涵盖了大多数常见问题
  2. 访问我们的 GitHub 仓库,查看文档和示例:github.com/aashari/mcp-server-atlassian-bitbucket
  3. 在 GitHub Issues 报告问题
  4. 发起讨论,提出功能请求或一般性问题

用心打造,献给希望将 AI 融入 Bitbucket 工作流的开发者。

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。