Bitbucket MCP Server
Provides tools for reading repositories and source code from Bitbucket, including listing workspaces, repositories, branches, commits, browsing directories, getting file content, searching code, and viewing pull requests and diffs.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Bitbucket MCP Server List all repositories in my workspace"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Bitbucket MCP Server
A Model Context Protocol (MCP) server for Bitbucket that allows MCP-compatible clients (such as Claude Desktop) to read repositories and source code from your Bitbucket workspace.
Features
This server provides the following tools:
Tool | Description |
| List all Bitbucket workspaces accessible by your account |
| List repositories in a workspace |
| Get repository details |
| List branches in a repository |
| List commit history |
| Get details for a specific commit |
| Browse repository directory structure |
| Read file contents |
| Search code in a repository |
| List pull requests |
| Read a repository README |
| Show commit diff |
Related MCP server: BitBucket-MCP-To-Review-PRs
Prerequisites
Node.js 18 or newer
Bitbucket account with access to the repositories you want to read
Bitbucket App Password (do not use your regular account password)
Create a Bitbucket App Password
Sign in to Bitbucket
Click your avatar (bottom-right) → Personal settings
Open App passwords in the left menu
Click Create app password
Add a label (for example:
MCP Server)Grant the following permissions:
Repositories:
ReadPull requests:
ReadWorkspace:
Read
Click Create and save the generated password (it is shown only once)
Installation
# Clone or enter the project folder
cd d:\Projects\Pribadi\MCP_bitbucket
# Install dependencies
npm install
# Build
npm run buildConfigure Claude Desktop
1) Open Claude Desktop config file
Windows
%APPDATA%\Claude\claude_desktop_config.jsonmacOS
~/Library/Application Support/Claude/claude_desktop_config.json2) Add MCP server configuration
Add this entry to your claude_desktop_config.json:
{
"mcpServers": {
"bitbucket": {
"command": "node",
"args": ["d:\\Projects\\Pribadi\\MCP_bitbucket\\dist\\index.js"],
"env": {
"BITBUCKET_USERNAME": "your-bitbucket-username",
"BITBUCKET_APP_PASSWORD": "your-app-password",
"BITBUCKET_WORKSPACE": "your-workspace-slug"
}
}
}
}Notes:
Replace
your-bitbucket-usernamewith your Bitbucket usernameReplace
your-app-passwordwith your Bitbucket App PasswordReplace
your-workspace-slugwith your workspace slug (optional; you can also pass workspace as a tool parameter)Use double backslashes (
\\) in Windows paths
3) Restart Claude Desktop
Close and reopen Claude Desktop so it can load the MCP server.
Usage Examples
After setup, you can ask Claude:
"List all repositories in my workspace"
"Read
src/index.tsfrom repositorymy-project""Show the folder structure of repository
backend-api""Search for
validateUserusage in repositoryauth-service""Show recent commits from branch
develop""Read README from repository
frontend-app""Show open pull requests"
Development
# Build
npm run build
# Run manually (for testing)
BITBUCKET_USERNAME=user BITBUCKET_APP_PASSWORD=pass npm startProject Structure
MCP_bitbucket/
├── src/
│ ├── index.ts # Entry point and MCP server setup
│ ├── bitbucket-client.ts # Bitbucket API client
│ └── tools.ts # MCP tool definitions
├── dist/ # Compiled JavaScript output
├── package.json
├── tsconfig.json
└── README.mdSecurity
Store App Password in environment variables, not in source code
Use read-only permissions whenever possible
All communication uses HTTPS
Never commit credentials into the repository
Available Tools
12 toolsbrowse_directoryA
Browse the contents of a directory in a repository. Returns file and folder names, types, and paths. Use this to explore the repository structure.
Inputs: repo_slug (required), path, branch, workspace.
get_commitB
Get detailed information about a specific commit including author, message, date, and files changed.
Inputs: commit_id (required), repo_slug (required), workspace.
get_commit_diffA
Get the diff/patch of a specific commit showing all changes made. Returns unified diff format.
Inputs: commit_id (required), repo_slug (required), workspace.
get_file_contentA
Read the full content of a file in a repository. Returns the raw file content as text. Use this to read source code files.
Inputs: path (required), repo_slug (required), branch, workspace.
get_pull_requestsB
List pull requests in a repository. Returns PR titles, authors, states, and descriptions.
Inputs: repo_slug (required), state, workspace.
get_readmeA
Fetch and read the README file of a repository. Automatically finds README.md, README.txt, or readme.rst.
Inputs: repo_slug (required), branch, workspace.
get_repositoryA
Get detailed information about a specific repository including its description, language, size, and URLs.
Inputs: repo_slug (required), workspace.
list_branchesA
List all branches in a repository. Returns branch names and latest commit hashes.
Inputs: repo_slug (required), workspace.
list_commitsA
List recent commits in a repository, optionally filtered by branch. Returns commit messages, authors, dates, and hashes.
Inputs: repo_slug (required), branch, workspace.
list_repositoriesB
List all repositories in a Bitbucket workspace. Returns repository names, slugs, descriptions, and links.
Inputs: workspace.
list_workspacesA
List all Bitbucket workspaces accessible by the authenticated user. Returns workspace names, slugs, and descriptions.
Inputs: no named parameters.
search_codeA
Search for code across a repository using Bitbucket's code search. Returns matching files and snippet previews.
Inputs: query (required), repo_slug (required), workspace.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Each tool targets a distinct resource and action: workspaces, repositories, branches, commits, directories, file contents, code search, PRs, README, and commit diffs are all clearly separated. Even get_commit and get_commit_diff differ by returning commit metadata versus diff output.
Tool names follow a consistent verb_noun pattern, with list_ for collections and get_ for single items. The singular/plural differences (list_repositories vs get_repository) are logical and match the resource granularity.
With 12 tools covering read-only Bitbucket operations, the count fits well within the ideal 3-15 range. Each tool serves a distinct purpose and contributes to the overall browsing and searching workflow.
The tool set provides solid read-only coverage for exploring workspaces, repositories, branches, commits, file contents, code search, and commit diffs. A notable gap is the lack of a get_pull_request detail endpoint (only list exists) and no PR diff retrieval, but these are minor for a browsing-focused server.
Maintenance
Related MCP Connectors
A MCP server built for developers enabling Git based project management with project and personal…
An MCP server that provides read access to your cloud storage providers, bank accounts and more.
MCP registry & directory: search, find & install 31k+ MCP servers & tools. Catalog and marketplace.
MCP server for siGit (sigit.si): browse repos, search code, manage PRs/issues, web search.
Related MCP Servers
- AlicenseBqualityDmaintenanceAn MCP server that provides tools for interacting with the Bitbucket API, supporting both Bitbucket Cloud and Bitbucket Server, enabling pull request, branch, file, code review, and search operations.199,530 npmMIT
- AlicenseNot gradedqualityDmaintenanceA read-only MCP server for the Bitbucket Cloud REST API v2.0 that enables AI assistants to browse workspaces, repositories, and review pull requests.45 npmISC
- AlicenseBqualityCmaintenanceA read-only MCP server that provides secure access to Bitbucket repositories, pull requests, issues, and more.38538 npm3MIT
- AlicenseBqualityBmaintenanceMCP server for Bitbucket Server integration, enabling project, repository, pull request, source code, branch, and code review operations via the Bitbucket Server APIs.27768 npmMIT