bitbucket-mcp
A Model Context Protocol server for Bitbucket Cloud that lets agents read pull request diffs, comments, and pipeline logs, as well as write PR comments and edit PR details.
README
bitbucket-mcp
A Model Context Protocol server for Bitbucket Cloud, optimized for use with Claude Code. Lets the agent read pull request diffs, read and write PR comments (including file + line inline comments), edit the PR Overview (title and description), resolve and unresolve comment threads, and read Bitbucket Pipelines step logs so it can debug failing builds.
Status: alpha. Distributed on npm as @mcpkits/bitbucket.
Tools
Read-only:
| Tool | Description |
|---|---|
get_pr |
Fetch a PR's metadata (title, state, author, branches, URL). |
list_prs |
List PRs filtered by state, author, or branch. |
get_pr_diff |
Unified diff for a PR. |
list_pr_comments |
All comments on a PR (general + inline). |
get_pr_pipeline_status |
Pipelines triggered by a PR, with each step's pass/fail. |
get_pipeline_step_log |
Raw log output for a specific pipeline step. |
Write:
| Tool | Description |
|---|---|
add_pr_comment |
Post a general comment on a PR. |
add_pr_inline_comment |
Post a comment on a specific file + line in a PR's diff. |
reply_to_pr_comment |
Post a threaded reply to an existing PR comment (general or inline). |
create_pr |
Open a new PR. Defaults source to the current git branch. |
update_pr |
Update a PR's title, description (Overview), and/or reviewers list. |
set_pr_draft_state |
Mark a PR as draft or ready for review. |
resolve_pr_comment |
Mark a PR comment resolved or unresolved. |
All tools accept optional workspace and repo. When you run the server from inside a git checkout, those are inferred from the origin remote. PR-scoped tools accept an optional pr_id; when omitted, the server resolves it by listing open PRs whose source branch matches the current checked-out branch.
Setup
Requires Node 22+.
Solo (you create your own OAuth consumer)
npx -y @mcpkits/bitbucket setup
The wizard:
- Opens your browser to your workspace's OAuth consumers page; you create a private consumer with the listed scopes and paste back its key + secret.
- Opens the browser again to authorize; you click Grant access.
- Detects
claudeonPATHand offers to register the server with Claude Code automatically (user scope).
Restart Claude Code (or open a new session) and you're done.
Team (shared OAuth consumer)
If your team already keeps a Bitbucket OAuth consumer in your password manager, pass the key and secret as env vars and setup will skip the consumer-creation step:
BITBUCKET_CLIENT_KEY=... \
BITBUCKET_CLIENT_SECRET=... \
npx -y @mcpkits/bitbucket setup
You'll be prompted to confirm before the env vars are used.
Migrating from a previous local-build install
Just run npx -y @mcpkits/bitbucket setup. It detects an existing local-dist registration in ~/.claude.json, skips OAuth (your tokens in ~/.config/bitbucket-mcp/config.json are reused), and rewrites the registration to use npx. No re-auth needed.
Other MCP hosts (Claude Desktop, Cursor, etc.)
Add this to your host's MCP config:
{
"mcpServers": {
"bitbucket": {
"command": "npx",
"args": ["-y", "@mcpkits/bitbucket"]
}
}
}
For the OAuth credentials and tokens, run npx -y @mcpkits/bitbucket setup once first; they're stored in ~/.config/bitbucket-mcp/config.json and used by every invocation regardless of host.
Config file
Stored at $XDG_CONFIG_HOME/bitbucket-mcp/config.json if XDG_CONFIG_HOME is set, otherwise ~/.config/bitbucket-mcp/config.json. Mode 0600; parent dir mode 0700.
{
"clientKey": "...",
"clientSecret": "...",
"tokens": {
"accessToken": "...",
"refreshToken": "...",
"expiresAt": 1712345678000,
"scopes": ["account", "repository", "pullrequest", "pullrequest:write", "pipeline"]
}
}
Never commit this file. Never share it.
Usage
Once registered and loaded, ask the agent things like:
- "Summarize PR 42 in this repo."
- "What did my latest pipeline fail on?" → the model calls
get_pr_pipeline_status, thenget_pipeline_step_logon the failing step. - "Leave a comment on line 17 of
src/foo.tsin PR 42 saying 'this needs a null check'." → the model callsadd_pr_inline_comment.
If you're inside a git checkout of the Bitbucket repo, you typically don't need to pass workspace, repo, or pr_id — the server infers them.
Build
End users don't need to clone or build — install via
npx -y @mcpkits/bitbucket setup. This section is for contributors.
Requires Node 22+ and Vite+ (vp).
vp install # install deps
vp check # lint + typecheck
vp test # run tests
vp pack # bundle to dist/bitbucket-mcp.mjs
The build produces a single executable file at dist/bitbucket-mcp.mjs with a #!/usr/bin/env node shebang and the executable bit set.
Subcommands
bitbucket-mcp(no args) /serve— run the MCP server over stdio.setup— interactive wizard. Detects existing OAuth tokens and Claude Code registration to choose between fresh install, migration, or re-registration. HonorsBITBUCKET_CLIENT_KEY+BITBUCKET_CLIENT_SECRETenv vars for team-shared OAuth consumers (asks before using).credentials --key <KEY>— non-interactive: read the secret from stdin (or$BITBUCKET_CLIENT_SECRET), persist both to the config file.authorize— run the OAuth flow using stored credentials; open browser, wait for callback, persist tokens.print-config— emit the JSON payload forclaude mcp add-json bitbucket --scope user.help— show usage.
Security notes
- OAuth tokens and consumer secret live in a
0600file in your home directory. No env vars, no shell history. - The OAuth callback listener binds only to
127.0.0.1. Thestateparameter is a 32-byte cryptographic random and compared in constant time. - Tokens are refreshed transparently. If a refresh fails (e.g. the consumer was revoked), the MCP clears the tokens and asks you to re-run
npx -y @mcpkits/bitbucket setup. - This is a Bitbucket Cloud client — Bitbucket Server / Data Center is not supported.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。