Atlassian Bitbucket MCP Server

Atlassian Bitbucket MCP Server

Enables AI assistants to interact with Bitbucket Cloud and self-hosted instances for pull request reviews, code search, repository operations, and managing PR comments and approvals.

Category
访问服务器

README

Atlassian Bitbucket MCP Server

A Model Context Protocol (MCP) server that enables AI assistants to interact with Atlassian Bitbucket for pull request reviews, code search, and repository operations.

Features

  • Pull Request Management: Review PRs, add/resolve comments, approve changes
  • Code Search: Search code across repositories and commits
  • Repository Operations: List repos, browse branches, view file content
  • Dual Instance Support: Works with both Bitbucket Cloud and self-hosted Data Center/Server
  • Secure: Built with security in mind, avoiding compromised npm packages
  • Type-Safe: Full TypeScript implementation with strict type checking
  • Caching: Smart caching layer for frequently accessed static data
  • Local-First: Designed for NPX-based local usage with Personal Access Tokens

Requirements

  • Node.js >= 20.0.0
  • pnpm (recommended) or npm/yarn
  • Bitbucket Personal Access Token (Cloud or Server/Data Center)
  • Access to a Bitbucket instance (Cloud or self-hosted)

Quick Start

1. Environment Setup

Copy the example environment file and configure it:

cp .env.example .env

Edit .env and set the required variables:

BITBUCKET_URL=https://bitbucket.org # or your self-hosted URL
BITBUCKET_TOKEN=your_personal_access_token
BITBUCKET_DEFAULT_PROJECT=PROJ # your default project key

2. Installation

pnpm install

3. Build

pnpm run build

4. Usage with MCP Client

Configure your MCP client (e.g., Claude Desktop) to use this server:

{
  "mcpServers": {
    "bitbucket": {
      "command": "npx",
      "args": ["-y", "atlassian-bitbucket-mcp"],
      "env": {
        "BITBUCKET_URL": "https://bitbucket.org",
        "BITBUCKET_TOKEN": "your_token_here",
        "BITBUCKET_DEFAULT_PROJECT": "PROJ"
      }
    }
  }
}

Configuration

Environment Variables

All configuration is done through environment variables. See .env.example for the complete list.

Required

  • BITBUCKET_URL - Your Bitbucket instance URL
  • BITBUCKET_TOKEN - Personal Access Token
  • BITBUCKET_DEFAULT_PROJECT - Default project key

Optional

  • BITBUCKET_ALLOWED_ACTIONS - Comma-separated list of allowed tool actions
  • BITBUCKET_CACHE_ENABLED - Enable/disable caching (default: true)
  • BITBUCKET_CACHE_TTL_REPOS - Repository cache TTL in seconds (default: 3600)
  • See .env.example for all options

Creating a Personal Access Token

Bitbucket Cloud

  1. Go to Personal settings > Personal Access Tokens
  2. Click Create token
  3. Give it a name and select permissions:
    • Repositories: Read, Write
    • Pull requests: Read, Write
  4. Click Create and copy the token

Bitbucket Server/Data Center

  1. Go to Profile > Manage account > Personal access tokens
  2. Click Create a token
  3. Give it a name and select permissions:
    • Project permissions: Read
    • Repository permissions: Read, Write
  4. Click Create and copy the token

Available MCP Tools

This server provides the following tools for interacting with Bitbucket:

Pull Request Tools

  • bitbucket_list_pull_requests - List PRs for a repository
  • bitbucket_get_pull_request - Get detailed PR information
  • bitbucket_get_pr_diff - Get PR changes/diff
  • bitbucket_get_pr_commits - Get commits in a PR
  • bitbucket_get_pr_activities - Get PR comments and activities
  • bitbucket_add_pr_comment - Add a general comment
  • bitbucket_add_pr_inline_comment - Add inline code comment
  • bitbucket_reply_to_comment - Reply to a comment
  • bitbucket_resolve_comment - Resolve a comment thread
  • bitbucket_update_comment - Edit a comment
  • bitbucket_approve_pr - Approve a pull request

Repository Tools

  • bitbucket_list_projects - List accessible projects
  • bitbucket_list_repositories - List repos in a project
  • bitbucket_get_repository - Get repository details
  • bitbucket_get_branches - List repository branches
  • bitbucket_get_commits - Get commit history
  • bitbucket_get_file_content - Get file content at ref

Code Search Tools

  • bitbucket_search_code - Search code across repositories
  • bitbucket_search_commits - Search commits by message

See docs/TOOLS.md for detailed tool documentation (coming soon).

Development

VSCode Setup (Recommended)

This project includes VSCode workspace settings and extension recommendations. When you open the project in VSCode, you'll be prompted to install:

  • ESLint - Code linting
  • Prettier - Code formatting
  • Markdownlint - Markdown style checking

All formatting and linting happens automatically on save.

Development Commands

# Install dependencies
pnpm install

# Build the project
pnpm run build

# Watch mode for development
pnpm run watch

# Run with local changes
pnpm link --global

# Code quality checks
pnpm run format:all # Format all files
pnpm run lint:all   # Lint all files (markdown + code)
pnpm run typecheck  # Type check with TypeScript
pnpm run validate   # Run all checks (format + lint + typecheck)

Git Hooks

This project uses Husky for Git hooks to maintain code quality and consistency:

Pre-commit Hook

Automatically runs before each commit:

  1. Prettier - Formats all code
  2. ESLint - Lints and auto-fixes issues
  3. TypeScript - Type checks the code
  4. Build - Ensures project compiles

This ensures all committed code meets quality standards.

Commit Message Hook

  • Enforces Conventional Commits format
  • Valid formats: <type>(<optional-scope>): <description>
  • Allowed types: feat, fix, docs, style, refactor, test, chore, ci, build, perf, revert
  • Examples:
    • feat: add user authentication
    • fix(auth): resolve login bug
    • docs: update README

Pre-push Hook

  • Validates branch naming convention
  • Allowed patterns:
    • main, master, develop, dev
    • feature/<description>, feat/<description>
    • bugfix/<description>, fix/<description>
    • hotfix/<description>
    • release/<version>
    • chore/<description>, docs/<description>
  • Examples:
    • feature/user-authentication
    • fix/login-bug
    • release/v1.0.0

Project Structure

atlassian-bitbucket-mcp/
├── .husky/              # Git hooks
│   ├── commit-msg       # Conventional commits validation
│   ├── pre-commit       # Code quality checks
│   └── pre-push         # Branch name validation
├── docs/                # Documentation
│   ├── ARCHITECTURE.md  # System architecture and design
│   ├── CODING-STANDARDS.md  # Coding standards and best practices
│   ├── BRANCH-MANAGEMENT.md  # Branch naming and management
│   └── SECURITY.md      # Security policy
├── scripts/             # Utility scripts
│   ├── check-package-security.sh
│   ├── pre-commit.sh    # Pre-commit validation script
│   ├── pre-push.sh      # Pre-push validation script
│   ├── commit-msg.sh    # Commit message validation
│   ├── validate-branch-name.sh  # Branch name validator
│   └── setup-vscode.sh  # VSCode workspace setup
├── types/               # Shared TypeScript type definitions
│   ├── index.ts         # Type re-exports
│   ├── bitbucket.ts     # Bitbucket API types
│   ├── mcp.ts           # MCP protocol types
│   ├── config.ts        # Configuration types
│   ├── cache.ts         # Cache types
│   ├── logger.ts        # Logging types
│   └── common.ts        # Common utility types
├── src/                 # MCP server implementation
│   ├── index.ts         # Entry point
│   ├── server.ts        # MCP server setup
│   ├── config.ts        # Configuration
│   ├── cache.ts         # Caching layer
│   ├── logger.ts        # Centralized logging
│   ├── tools/           # MCP tool implementations
│   └── bitbucket/       # Bitbucket API client
├── openapi/             # OpenAPI specifications (future)
│   ├── bitbucket-cloud.yaml
│   └── bitbucket-server.yaml
├── package.json
├── tsconfig.json
└── README.md

Security

This project follows security best practices:

  • All dependencies are checked against known compromised packages
  • Minimal dependency footprint
  • Regular security audits
  • See docs/SECURITY.md for detailed security policy

Before Installing Packages

# Check if a package is safe
./scripts/check-package-security.sh <package-name>

License

This project is licensed under the GNU General Public License v3.0.

Documentation

For detailed information about this project, see:

Contributing

Contributions are welcome! Please ensure:

  1. All new dependencies are verified against compromised package lists
  2. Code follows the Coding Standards
  3. Types use type (not interface) and are placed in types/ directory
  4. Centralized logger is used at all critical paths
  5. OpenAPI YAML files are updated alongside type changes
  6. Tests are included for new features
  7. Git hooks pass (branch naming, format, lint, typecheck, build)

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选