Bitbucket 标志

Bitbucket

社区
aashari

Node.js/TypeScript MCP server for Atlassian Bitbucket. Enables AI systems (LLMs) to interact with workspaces, repositories, and pull requests via tools (list, get, comment, search). Connects AI directly to version control workflows through the standard MCP interface.

发布者aashari
代码仓库mcp-server-atlassian-bitbucket
语言TypeScript
复刻数
62
星标数
162
可用工具
20
传输类型stdio
分类
链接
  • 将工具接入 AI 工作流

    Bitbucket 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 20 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 162 个 Star 和 62 个 Fork。

Connect AI to Your Bitbucket Repositories

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.

NPM Version License

What You Can Do

  • 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 codebase: "Find all JavaScript files that use the authentication function"
  • Review code changes: "Compare the differences between my feature branch and main"
  • Manage pull requests: "Create a PR for my new-feature branch"
  • Automate workflows: "Add a comment to PR #123 with the test results"

Perfect For

  • Developers who want AI assistance with code reviews and repository management
  • Team Leads needing quick insights into project status and pull request activity
  • DevOps Engineers automating repository workflows and branch management
  • Anyone who wants to interact with Bitbucket using natural language

Requirements

  • Node.js 18.0.0 or higher
  • Bitbucket Cloud account (not Bitbucket Server/Data Center)
  • Authentication credentials: Scoped API Token (recommended) or App Password (legacy)

Quick Start

Get up and running in 2 minutes:

1. Get Your Bitbucket Credentials

IMPORTANT: Bitbucket App Passwords are being deprecated and will be removed by June 2026. We recommend using Scoped API Tokens for new setups.

Option A: Scoped API Token (Recommended - Future-Proof)

Bitbucket is deprecating app passwords. Use the new scoped API tokens instead:

  1. Go to Atlassian API Tokens
  2. Click "Create API token with scopes"
  3. Select "Bitbucket" as the product
  4. Choose the appropriate scopes:
    • For read-only access: repository, workspace
    • For full functionality: repository, workspace, pullrequest
  5. Copy the generated token (starts with ATATT)
  6. Use with your Atlassian email as the username

Option B: App Password (Legacy - Will be deprecated)

Generate a Bitbucket App Password (legacy method):

  1. Go to Bitbucket App Passwords
  2. Click "Create app password"
  3. Give it a name like "AI Assistant"
  4. Select these permissions:
    • Workspaces: Read
    • Repositories: Read (and Write if you want AI to create PRs/comments)
    • Pull Requests: Read (and Write for PR management)

2. Try It Instantly

bash
# 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}"

Connect to AI Assistants

For Claude Desktop Users

Add this to your Claude configuration file (~/.claude/claude_desktop_config.json):

Option 1: Scoped API Token (recommended - future-proof)

json
{
  "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)

json
{
  "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.

For Other AI Assistants

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:

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

Then configure your AI assistant to use the MCP server with STDIO transport.

Supported AI assistants:

  • Claude Desktop (official support)
  • Cursor AI
  • Continue.dev
  • Cline
  • Any MCP-compatible client

Alternative: Configuration File

Create ~/.mcp/configs.json for system-wide configuration:

Option 1: Scoped API Token (recommended - future-proof)

json
{
  "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)

json
{
  "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".

Available Tools

This MCP server provides 6 generic tools that can access any Bitbucket API endpoint:

ToolDescriptionParameters
bb_getGET any Bitbucket API endpoint (read data)path, queryParams?, jq?, outputFormat?
bb_postPOST to any endpoint (create resources)path, body, queryParams?, jq?, outputFormat?
bb_putPUT to any endpoint (replace resources)path, body, queryParams?, jq?, outputFormat?
bb_patchPATCH any endpoint (partial updates)path, body, queryParams?, jq?, outputFormat?
bb_deleteDELETE any endpoint (remove resources)path, queryParams?, jq?, outputFormat?
bb_cloneClone a repository locallyworkspaceSlug?, repoSlug, targetPath

Tool Parameters

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 costs
  • outputFormat (optional): "toon" (default, 30-60% fewer tokens) or "json"
  • body (required for POST/PUT/PATCH): Request body as JSON object

Common API Paths

All 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 content

Pull 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/commits

Other 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 deployments

TOON Output Format

What 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

JMESPath Filtering

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.

bash
# 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 items
  • values[*].{key1: field1, key2: field2} - Create custom object shape
  • values[0] - Get first item only
  • values[:5] - Get first 5 items
  • values[?state=='OPEN'] - Filter by condition

Full JMESPath reference: https://jmespath.org

Real-World Examples

Explore Your Repositories

Ask your AI assistant:

  • "List all repositories in my main workspace"
  • "Show me details about the backend-api repository"
  • "What's the commit history for the feature-auth branch?"
  • "Get the content of src/config.js from the main branch"

Manage Pull Requests

Ask your AI assistant:

  • "Show me all open pull requests that need review"
  • "Get details about pull request #42 including the code changes"
  • "Create a pull request from feature-login to main branch"
  • "Add a comment to PR #15 saying the tests passed"
  • "Approve pull request #33"

Work with Branches and Code

Ask your AI assistant:

  • "Compare my feature branch with the main branch"
  • "List all branches in the user-service repository"
  • "Show me the differences between commits abc123 and def456"

Advanced Usage

Cost Optimization Tips

  1. Always use JMESPath filtering - Extract only needed fields to minimize token usage
  2. Use pagination wisely - Set pagelen query parameter to limit results (e.g., {"pagelen": "10"})
  3. Explore schema first - Fetch one item without filters to see available fields, then filter subsequent calls
  4. Leverage TOON format - Default TOON format saves 30-60% tokens vs JSON
  5. Query parameters for filtering - Use Bitbucket's q parameter for server-side filtering before results are returned

Query Parameter Examples

bash
# 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}"

Working with Large Responses

When dealing with APIs that return large payloads:

  1. Use sparse fieldsets - Add fields query parameter: {"fields": "values.name,values.slug"}
  2. Paginate results - Use pagelen and page parameters
  3. Filter at the source - Use Bitbucket's q parameter for server-side filtering
  4. Post-process with JQ - Further filter the response with JMESPath

Example combining all techniques:

bash
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}"

Best Practices for AI Interactions

  1. Be specific with paths - Use exact workspace/repo slugs (case-sensitive)
  2. Test with CLI first - Verify paths and authentication before using in AI context
  3. Use descriptive JQ filters - Extract meaningful field names for better AI understanding
  4. Enable DEBUG for troubleshooting - See exactly what's being sent to Bitbucket API
  5. Check API limits - Bitbucket Cloud has rate limits; use filtering to reduce calls

CLI Commands

The CLI mirrors the MCP tools for direct terminal access. All commands return JSON output (not TOON - TOON is only for MCP mode).

Available Commands

bash
# 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

CLI Options

For get and delete commands:

  • -p, --path <path> (required) - API endpoint path
  • -q, --query-params <json> (optional) - Query parameters as JSON string
  • --jq <expression> (optional) - JMESPath filter expression

For post, put, and patch commands:

  • -p, --path <path> (required) - API endpoint path
  • -b, --body <json> (required) - Request body as JSON string
  • -q, --query-params <json> (optional) - Query parameters as JSON string
  • --jq <expression> (optional) - JMESPath filter expression

For clone command:

  • --workspace-slug <slug> (optional) - Workspace slug (uses default if not provided)
  • --repo-slug <slug> (required) - Repository slug
  • --target-path <path> (required) - Absolute path to parent directory where repo will be cloned

Debugging

Enable Debug Mode

Set the DEBUG environment variable to see detailed logging:

bash
# 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

Test with HTTP Mode

For interactive debugging, run the server in HTTP mode and use the MCP Inspector:

bash
# 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.

Common Issues

Server not appearing in Claude Desktop:

  1. Check config file syntax (valid JSON)
  2. Restart Claude Desktop completely
  3. Check Claude Desktop logs: ~/Library/Logs/Claude/mcp*.log (macOS)

Tools not working:

  1. Enable DEBUG mode to see detailed errors
  2. Test with CLI first to isolate MCP vs credentials issues
  3. Verify API paths are correct (case-sensitive)

Troubleshooting

"Authentication failed" or "403 Forbidden"

  1. Choose the right authentication method:

    • Standard Atlassian method (recommended): Use your Atlassian account email + API token (works with any Atlassian service)
    • Bitbucket-specific method (legacy): Use your Bitbucket username + App password (Bitbucket only)
  2. For Scoped API Tokens (recommended):

    • Go to Atlassian API Tokens
    • Make sure your token is still active and has the right scopes
    • Required scopes: repository, workspace (add pullrequest for PR management)
    • Token should start with ATATT
  3. For Bitbucket App Passwords (legacy):

    • Go to Bitbucket App Passwords
    • Make sure your app password has the right permissions
    • Remember: App passwords will be deprecated by June 2026
  4. Verify your credentials:

    bash
    # 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"
  5. Environment variable naming:

    • Use ATLASSIAN_USER_EMAIL + ATLASSIAN_API_TOKEN for scoped tokens
    • Use ATLASSIAN_BITBUCKET_USERNAME + ATLASSIAN_BITBUCKET_APP_PASSWORD for app passwords
    • Don't use ATLASSIAN_SITE_NAME - it's not needed for Bitbucket Cloud

"Resource not found" or "404"

  1. Check the API path:

    • Paths are case-sensitive
    • Use workspace slug (from URL), not display name
    • Example: If your repo URL is https://bitbucket.org/myteam/my-repo, use myteam and my-repo
  2. Verify the resource exists:

    bash
    # List workspaces to find the correct slug
    npx -y @aashari/mcp-server-atlassian-bitbucket get --path "/workspaces"

Claude Desktop Integration Issues

  1. Restart Claude Desktop after updating the config file
  2. Verify config file location:
    • macOS: ~/.claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json

Getting Help

If you're still having issues:

  1. Run a simple test command to verify everything works
  2. Check the GitHub Issues for similar problems
  3. Create a new issue with your error message and setup details

Frequently Asked Questions

What permissions do I need?

For Scoped API Tokens (recommended):

  • Required scopes: repository, workspace
  • Add pullrequest for PR management

For Bitbucket App Passwords (legacy):

  • For read-only access: Workspaces: Read, Repositories: Read, Pull Requests: Read
  • For full functionality: Add "Write" permissions for Repositories and Pull Requests

Can I use this with private repositories?

Yes! This works with both public and private repositories. You just need the appropriate permissions through your credentials.

What AI assistants does this work with?

Any AI assistant that supports the Model Context Protocol (MCP):

  • Claude Desktop
  • Cursor AI
  • Continue.dev
  • Many others

Is my data secure?

Yes! This tool:

  • Runs entirely on your local machine
  • Uses your own Bitbucket credentials
  • Never sends your data to third parties
  • Only accesses what you give it permission to access

Migration from v1.x

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

Migration Examples

v1.x Toolv2.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")

Key Changes

  1. All tools now require explicit paths - more verbose but more flexible
  2. Use JMESPath filtering - extract only what you need to reduce tokens
  3. TOON format by default - 30-60% fewer tokens (can override with outputFormat: "json")
  4. Direct Bitbucket API access - any API endpoint works, no code changes needed for new features

Support

Need help? Here's how to get assistance:

  1. Check the troubleshooting section above - most common issues are covered there
  2. Visit our GitHub repository for documentation and examples: github.com/aashari/mcp-server-atlassian-bitbucket
  3. Report issues at GitHub Issues
  4. Start a discussion for feature requests or general questions

Made with care for developers who want to bring AI into their Bitbucket workflow.

安装

TypingMind
前提条件:

Node.js 18+

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

可用工具

  • bb_ls_workspaces

    Lists workspaces within your Bitbucket account. Returns a formatted Markdown list showing workspace slugs, names, and membership role. Requires Bitbucket credentials to be configured.

  • bb_get_workspace

    Retrieves detailed information for a workspace identified by workspaceSlug. Returns comprehensive workspace details as formatted Markdown, including membership, projects, and key metadata. Requires Bitbucket credentials to be configured.

  • bb_ls_repos

    Lists repositories within a workspace. If workspaceSlug is not provided, uses your default workspace (either configured via BITBUCKET_DEFAULT_WORKSPACE or the first workspace in your account). Filters repositories by the users role, project key projectKey, or a querystring (searches name/description). Supports sorting viasortand pagination vialimitandcursor`. Pagination details are included at the end of the text content. Returns a formatted Markdown list with comprehensive details. Requires Bitbucket credentials.

  • bb_get_repo

    Retrieves detailed information for a specific repository identified by workspaceSlug and repoSlug. Returns comprehensive repository details as formatted Markdown, including owner, main branch, comment/task counts, recent pull requests, and relevant links. Requires Bitbucket credentials.

  • bb_get_commit_history

    Retrieves the commit history for a repository identified by workspaceSlug and repoSlug. Supports pagination via limit (number of commits per page) and cursor (which acts as the page number for this endpoint). Optionally filters history starting from a specific branch, tag, or commit hash using revision, or shows only commits affecting a specific file using path. Returns the commit history as formatted Markdown, including commit hash, author, date, and message. Pagination details are included at the end of the text content. Requires Bitbucket credentials to be configured.

  • bb_add_branch

    Creates a new branch in a specified Bitbucket repository. Requires the workspace slug (workspaceSlug), repository slug (repoSlug), the desired new branch name (newBranchName), and the source branch or commit hash (sourceBranchOrCommit) to branch from. Requires repository write permissions. Returns a success message.

  • bb_clone_repo

    Clones a Bitbucket repository to your local filesystem using SSH (preferred) or HTTPS. Requires Bitbucket credentials and proper SSH key setup for optimal usage.

    Parameters:

    • workspaceSlug: The Bitbucket workspace containing the repository (optional - will use default if not provided)
    • repoSlug: The repository name to clone (required)
    • targetPath: Parent directory where repository will be cloned (required)

    Path Handling:

    • Absolute paths are strongly recommended (e.g., "/home/user/projects" or "C:\Users\name\projects")
    • Relative paths (e.g., "./my-repos" or "../downloads") will be resolved relative to the server's working directory, which may not be what you expect
    • The repository will be cloned into a subdirectory at targetPath/repoSlug
    • Make sure you have write permissions to the target directory

    SSH Requirements:

    • SSH keys must be properly configured for Bitbucket
    • SSH agent should be running with your keys added
    • Will automatically fall back to HTTPS
  • bb_get_file

    Retrieves the content of a file from a Bitbucket repository identified by workspaceSlug and repoSlug. Specify the file to retrieve using the filePath parameter. Optionally, you can specify a revision (branch name, tag, or commit hash) to retrieve the file from - if omitted, the repository's default branch is used. Returns the raw content of the file as text. Requires Bitbucket credentials.

  • bb_list_branches

    Lists branches in a repository identified by workspaceSlug and repoSlug. Filters branches by an optional text query and supports custom sort order. Provides pagination via limit and cursor. Pagination details are included at the end of the text content. Returns branch details as Markdown with each branch's name, latest commit, and default merge strategy. Requires Bitbucket credentials.

  • bb_ls_prs

    Lists pull requests within a repository (repoSlug). If workspaceSlug is not provided, the system will use your default workspace. Filters by state (OPEN, MERGED, DECLINED, SUPERSEDED) and supports text search via query. Supports pagination via limit and cursor. Pagination details are included at the end of the text content. Returns a formatted Markdown list with each PR's title, status, author, reviewers, and creation date. Requires Bitbucket credentials to be configured.

  • bb_get_pr

    Retrieves detailed information about a specific pull request identified by prId within a repository (repoSlug). If workspaceSlug is not provided, the system will use your default workspace. Includes PR details, status, reviewers, and diff statistics. Set includeFullDiff to true (default) for the complete code changes. Set includeComments to true to also retrieve comments (default: false; Note: Enabling this may increase response time for pull requests with many comments). Returns rich information as formatted Markdown, including PR summary, code changes, and optionally comments. Requires Bitbucket credentials to be configured.

  • bb_ls_pr_comments

    Lists comments on a specific pull request identified by prId within a repository (repoSlug). If workspaceSlug is not provided, the system will use your default workspace. Retrieves both general PR comments and inline code comments, indicating their location if applicable. Supports pagination via limit and cursor. Pagination details are included at the end of the text content. Returns a formatted Markdown list with each comment's author, timestamp, content, and location for inline comments. Requires Bitbucket credentials to be configured.

  • bb_add_pr_comment

    Adds a comment to a specific pull request identified by prId within a repository (repoSlug). If workspaceSlug is not provided, the system will use your default workspace. The content parameter accepts Markdown-formatted text for the comment body. To reply to an existing comment, provide its ID in the parentId parameter. For inline code comments, provide both inline.path (file path) and inline.line (line number). Returns a success message as formatted Markdown. Requires Bitbucket credentials with write permissions to be configured.

  • bb_add_pr

    Creates a new pull request in a repository (repoSlug). If workspaceSlug is not provided, the system will use your default workspace. Required parameters include prTitle (the PR title), sourceBranch (branch with changes), and optionally destinationBranch (target branch, defaults to main/master). The description parameter accepts Markdown-formatted text for the PR description. Set closeSourceBranch to true to automatically delete the source branch after merging. Returns the newly created pull request details as formatted Markdown. Requires Bitbucket credentials with write permissions to be configured.

  • bb_update_pr

    Updates an existing pull request in a repository (repoSlug) identified by pullRequestId. If workspaceSlug is not provided, the system will use your default workspace. You can update the prTitle (the PR title) and/or description fields. At least one field must be provided. The description parameter accepts Markdown-formatted text. Returns the updated pull request details as formatted Markdown. Requires Bitbucket credentials with write permissions to be configured.

  • bb_approve_pr

    Approves a pull request in a repository (repoSlug) identified by pullRequestId. If workspaceSlug is not provided, the system will use your default workspace. This marks the pull request as approved by the current user, indicating that the changes are ready for merge (pending any other required approvals or checks). Returns an approval confirmation as formatted Markdown. Requires Bitbucket credentials with appropriate permissions to be configured.

  • bb_reject_pr

    Requests changes on a pull request in a repository (repoSlug) identified by pullRequestId. If workspaceSlug is not provided, the system will use your default workspace. This marks the pull request as requiring changes by the current user, indicating that the author should address feedback before the pull request can be merged. Returns a rejection confirmation as formatted Markdown. Requires Bitbucket credentials with appropriate permissions to be configured.

  • bb_search

    Searches Bitbucket for content matching the provided query. Use this tool to find repositories, code, pull requests, or other content in Bitbucket. Specify scope to narrow your search ("code", "repositories", "pullrequests", or "content"). Filter code searches by language or extension. Filter content searches by contentType. Only searches within the specified workspaceSlug and optionally within a specific repoSlug. Supports pagination via limit and cursor. Requires Atlassian Bitbucket credentials configured. Returns search results as Markdown.

  • bb_diff_branches

    Shows changes between branches in a repository identified by workspaceSlug and repoSlug. Compares changes in sourceBranch relative to destinationBranch. Limits the number of files to show with limit. Returns the diff as formatted Markdown showing file changes, additions, and deletions. Requires Bitbucket credentials to be configured.

  • bb_diff_commits

    Shows changes between commits in a repository identified by workspaceSlug and repoSlug. Requires sinceCommit and untilCommit to identify the specific commits to compare. Returns the diff as formatted Markdown showing file changes, additions, and deletions between the commits. Requires Bitbucket credentials to be configured.

将 Bitbucket MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 Bitbucket 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过您设备上的 TypingMind MCP 连接器在本地运行。

本地连接器设置指南

如果 MCP 服务器需要访问您电脑上的本地文件、应用或私有资源,请选择此方式。

1

打开 MCP 设置

在 TypingMind 中,依次前往“设置”、“高级设置”和“模型上下文协议”,然后选择“设置连接器”。

  1. 在您的浏览器中打开 TypingMind。
  2. 点击“设置”图标。
  3. 进入“高级设置”。
  4. 打开“模型上下文协议”部分。
  5. 点击“设置连接器”,然后选择“此设备”。
TypingMind MCP 连接器设置界面,已选择“此设备”
2

运行连接器命令

选择“此设备”,从 TypingMind 复制命令并在终端中运行。使用 MCP 时,请保持该进程运行。

  1. 复制 TypingMind 显示的设置命令。
  2. 在 macOS 上打开“终端”,或在 Windows 上打开 Windows Terminal。
  3. 粘贴并运行命令。
  4. 如果终端询问您是否继续,请确认安装软件包。
  5. 使用 MCP 工具时,请保持终端窗口及其中的进程运行。
3

将 Bitbucket 添加为服务器

当连接器状态为“就绪”时,点击“编辑服务器”,然后粘贴 MCP 服务器配置。

  1. 等待连接器状态显示为“就绪”。
  2. 点击“编辑服务器”。
  3. 粘贴 Bitbucket MCP 服务器配置。
  4. 保存服务器列表。
  5. 如需确认连接器是否仍处于就绪状态,请刷新。
TypingMind MCP 设置界面,显示正在运行的服务器和“编辑服务器”按钮
{
  "mcpServers": {
    "bitbucket": {
      "command": "npx",
      "args": [
        "-y",
        "@aashari/mcp-server-atlassian-bitbucket"
      ]
    }
  }
}
4

在不同模型中使用同一连接

保存服务器列表,打开“插件”,启用 Bitbucket MCP 工具,然后在 TypingMind 中选择任意受支持的 AI 模型,即可在聊天中使用这些工具,或将其分配给智能体。

  1. 在 TypingMind 中打开“插件”页面。
  2. 启用 Bitbucket MCP 工具。
  3. 开始聊天并选择您想使用的 AI 模型。
  4. 在聊天中使用 MCP 工具,或将其分配给 AI 智能体。
  5. 根据需要随时切换到其他 AI 模型,无需重新连接 MCP。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 Bitbucket 帮我完成这项任务吗?
Bitbucket
当然。我已阅读。
以下是我使用 Bitbucket 得到的结果。

常见问题

Bitbucket MCP 服务器有什么用途?

Bitbucket 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 Bitbucket MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您可以让 Claude、ChatGPT、Gemini 等不同 AI 模型,或您在 TypingMind 中配置的其他模型使用 Bitbucket,而无需为每个模型单独配置 MCP 服务器。

为什么在 TypingMind 中使用 Bitbucket MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是优秀的大语言模型聊天前端之一。连接 Bitbucket 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 Bitbucket MCP 连接到 TypingMind?

Bitbucket 通过 TypingMind 本地 MCP 连接器运行。当 MCP 服务器需要访问您计算机上的本地文件、桌面应用、命令行工具或私有资源时,这种方式最合适。

Bitbucket MCP 在 TypingMind 中提供哪些工具?

Bitbucket 提供 20 个 MCP 工具,您可以在 TypingMind 的插件页面启用这些工具,然后在聊天中使用,或将其分配给 AI 智能体。

使用 Bitbucket MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行掌控模型提供商、API 密钥、提示词和 MCP 配置。如果 Bitbucket 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇