Token导航 LogoToken导航TokenDH.com
Bitbucket Python MCP logo
开发工具stdio官方级别未说明来源级核验

Bitbucket Python MCP

MCP Server

一个基于Model Context Protocol (MCP)的Bitbucket Cloud API集成工具,支持通过单一接口管理仓库、拉取请求、问题、提交和流水线。

工具数

25

提示词数

0

GitHub Stars

1

资源数

0
代码管理版本控制Python开发工具API集成

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

supakornemch

提供方

supakornemch

最后核验

2026/5/17 20:20

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install -e .

详细介绍

比特桶MCP服务器

用于与Bitbucket Cloud API集成的MCP(模型上下文协议)服务器。该服务器具有通过单个界面管理存储库、拉请求、问题、提交和管道的工具。

概述。

本项目使用模型上下文协议(MCP)作为工具包披露Bitbucket Cloud API的功能。FastMCP用于运行时,并支持多种通信方式(stdio、SSE和流HTTP)。

主要特点

  • 🔌 完整的Bitbucket API -管理存储库、公关、问题、投诉和管道
  • 🚀 支持多协议 -音频、SSE和流媒体HTTP
  • 🔐 身份验证安全 -使用Bitbucket应用程序密码
  • 📦 Docker支持 -可使用Docker映像和Docker组合。
  • 异步/等待 -使用异步构建,实现高性能
  • 🛠️ 易于设置 -使用环境变量

安装

先决条件

  • Python 3.10或更高版本
  • 带有应用程序密码的Bitbucket云帐户
  • 工作区段块和存储库段块(如适用)

来源

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

# Install the package
pip install -e .

使用Docker

# Build the Docker image
docker build -t bitbucket-mcp-server .

# Run with docker-compose
docker-compose up

设置

使用环境变量设置服务器:

变量描述默认值
BITBUCKET_USERNAMEBitbucket用户名或电子邮件必填
BITBUCKET_API_TOKENBitbucket App密码必需
BITBUCKET_WORKSPACEBitbucket的工作空间堵塞必需
BITBUCKET_URLBitbucket API的基础网址。https://api.bitbucket.org/2.0
MCP_TRANSPORT协议(stdio,SSE,streamable-http)stdio
MCP_HOST服务器地址127.0.0.1
MCP_PORT服务器端口9543
MCP_LOG_LEVEL日志级别(DEBUG、INFO、WARNING、ERROR、CRITICAL)INFO

设置凭据

创建Bitbucket应用程序密码

  1. 去。 大西洋API代币
  2. 点击按钮。 创建API令牌
  3. 命名令牌(例如“Bitbucket MCP服务器”)
  4. 点击。 创建
  5. 复制生成的令牌(仅显示一次)

注意: API令牌 id.atlassian.com 完全访问Bitbucket云,无需设置其他范围

所需范围(用于Bitbucket应用程序密码)

如果仅创建Bitbucket应用程序密码而不是API令牌,请确保具有以下范围:

Scope目的
repository:read阅读repository信息
repository:write创建和编辑存储库
pullrequest:read阅读公关详情和评论
pullrequest:write创建、更新和管理公关
issue:read阅读issues信息
issue:write创建和编辑issues
pipeline:read查看状态和管道细节

设置环境变量

创建文件 .env 在根项目中:

BITBUCKET_USERNAME=ชื่อผู้ใช้
BITBUCKET_API_TOKEN=token
BITBUCKET_WORKSPACE=workspace-slug
MCP_TRANSPORT=stdio
MCP_LOG_LEVEL=INFO

注意:

  • BITBUCKET_USERNAME Atlassian的电子邮件
  • BITBUCKET_API_TOKEN 代币来自 id.atlassian.com
  • BITBUCKET_WORKSPACE 是工作空间slug(https://bitbucket.org/{workspace-slug})

应用程序

运行服务器

# ใช้ stdio transport (ค่าเริ่มต้น)
python -m bitbucket_mcp_server.server

# หรือใช้คำสั่ง
bitbucket-mcp

# ตั้ง environment variables
export BITBUCKET_USERNAME=ชื่อผู้ใช้
export BITBUCKET_API_TOKEN=token
export BITBUCKET_WORKSPACE=workspace
bitbucket-mcp

使用Docker

# สร้างและรัน docker-compose (foreground)
docker-compose up

# รันเป็น background
docker-compose up -d

# ดู logs
docker-compose logs -f

# หยุด server
docker-compose down

# หรือรัน standalone
docker run -e BITBUCKET_USERNAME=ชื่อผู้ใช้ \
           -e BITBUCKET_API_TOKEN=token \
           -e BITBUCKET_WORKSPACE=workspace \
           -p 9543:9543 \
           bitbucket-mcp-server

使用开始脚本

项目有脚本。 start.sh 为了更容易运行服务器:

# ให้ script เป็น executable
chmod +x start.sh

# รัน foreground
./start.sh

# รัน background (daemon mode)
./start.sh -d
./start.sh --background

# ดูความช่วยเหลือ
./start.sh --help

运行后台模式时:

  • 服务器运行为单独的Docker容器。
  • 查看日志: docker-compose logs -f
  • 停止服务器: docker-compose down

与代码集成

如果使用VS代码,MCP服务器可以集成到编辑器中:

  1. 创建或编辑 .vscode/mcp.json 在工作区域:
{
  "servers": {
    "bitbucket-mcp": {
      "type": "http",
      "url": "http://localhost:9543/mcp"
    }
  }
}
  1. 确保MCP服务器运行:
# รัน server ในอีกหนึ่ง terminal
docker-compose up

# หรือรันเป็น local
bitbucket-mcp
  1. Bitbucket工具可用于VS代码复制

注意: 确保服务器运行在 localhost:9543 从VS代码连接之前

可用工具

管理存储库

  • list_repositories(workspace, page, page_length) -存储列表
  • get_repository(repo_slug, workspace) -查看存储详细信息

操作推拉请求

  • list_pull_requests(repo_slug, workspace, state, page) -下拉列表
  • get_pull_request(repo_slug, pull_request_id, workspace) -查看PR详细信息
  • create_pull_request(...) -创建新的公关
  • update_pull_request_details(...) -PR元数据更新
  • mark_pull_request_draft(...) -将PR设置为草稿
  • mark_pull_request_ready(...) -将PR设置为就绪
  • get_pull_request_diff(...) -查看统一差
  • get_pull_request_diffstat(...) -查看每个文件的更改
  • list_pull_request_activity(...) - ดู 活动时间表
  • list_pull_request_tasks(...) -代码审查任务列表

拉请求中的评论

  • list_pull_request_comments(...) -评论列表
  • create_pull_request_comment(...) -编写注释或内联代码评论
  • update_pull_request_comment(...) -编辑评论
  • delete_pull_request_comment(...) - ลบ 评论
  • resolve_pull_request_comment(...) -编辑注释线程

承诺

  • list_commits(...) -提交清单
  • get_commit(...) -详细信息提交
  • get_commit_diff(...) -看看康米特·迪夫。

分支

  • list_branches(...) -存储分支列表

管道

  • list_pipelines(...) -管道运行列表
  • get_pipeline(...) -管道详图

问题

  • list_issues(...) -问题列表
  • get_issue(...) -查看问题详细信息

建筑

主要部件

  • Bitbucket客户端 -用于API通信的低级HTTP客户端,支持异步
  • FastMCP服务器 -支持多协议的MCP运行时
  • 工具 -MCP工具揭示比特桶API端点

协议支持

  • 标准 -标准输入/输出传输(默认)
  • SSE -服务器发送事件(HTTP流)
  • 可流式传输http -可流式HTTP传输

发展

设置开发环境

# ติดตั้งพร้อม development dependencies
pip install -e ".[dev]"

# รัน tests
pytest

# รัน tests กับ coverage
pytest --cov=bitbucket_mcp_server

项目结构

.
├── src/
│   └── bitbucket_mcp_server/
│       ├── __init__.py
│       └── server.py          # Implementation หลัก
├── pyproject.toml             # Configuration และ dependencies
├── Dockerfile                 # Docker image definition
├── docker-compose.yml         # Docker Compose configuration
├── start.sh                   # Startup script
├── .env.example              # ตัวอย่าง environment variables
└── README.md                 # ไฟล์นี้

错误管理

服务器提供全面的错误管理:

  • 验证错误 -所需信息丢失。
  • 身份验证错误 -不正确的信条。
  • API错误 -响应Bitbucket API(4xx、5xx)
  • 网络错误 -无法连接和超时

所有错误都将与错误消息和适当的HTTP状态代码一起报告。

录音

启用调试日志记录以解决以下问题:

export MCP_LOG_LEVEL=DEBUG
bitbucket-mcp

例子

打开下拉请求列表

result = await list_pull_requests(
    repo_slug="my-repo",
    workspace="my-workspace",
    state="OPEN"
)

创建下拉请求

result = await create_pull_request(
    repo_slug="my-repo",
    title="เพิ่มฟีเจอร์ใหม่",
    source_branch="feature/new-feature",
    destination_branch="main",
    description="PR นี้เพิ่มฟีเจอร์ใหม่",
    workspace="my-workspace"
)

添加内联代码评论

result = await create_pull_request_comment(
    repo_slug="my-repo",
    pull_request_id=42,
    content="ลองใช้วิธีการอื่นที่นี่",
    file_path="src/main.py",
    line=123,
    workspace="my-workspace"
)

见CommitDiff。

diff = await get_commit_diff(
    repo_slug="my-repo",
    commit_hash="abc123def456",
    workspace="my-workspace",
    context=3
)

考虑效率。

  • 分页 -使用 page 还有。 page_length 大数据集参数
  • 超时 -HTTP启动时间为30秒。
  • 异步操作 -所有I/O操作均未阻塞。
  • 速率限制 -注意Bitbucket API的速率限制。

故障排除

身份验证失败

  • 检查。 BITBUCKET_USERNAME 还有。 BITBUCKET_API_TOKEN
  • 确保应用程序密码具有所需权限。
  • 检查工作空间堵塞是否正确

连接错误

  • 检查与Bitbucket API的网络连接
  • 检查。 MCP_HOST 还有。 MCP_PORT 配置
  • 确保防火墙未被阻止。

找不到工具

  • 检查环境变量设置
  • 监控MCP服务器运行和访问
  • 检查服务器日志

联合评估。

欢迎参加评估!请遵循以下指南:

  1. Fork存储库
  2. 创建功能分支
  3. 做你的改变
  4. 必要时添加测试
  5. 发送推送请求

许可证

该项目是开源的,受麻省理工学院许可。

支持

对于问题、功能请求或问题:

  1. 查看可用的GitHub问题
  2. 检查故障排除部分
  3. 启用调试日志记录
  4. 打开带有详细信息的新问题

资源

目录标签

目录标签

代码管理版本控制Python开发工具API集成本地部署自动化

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

token

工具数量(toolCount,工具数)

25

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiotoken部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP