Bitbucket MCP
一个用于 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.jsRelated MCP server: Atlassian Bitbucket MCP Server
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 令牌(推荐)
创建一个具有所需权限的新令牌
设置环境变量:
BITBUCKET_AUTH_METHOD=api_token
BITBUCKET_USER_EMAIL=your.email@example.com
BITBUCKET_API_TOKEN=your_api_token应用密码
创建一个具有所需权限的新应用密码
使用
basic验证方法,并输入您的用户名和应用密码
环境变量
变量 | 描述 | 必需 |
|
| 是 |
| 您的 Atlassian 邮箱 | 用于 api_token |
| API 令牌 | 用于 api_token |
| Bitbucket 用户名 | 用于 basic 验证 |
| 应用密码 | 用于 basic 验证 |
| 默认工作空间(当工具调用省略 | 否 |
|
| 否 |
可用工具
工具 | 操作 |
| list, get, list_projects, list_members |
| list, get, create, delete, fork, get_file, list_source |
| list, get, create, update, merge, approve, unapprove, decline, list_comments, add_comment, get_diff |
| list_branches, get_branch, create_branch, delete_branch, list_tags, get_tag, create_tag |
| list, get, get_diff, get_diffstat |
| 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 |
| list, get, create, update, delete, list_comments, add_comment, vote, unvote, watch, unwatch |
| list, get, create, update, delete, list_workspace, get_workspace, create_workspace, update_workspace, delete_workspace |
输出格式
使用 format 参数控制响应的详细程度:
格式 | 描述 | 节省 Token |
| 完整 JSON 输出 | 0% |
| 紧凑的 TOON 格式 | ~50% |
| 仅包含必要字段 | ~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
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/icy-r/bitbucket-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
