Transform how you work with Bitbucket by connecting Claude, Cursor AI, and other AI assistants directly to your repositories, pull requests, and code. Get instant insights, automate code reviews, and streamline your development workflow. - Ask AI about your code: "What's the latest commit in my main repository?" - Get PR insights: "Show me all open pull requests that need review" - Search your cod
Add this skill
npx mdskills install aashari/mcp-server-atlassian-bitbucketComprehensive MCP server with well-documented API tools, clear auth setup, and token optimization features
Transform how you work with Bitbucket by connecting Claude, Cursor AI, and other AI assistants directly to your repositories, pull requests, and code. Get instant insights, automate code reviews, and streamline your development workflow.
Get up and running in 2 minutes:
IMPORTANT: Bitbucket App Passwords are being deprecated and will be removed by June 2026. We recommend using Scoped API Tokens for new setups.
Bitbucket is deprecating app passwords. Use the new scoped API tokens instead:
repository, workspacerepository, workspace, pullrequestATATT)Generate a Bitbucket App Password (legacy method):
# Set your credentials (choose one method)
# Method 1: Scoped API Token (recommended - future-proof)
export ATLASSIAN_USER_EMAIL="your.email@company.com"
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}"
Add this to your Claude configuration file (~/.claude/claude_desktop_config.json):
Option 1: Scoped API Token (recommended - future-proof)
{
"mcpServers": {
"bitbucket": {
"command": "npx",
"args": ["-y", "@aashari/mcp-server-atlassian-bitbucket"],
"env": {
"ATLASSIAN_USER_EMAIL": "your.email@company.com",
"ATLASSIAN_API_TOKEN": "your_scoped_api_token"
}
}
}
}
Option 2: Legacy App Password (will be deprecated June 2026)
{
"mcpServers": {
"bitbucket": {
"command": "npx",
"args": ["-y", "@aashari/mcp-server-atlassian-bitbucket"],
"env": {
"ATLASSIAN_BITBUCKET_USERNAME": "your_username",
"ATLASSIAN_BITBUCKET_APP_PASSWORD": "your_app_password"
}
}
}
}
Restart Claude Desktop, and you'll see the bitbucket server in the status bar.
Most AI assistants support MCP. You can either:
Option 1: Use npx (recommended - always latest version):
Configure your AI assistant to run: npx -y @aashari/mcp-server-atlassian-bitbucket
Option 2: Install globally:
npm install -g @aashari/mcp-server-atlassian-bitbucket
Then configure your AI assistant to use the MCP server with STDIO transport.
Supported AI assistants:
Create ~/.mcp/configs.json for system-wide configuration:
Option 1: Scoped API Token (recommended - future-proof)
{
"bitbucket": {
"environments": {
"ATLASSIAN_USER_EMAIL": "your.email@company.com",
"ATLASSIAN_API_TOKEN": "your_scoped_api_token",
"BITBUCKET_DEFAULT_WORKSPACE": "your_main_workspace"
}
}
}
Option 2: Legacy App Password (will be deprecated June 2026)
{
"bitbucket": {
"environments": {
"ATLASSIAN_BITBUCKET_USERNAME": "your_username",
"ATLASSIAN_BITBUCKET_APP_PASSWORD": "your_app_password",
"BITBUCKET_DEFAULT_WORKSPACE": "your_main_workspace"
}
}
}
Alternative config keys: The system also accepts "atlassian-bitbucket", "@aashari/mcp-server-atlassian-bitbucket", or "mcp-server-atlassian-bitbucket" instead of "bitbucket".
This MCP server provides 6 generic tools that can access any Bitbucket API endpoint:
| Tool | Description | Parameters |
|---|---|---|
bb_get | GET any Bitbucket API endpoint (read data) | path, queryParams?, jq?, outputFormat? |
bb_post | POST to any endpoint (create resources) | path, body, queryParams?, jq?, outputFormat? |
bb_put | PUT to any endpoint (replace resources) | path, body, queryParams?, jq?, outputFormat? |
bb_patch | PATCH any endpoint (partial updates) | path, body, queryParams?, jq?, outputFormat? |
bb_delete | DELETE any endpoint (remove resources) | path, queryParams?, jq?, outputFormat? |
bb_clone | Clone a repository locally | workspaceSlug?, repoSlug, targetPath |
All API tools support these common parameters:
path (required): API endpoint path starting with / (the /2.0 prefix is added automatically)queryParams (optional): Key-value pairs for query parameters (e.g., {"pagelen": "25", "page": "2"})jq (optional): JMESPath expression to filter/transform the response - highly recommended to reduce token costsoutputFormat (optional): "toon" (default, 30-60% fewer tokens) or "json"body (required for POST/PUT/PATCH): Request body as JSON objectAll paths automatically have /2.0 prepended. Full Bitbucket Cloud REST API 2.0 reference: https://developer.atlassian.com/cloud/bitbucket/rest/
Workspaces & Repositories:
/workspaces - List all workspaces/repositories/{workspace} - List repos in workspace/repositories/{workspace}/{repo} - Get repo details/repositories/{workspace}/{repo}/refs/branches - List branches/repositories/{workspace}/{repo}/refs/branches/{branch_name} - Get/delete branch/repositories/{workspace}/{repo}/commits - List commits/repositories/{workspace}/{repo}/commits/{commit} - Get commit details/repositories/{workspace}/{repo}/src/{commit}/{filepath} - Get file contentPull Requests:
/repositories/{workspace}/{repo}/pullrequests - List PRs (GET) or create PR (POST)/repositories/{workspace}/{repo}/pullrequests/{id} - Get/update/delete PR/repositories/{workspace}/{repo}/pullrequests/{id}/diff - Get PR diff/repositories/{workspace}/{repo}/pullrequests/{id}/comments - List/add PR comments/repositories/{workspace}/{repo}/pullrequests/{id}/approve - Approve PR (POST) or remove approval (DELETE)/repositories/{workspace}/{repo}/pullrequests/{id}/request-changes - Request changes (POST)/repositories/{workspace}/{repo}/pullrequests/{id}/merge - Merge PR (POST)/repositories/{workspace}/{repo}/pullrequests/{id}/decline - Decline PR (POST)Comparisons:
/repositories/{workspace}/{repo}/diff/{source}..{destination} - Compare branches/commitsOther Resources:
/repositories/{workspace}/{repo}/issues - List/manage issues/repositories/{workspace}/{repo}/downloads - List/manage downloads/repositories/{workspace}/{repo}/pipelines - Access Bitbucket Pipelines/repositories/{workspace}/{repo}/deployments - View deploymentsWhat is TOON? Token-Oriented Object Notation is a format optimized for LLMs that reduces token consumption by 30-60% compared to JSON. It uses tabular arrays and minimal syntax while preserving all data.
Default behavior: All tools return TOON format by default. You can override this with outputFormat: "json" if needed.
Example comparison:
JSON (verbose):
{
"values": [
{"name": "repo1", "slug": "repo-1"},
{"name": "repo2", "slug": "repo-2"}
]
}
TOON (efficient):
values:
name | slug
repo1 | repo-1
repo2 | repo-2
Learn more: https://github.com/toon-format/toon
All tools support optional JMESPath (jq) filtering to extract specific data and reduce token costs further:
Important: Always use jq to filter responses! Unfiltered API responses can be very large and expensive in terms of tokens.
# 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"}'
Common JMESPath patterns:
values[*].fieldName - Extract single field from all itemsvalues[*].{key1: field1, key2: field2} - Create custom object shapevalues[0] - Get first item onlyvalues[:5] - Get first 5 itemsvalues[?state=='OPEN'] - Filter by conditionFull JMESPath reference: https://jmespath.org
Ask your AI assistant:
Ask your AI assistant:
Ask your AI assistant:
pagelen query parameter to limit results (e.g., {"pagelen": "10"})q parameter for server-side filtering before results are returned# 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}"
When dealing with APIs that return large payloads:
fields query parameter: {"fields": "values.name,values.slug"}pagelen and page parametersq parameter for server-side filteringExample combining all techniques:
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}"
The CLI mirrors the MCP tools for direct terminal access. All commands return JSON output (not TOON - TOON is only for MCP mode).
# 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
For get and delete commands:
-p, --path (required) - API endpoint path-q, --query-params (optional) - Query parameters as JSON string--jq (optional) - JMESPath filter expressionFor post, put, and patch commands:
-p, --path (required) - API endpoint path-b, --body (required) - Request body as JSON string-q, --query-params (optional) - Query parameters as JSON string--jq (optional) - JMESPath filter expressionFor clone command:
--workspace-slug (optional) - Workspace slug (uses default if not provided)--repo-slug (required) - Repository slug--target-path (required) - Absolute path to parent directory where repo will be clonedSet the DEBUG environment variable to see detailed logging:
# 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": "..."
}
}
}
}
Log files: When running in MCP mode, logs are written to ~/.mcp/data/@aashari-mcp-server-atlassian-bitbucket.[session-id].log
For interactive debugging, run the server in HTTP mode and use the MCP Inspector:
# Set credentials first
export ATLASSIAN_USER_EMAIL="your.email@company.com"
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
This opens a visual interface to test tools and see request/response data.
Server not appearing in Claude Desktop:
~/Library/Logs/Claude/mcp*.log (macOS)Tools not working:
Choose the right authentication method:
For Scoped API Tokens (recommended):
repository, workspace (add pullrequest for PR management)ATATTFor Bitbucket App Passwords (legacy):
Verify your credentials:
# Test credentials with CLI
export ATLASSIAN_USER_EMAIL="your.email@company.com"
export ATLASSIAN_API_TOKEN="your_token"
npx -y @aashari/mcp-server-atlassian-bitbucket get --path "/workspaces"
Environment variable naming:
ATLASSIAN_USER_EMAIL + ATLASSIAN_API_TOKEN for scoped tokensATLASSIAN_BITBUCKET_USERNAME + ATLASSIAN_BITBUCKET_APP_PASSWORD for app passwordsATLASSIAN_SITE_NAME - it's not needed for Bitbucket CloudCheck the API path:
https://bitbucket.org/myteam/my-repo, use myteam and my-repoVerify the resource exists:
# List workspaces to find the correct slug
npx -y @aashari/mcp-server-atlassian-bitbucket get --path "/workspaces"
~/.claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.jsonIf you're still having issues:
For Scoped API Tokens (recommended):
repository, workspacepullrequest for PR managementFor Bitbucket App Passwords (legacy):
Yes! This works with both public and private repositories. You just need the appropriate permissions through your credentials.
Any AI assistant that supports the Model Context Protocol (MCP):
Yes! This tool:
Version 2.0 represents a major architectural change. If you're upgrading from v1.x:
Before (v1.x) - 20+ specific tools:
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
After (v2.0+) - 6 generic tools:
bb_get, bb_post, bb_put, bb_patch, bb_delete, bb_clone
| v1.x Tool | v2.0+ Equivalent |
|---|---|
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") |
outputFormat: "json")Need help? Here's how to get assistance:
Made with care for developers who want to bring AI into their Bitbucket workflow.
Install via CLI
npx mdskills install aashari/mcp-server-atlassian-bitbucketConnect AI to Your Bitbucket Repositories is a free, open-source AI agent skill. Transform how you work with Bitbucket by connecting Claude, Cursor AI, and other AI assistants directly to your repositories, pull requests, and code. Get instant insights, automate code reviews, and streamline your development workflow. - Ask AI about your code: "What's the latest commit in my main repository?" - Get PR insights: "Show me all open pull requests that need review" - Search your cod
Install Connect AI to Your Bitbucket Repositories with a single command:
npx mdskills install aashari/mcp-server-atlassian-bitbucketThis downloads the skill files into your project and your AI agent picks them up automatically.
Connect AI to Your Bitbucket Repositories works with Claude Code, Claude Desktop, Cursor, Vscode Copilot, Windsurf, Continue Dev, Gemini Cli, Amp, Roo Code, Goose. Skills use the open SKILL.md format which is compatible with any AI coding agent that reads markdown instructions.