Are you the author? Sign in to claim
atlassian-bitbucket-mcp
A Model Context Protocol (MCP) server that enables AI assistants to interact with Atlassian Bitbucket for pull request reviews, code search, and repository operations.
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
pnpm install
pnpm run build
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"
}
}
}
}
All configuration is done through environment variables. See .env.example for the complete list.
BITBUCKET_URL - Your Bitbucket instance URLBITBUCKET_TOKEN - Personal Access TokenBITBUCKET_DEFAULT_PROJECT - Default project keyBITBUCKET_ALLOWED_ACTIONS - Comma-separated list of allowed tool actionsBITBUCKET_CACHE_ENABLED - Enable/disable caching (default: true)BITBUCKET_CACHE_TTL_REPOS - Repository cache TTL in seconds (default: 3600).env.example for all optionsThis server provides the following tools for interacting with Bitbucket:
bitbucket_list_pull_requests - List PRs for a repositorybitbucket_get_pull_request - Get detailed PR informationbitbucket_get_pr_diff - Get PR changes/diffbitbucket_get_pr_commits - Get commits in a PRbitbucket_get_pr_activities - Get PR comments and activitiesbitbucket_add_pr_comment - Add a general commentbitbucket_add_pr_inline_comment - Add inline code commentbitbucket_reply_to_comment - Reply to a commentbitbucket_resolve_comment - Resolve a comment threadbitbucket_update_comment - Edit a commentbitbucket_approve_pr - Approve a pull requestbitbucket_list_projects - List accessible projectsbitbucket_list_repositories - List repos in a projectbitbucket_get_repository - Get repository detailsbitbucket_get_branches - List repository branchesbitbucket_get_commits - Get commit historybitbucket_get_file_content - Get file content at refbitbucket_search_code - Search code across repositoriesbitbucket_search_commits - Search commits by messageSee docs/TOOLS.md for detailed tool documentation (coming soon).
This project includes VSCode workspace settings and extension recommendations. When you open the project in VSCode, you'll be prompted to install:
All formatting and linting happens automatically on save.
# 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)
This project uses Husky for Git hooks to maintain code quality and consistency:
Automatically runs before each commit:
This ensures all committed code meets quality standards.
<type>(<optional-scope>): <description>feat, fix, docs, style, refactor, test, chore, ci, build, perf, revertfeat: add user authenticationfix(auth): resolve login bugdocs: update READMEmain, master, develop, devfeature/<description>, feat/<description>bugfix/<description>, fix/<description>hotfix/<description>release/<version>chore/<description>, docs/<description>feature/user-authenticationfix/login-bugrelease/v1.0.0atlassian-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
This project follows security best practices:
# Check if a package is safe
./scripts/check-package-security.sh <package-name>
This project is licensed under the GNU General Public License v3.0.
For detailed information about this project, see:
Contributions are welcome! Please ensure:
type (not interface) and are placed in types/ directoryRun Claude Code as an MCP server so any agent can delegate coding tasks to it
Browser automation using accessibility snapshots instead of screenshots
Google's universal MCP server supporting PostgreSQL, MySQL, MongoDB, Redis, and 10+ databases
Official GitHub integration for repos, issues, PRs, and CI/CD workflows