Bitbucket Server Model Context Protocol Server
mcp-bitbucket-server is a Model Context Protocol (MCP) server designed to connect AI assistants, such as Claude, to Bitbucket Server/Data Center instances. It enables natural language interaction for tasks like reviewing pull requests, managing repositories, searching users, and adding comments directly from an AI interface. The current stable version is 1.10.8. While no explicit release cadence is stated, the use of `npx mcp-bitbucket-server@latest` suggests frequent updates and maintenance. Key differentiators include its focus on the MCP standard, providing 11 specialized tools for Bitbucket operations, optimizing responses to reduce AI token usage, and utilizing Bitbucket Personal Access Tokens for secure authentication rather than OAuth or more complex schemes. It supports Node.js versions 22.0.0 and newer.
Common errors
-
"Authentication failed"
cause The provided Personal Access Token is incorrect, expired, or revoked.fixGenerate a new Personal Access Token in Bitbucket Server and ensure it is correctly configured as `BITBUCKET_TOKEN`. -
"Access forbidden"
cause The Personal Access Token has insufficient permissions for the requested operation or the associated user lacks necessary Bitbucket roles.fixCheck the project and repository permissions associated with your Personal Access Token and ensure they match the required scope (e.g., 'Read' or 'Write').
Warnings
- gotcha Ensure your Node.js environment meets the minimum version requirement (>=22.0.0). Running with older versions may lead to runtime errors or unexpected behavior.
- gotcha Personal Access Tokens (PATs) must be created with sufficient permissions for the intended operations. For example, commenting on PRs requires 'Write' project/repository permissions, while listing PRs only requires 'Read'.
- gotcha Always use environment variables or a secure configuration mechanism to store your Bitbucket Personal Access Token, as exposing it directly in scripts or version control is a security risk.
Install
-
npm install mcp-bitbucket-server -
yarn add mcp-bitbucket-server -
pnpm add mcp-bitbucket-server
Imports
- runMcpServer
const runMcpServer = require('mcp-bitbucket-server').runMcpServer;import { runMcpServer } from 'mcp-bitbucket-server'; - BitbucketTool
import type { BitbucketTool } from 'mcp-bitbucket-server'; - configureServer
import { configureServer } from 'mcp-bitbucket-server';
Quickstart
claude mcp add -s user \
bitbucket-server \
npx mcp-bitbucket-server@latest \
-e "BITBUCKET_URL=https://bitbucket.yourcompany.com" \
-e "BITBUCKET_TOKEN=your_personal_access_token"