{"_id":"@aseaudi/bitbucket-mcp-server","_rev":"6-7199ebe10f4243bdf1b9e75ec72e8590","name":"@aseaudi/bitbucket-mcp-server","dist-tags":{"latest":"2.2.3"},"versions":{"2.1.0":{"name":"@aseaudi/bitbucket-mcp-server","version":"2.1.0","keywords":["mcp","bitbucket","api","model-context-protocol","bitbucket-server","bitbucket-cloud","pull-request","code-review"],"author":{"name":"Parth Dogra"},"license":"MIT","_id":"@aseaudi/bitbucket-mcp-server@2.1.0","maintainers":[{"name":"aseaudi","email":"aseaudi@gmail.com"}],"homepage":"https://github.com/pdogra1299/bitbucket-mcp-server#readme","bugs":{"url":"https://github.com/pdogra1299/bitbucket-mcp-server/issues"},"bin":{"bitbucket-mcp-server":"build/index.js"},"dist":{"shasum":"48c1adc9e3aeeee52937e9ae6cdadb9192fb3186","tarball":"https://registry.npmjs.org/@aseaudi/bitbucket-mcp-server/-/bitbucket-mcp-server-2.1.0.tgz","fileCount":64,"integrity":"sha512-wWeNZvc1TmWMkE3WwGKwQWtqNFKvoF3Z8oXbLqE5IOus0Eaa3XDSS+TTFfAJ/W2aLw4jI1jGQQSwDV1E6yo1cg==","signatures":[{"sig":"MEQCIBoRDH6Xh3NJvfmzsLUgPRkgoRl1YQR9OQukSMkDJ5r8AiBsoCsNk/dF1CyMQN9fA3Kn3UlmLu7GWnf33OHqsEth7Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":592274},"main":"./build/index.js","type":"module","types":"./build/index.d.ts","engines":{"node":">=16.0.0"},"gitHead":"31dfcd8e180e76627c0dab6d920b9dac552c781d","scripts":{"dev":"tsc --watch","build":"tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\"","start":"node build/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"aseaudi","email":"aseaudi@gmail.com"},"repository":{"url":"git+https://github.com/pdogra1299/bitbucket-mcp-server.git","type":"git"},"_npmVersion":"11.12.1","description":"MCP server for Bitbucket API integration - supports both Cloud and Server","directories":{},"_nodeVersion":"26.0.0","dependencies":{"axios":"^1.10.0","minimatch":"9.0.5","@modelcontextprotocol/sdk":"^1.12.1"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.3","@types/node":"^22.15.29","@types/minimatch":"^5.1.2"},"_npmOperationalInternal":{"tmp":"tmp/bitbucket-mcp-server_2.1.0_1779732052270_0.7425830274549148","host":"s3://npm-registry-packages-npm-production"}},"2.1.1":{"name":"@aseaudi/bitbucket-mcp-server","version":"2.1.1","keywords":["mcp","bitbucket","api","model-context-protocol","bitbucket-server","bitbucket-cloud","pull-request","code-review"],"author":{"name":"Parth Dogra"},"license":"MIT","_id":"@aseaudi/bitbucket-mcp-server@2.1.1","maintainers":[{"name":"aseaudi","email":"aseaudi@gmail.com"}],"homepage":"https://github.com/pdogra1299/bitbucket-mcp-server#readme","bugs":{"url":"https://github.com/pdogra1299/bitbucket-mcp-server/issues"},"bin":{"bitbucket-mcp-server":"build/index.js"},"dist":{"shasum":"4d9ef530e332cf8d9cb2e9fccf78d1bf3ec242b6","tarball":"https://registry.npmjs.org/@aseaudi/bitbucket-mcp-server/-/bitbucket-mcp-server-2.1.1.tgz","fileCount":64,"integrity":"sha512-DoizIbfjN1+znK+us0k0YMNFAD9S/JEeE6Ojg3uKIiGzAAHduEMSK+ubC6DbV385pmw0vGMIO6R/oQ6X8EnmWw==","signatures":[{"sig":"MEUCIGOb0YfvF3Kq/BU9NowtgHWKgex90z7qsI6sFf7ivZ4gAiEA6O1OYoPydV9d8oAoyaY1eYkDTYTwNC3Z9exuAUSDSIw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":592274},"main":"./build/index.js","type":"module","types":"./build/index.d.ts","engines":{"node":">=16.0.0"},"gitHead":"31dfcd8e180e76627c0dab6d920b9dac552c781d","scripts":{"dev":"tsc --watch","build":"tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\"","start":"node build/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"aseaudi","email":"aseaudi@gmail.com"},"repository":{"url":"git+https://github.com/pdogra1299/bitbucket-mcp-server.git","type":"git"},"_npmVersion":"11.12.1","description":"MCP server for Bitbucket API integration - supports both Cloud and Server","directories":{},"_nodeVersion":"26.0.0","dependencies":{"axios":"^1.10.0","minimatch":"9.0.5","@modelcontextprotocol/sdk":"^1.12.1"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.3","@types/node":"^22.15.29","@types/minimatch":"^5.1.2"},"_npmOperationalInternal":{"tmp":"tmp/bitbucket-mcp-server_2.1.1_1779732158702_0.10564115237920779","host":"s3://npm-registry-packages-npm-production"}},"2.2.0":{"name":"@aseaudi/bitbucket-mcp-server","version":"2.2.0","keywords":["mcp","bitbucket","api","model-context-protocol","bitbucket-server","bitbucket-cloud","pull-request","code-review"],"author":{"name":"Parth Dogra"},"license":"MIT","_id":"@aseaudi/bitbucket-mcp-server@2.2.0","maintainers":[{"name":"aseaudi","email":"aseaudi@gmail.com"}],"homepage":"https://github.com/pdogra1299/bitbucket-mcp-server#readme","bugs":{"url":"https://github.com/pdogra1299/bitbucket-mcp-server/issues"},"bin":{"bitbucket-mcp-server":"build/index.js"},"dist":{"shasum":"98147f7a4c76c96aa030dee2d68a55bef1cfd757","tarball":"https://registry.npmjs.org/@aseaudi/bitbucket-mcp-server/-/bitbucket-mcp-server-2.2.0.tgz","fileCount":64,"integrity":"sha512-tqIh9rjS1pqmYlkFyi9FISVzPopESY7qXSnccGaLZKjCiIFbHhubagFfV19Hb4B2g6WPYPjV705ZJW6iYm4ykQ==","signatures":[{"sig":"MEYCIQCOfF3mEmqToGMhIRYf1aQLE9Hmg8877a8TgOqxZ2dxEwIhAPikYkDRr06ZYnf624+0BmQMt5/Ikd7Ob9uRdhca38mE","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":602705},"main":"./build/index.js","type":"module","types":"./build/index.d.ts","engines":{"node":">=16.0.0"},"gitHead":"4d45be0f2bdae16a3d0f947d26c8c507797bdb05","scripts":{"dev":"tsc --watch","build":"tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\"","start":"node build/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"aseaudi","email":"aseaudi@gmail.com"},"repository":{"url":"git+https://github.com/pdogra1299/bitbucket-mcp-server.git","type":"git"},"_npmVersion":"11.12.1","description":"MCP server for Bitbucket API integration - supports both Cloud and Server","directories":{},"_nodeVersion":"26.0.0","dependencies":{"axios":"^1.10.0","minimatch":"9.0.5","@modelcontextprotocol/sdk":"^1.12.1"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.3","@types/node":"^22.15.29","@types/minimatch":"^5.1.2"},"_npmOperationalInternal":{"tmp":"tmp/bitbucket-mcp-server_2.2.0_1779736071100_0.09620701245614605","host":"s3://npm-registry-packages-npm-production"}},"2.2.1":{"name":"@aseaudi/bitbucket-mcp-server","version":"2.2.1","keywords":["mcp","bitbucket","api","model-context-protocol","bitbucket-server","bitbucket-cloud","pull-request","code-review"],"author":{"name":"Parth Dogra"},"license":"MIT","_id":"@aseaudi/bitbucket-mcp-server@2.2.1","maintainers":[{"name":"aseaudi","email":"aseaudi@gmail.com"}],"homepage":"https://github.com/aseaudi/bitbucket-mcp-server#readme","bugs":{"url":"https://github.com/aseaudi/bitbucket-mcp-server/issues"},"bin":{"bitbucket-mcp-server":"build/index.js"},"dist":{"shasum":"543bf8324612102d2a989273f5516b9985cd6257","tarball":"https://registry.npmjs.org/@aseaudi/bitbucket-mcp-server/-/bitbucket-mcp-server-2.2.1.tgz","fileCount":64,"integrity":"sha512-4EqWjQ+Z41x8UgkBNbxBVT3dDTII9PctjuV/7om9l5/gv56APWrw0lOe2zA8RmWSVYJ39ATY8a+JNFG8DE9rXw==","signatures":[{"sig":"MEUCIQC6ImdgL3Ag/XxO5DhwkdqEtXeG5DVFmgyzyddJWTbMlQIgbdRgPXbDuQdgNVqYpQHKS+kVGCNHWonmGFDCDsm9rjI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":602696},"main":"./build/index.js","type":"module","types":"./build/index.d.ts","engines":{"node":">=16.0.0"},"gitHead":"9c35d85c1f4a4bebc57e82534e9a5b9122997009","scripts":{"dev":"tsc --watch","build":"tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\"","start":"node build/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"aseaudi","email":"aseaudi@gmail.com"},"repository":{"url":"git+https://github.com/aseaudi/bitbucket-mcp-server.git","type":"git"},"_npmVersion":"11.12.1","description":"MCP server for Bitbucket API integration - supports both Cloud and Server","directories":{},"_nodeVersion":"26.0.0","dependencies":{"axios":"^1.10.0","minimatch":"9.0.5","@modelcontextprotocol/sdk":"^1.12.1"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.3","@types/node":"^22.15.29","@types/minimatch":"^5.1.2"},"_npmOperationalInternal":{"tmp":"tmp/bitbucket-mcp-server_2.2.1_1779820744815_0.9277825040930587","host":"s3://npm-registry-packages-npm-production"}},"2.2.2":{"name":"@aseaudi/bitbucket-mcp-server","version":"2.2.2","keywords":["mcp","bitbucket","api","model-context-protocol","bitbucket-server","bitbucket-cloud","pull-request","code-review"],"author":{"name":"Parth Dogra"},"license":"MIT","_id":"@aseaudi/bitbucket-mcp-server@2.2.2","maintainers":[{"name":"aseaudi","email":"aseaudi@gmail.com"}],"homepage":"https://github.com/aseaudi/bitbucket-mcp-server#readme","bugs":{"url":"https://github.com/aseaudi/bitbucket-mcp-server/issues"},"bin":{"bitbucket-mcp-server":"build/index.js"},"dist":{"shasum":"b12d2bb85c6b5788c49e69d9a44af2d9d0090311","tarball":"https://registry.npmjs.org/@aseaudi/bitbucket-mcp-server/-/bitbucket-mcp-server-2.2.2.tgz","fileCount":64,"integrity":"sha512-T8QYSoC7Gb4OkhaF8qiqcJs/lwq6jy/QfCs8yfQS/6T61utV8wz64lS5ZKH7+n/SsoA6/K/+H6rPFJKVH/a8hQ==","signatures":[{"sig":"MEYCIQC3tRdMV/x8PhiiuWwmDj4Nd5aW/mUrdlDmG2vSMVrdAAIhAOJC8xLEKOmBUbv3mtkgijbpr+zrE/oAWMtivK0Q8lsj","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":618732},"main":"./build/index.js","type":"module","types":"./build/index.d.ts","engines":{"node":">=16.0.0"},"gitHead":"2c3f4dbc16ad530437d809b6f4436c9581b96b59","scripts":{"dev":"tsc --watch","build":"tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\"","start":"node build/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"aseaudi","email":"aseaudi@gmail.com"},"repository":{"url":"git+https://github.com/aseaudi/bitbucket-mcp-server.git","type":"git"},"_npmVersion":"11.12.1","description":"MCP server for Bitbucket API integration - supports both Cloud and Server","directories":{},"_nodeVersion":"26.0.0","dependencies":{"axios":"^1.10.0","minimatch":"9.0.5","@modelcontextprotocol/sdk":"^1.29.0"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.3","@types/node":"^22.15.29","@types/minimatch":"^5.1.2"},"_npmOperationalInternal":{"tmp":"tmp/bitbucket-mcp-server_2.2.2_1779993778334_0.6711812333107923","host":"s3://npm-registry-packages-npm-production"}},"2.2.3":{"name":"@aseaudi/bitbucket-mcp-server","version":"2.2.3","description":"MCP server for Bitbucket API integration - supports both Cloud and Server","type":"module","main":"./build/index.js","bin":{"bitbucket-mcp-server":"build/index.js"},"scripts":{"build":"tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\"","dev":"tsc --watch","start":"node build/index.js","prepublishOnly":"npm run build"},"keywords":["mcp","bitbucket","api","model-context-protocol","bitbucket-server","bitbucket-cloud","pull-request","code-review"],"author":{"name":"Parth Dogra"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/aseaudi/bitbucket-mcp-server.git"},"bugs":{"url":"https://github.com/aseaudi/bitbucket-mcp-server/issues"},"homepage":"https://github.com/aseaudi/bitbucket-mcp-server#readme","engines":{"node":">=16.0.0"},"dependencies":{"@modelcontextprotocol/sdk":"^1.29.0","axios":"^1.10.0","minimatch":"9.0.5"},"devDependencies":{"@types/minimatch":"^5.1.2","@types/node":"^22.15.29","typescript":"^5.8.3"},"gitHead":"d2642fe4863941dd57d6b5e74b4dc100d3599856","types":"./build/index.d.ts","_id":"@aseaudi/bitbucket-mcp-server@2.2.3","_nodeVersion":"26.0.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-CA0d96Rv5iRtLZ8NtDiIOaooudZegm7G9t/L6pDgWibgnsOOtexjIuMlkos1xaXCzVE4FrGTvfWnZrcA4dT7xw==","shasum":"3d6ff815dc249e3c69567ac7d2b8e5a84de1e14e","tarball":"https://registry.npmjs.org/@aseaudi/bitbucket-mcp-server/-/bitbucket-mcp-server-2.2.3.tgz","fileCount":64,"unpackedSize":624047,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCICt6/GDqAMDN3C76eeezmvtiKmQScwQq11r8sTkxK/QGAiEA3kbVtR2WNmQG6FLWGVUuKPZ0iDM3T2FK8E+Tmm6vGqU="}]},"_npmUser":{"name":"aseaudi","email":"aseaudi@gmail.com"},"directories":{},"maintainers":[{"name":"aseaudi","email":"aseaudi@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/bitbucket-mcp-server_2.2.3_1780005491736_0.4350401892942688"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-25T18:00:52.158Z","modified":"2026-05-28T21:58:11.982Z","2.1.0":"2026-05-25T18:00:52.414Z","2.1.1":"2026-05-25T18:02:38.856Z","2.2.0":"2026-05-25T19:07:51.278Z","2.2.1":"2026-05-26T18:39:05.019Z","2.2.2":"2026-05-28T18:42:58.476Z","2.2.3":"2026-05-28T21:58:11.865Z"},"bugs":{"url":"https://github.com/aseaudi/bitbucket-mcp-server/issues"},"author":{"name":"Parth Dogra"},"license":"MIT","homepage":"https://github.com/aseaudi/bitbucket-mcp-server#readme","keywords":["mcp","bitbucket","api","model-context-protocol","bitbucket-server","bitbucket-cloud","pull-request","code-review"],"repository":{"type":"git","url":"git+https://github.com/aseaudi/bitbucket-mcp-server.git"},"description":"MCP server for Bitbucket API integration - supports both Cloud and Server","maintainers":[{"name":"aseaudi","email":"aseaudi@gmail.com"}],"readme":"# Bitbucket MCP Server\n\n[![npm version](https://badge.fury.io/js/@aseaudi%2Fbitbucket-mcp-server.svg)](https://www.npmjs.com/package/@aseaudi/bitbucket-mcp-server)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nAn MCP (Model Context Protocol) server that provides tools for interacting with the Bitbucket API, supporting both Bitbucket Cloud and Bitbucket Server.\n\n## Features\n\n### Available Tools (30 total)\n\n#### PR Core (`pr_core`)\n- `get_pull_request` - Full PR details including comments, file changes, and merge info\n- `list_pull_requests` - List PRs with filters (state, author, pagination)\n- `create_pull_request` - Create new pull requests\n- `update_pull_request` - Update PR details (title, description, reviewers, destination branch)\n- `merge_pull_request` - Merge pull requests with various strategies\n- `decline_pull_request` - Decline/reject a pull request\n\n#### PR Comments (`pr_comments`)\n- `add_comment` - Add general, inline, threaded, or suggestion comments to a PR\n- `delete_comment` - Delete a comment from a pull request\n\n#### Code Review (`pr_review`)\n- `get_pull_request_diff` - Structured line-by-line diff with ADDED/REMOVED/CONTEXT types\n- `set_pr_approval` - Approve (`approved: true`) or unapprove (`approved: false`) a PR\n- `set_review_status` - Request changes (`request_changes: true`) or remove the request (`false`)\n\n#### PR Tasks — Bitbucket Server only (`pr_tasks`)\n- `list_pr_tasks` - List all tasks on a pull request\n- `create_pr_task` - Create a new task on a pull request\n- `update_pr_task` - Update the text of an existing task\n- `set_pr_task_status` - Mark a task done (`done: true`) or reopen it (`done: false`)\n- `delete_pr_task` - Delete a task from a pull request\n- `convert_pr_item` - Convert a comment to a task (`direction: \"to_task\"`) or back (`\"to_comment\"`)\n\n#### Commits (`commits`)\n- `list_pr_commits` - List all commits in a pull request\n- `list_branch_commits` - List commits in a branch with date/author/message filters\n- `get_commit_detail` - Get the structured diff for a specific commit by SHA\n\n#### Branches (`branches`)\n- `create_branch` - Create a branch from another branch, ref, or commit\n- `list_branches` - List branches with filtering and pagination\n- `get_branch` - Detailed branch info including associated PRs and stats\n- `delete_branch` - Delete a branch\n\n#### Files (`files`)\n- `list_directory_content` - List files and directories in a repository path\n- `get_file_content` - Get file content with smart truncation for large files\n- `write_file_content` - Create or update a text file by committing new content to a branch (Bitbucket Cloud only)\n- `search_files` - Search for files by glob pattern (case-insensitive, like VS Code Ctrl+P)\n- `get_file_blame` - Per-line blame: who last modified each line, commit hash, and author timestamp (Bitbucket Server only)\n\n#### Search — Bitbucket Server only (`search`)\n- `search_code` - Index-backed code search with Bitbucket modifiers (`lang:`, `ext:`, `path:`, `archived:`, `fork:`, `-term`), client-side `regex_filter` post-filter, snake_case ↔ camelCase fanout, and an index-reach probe that surfaces `INDEX_GAP_LIKELY` when the index returns nothing despite matching files existing\n- `find_in_files` - Content search via file listing + raw-content fan-out. Full PCRE regex; works on languages or branches Bitbucket's index does not cover; with rate-limit detection and honest scan diagnostics\n- `search_repositories` - Search for repositories by name, slug, or description\n\n#### Discovery (`discovery`)\n- `list_projects` - List all accessible Bitbucket projects/workspaces\n- `list_repositories` - List repositories in a project or across all accessible projects\n\n### Token Optimization\n\nv2.0.0 introduces significant token savings on every LLM request:\n\n| Configuration | Tools exposed | Est. tokens |\n|---|---|---|\n| Bitbucket Server (all groups) | 30 | ~5,200 |\n| Bitbucket Cloud (auto-filtered) | 23 | ~4,200 |\n| Custom group preset (e.g. `pr_core,pr_review,files`) | 12 | ~2,100 |\n\n**Bitbucket Cloud** automatically hides the 10 server-only tools with no configuration needed.\n\n**`BITBUCKET_TOOL_GROUPS`** lets you expose only the groups relevant to your workflow — see [Tool Group Filtering](#tool-group-filtering) below.\n\n## Installation\n\n### Using npx (Recommended)\n\nThe easiest way to use this MCP server is directly with npx:\n\n```json\n{\n  \"mcpServers\": {\n    \"bitbucket\": {\n      \"command\": \"npx\",\n      \"args\": [\n        \"-y\",\n        \"@aseaudi/bitbucket-mcp-server\"\n      ],\n      \"env\": {\n        \"BITBUCKET_USERNAME\": \"your-username\",\n        \"BITBUCKET_APP_PASSWORD\": \"your-app-password\"\n      }\n    }\n  }\n}\n```\n\nFor Bitbucket Server:\n```json\n{\n  \"mcpServers\": {\n    \"bitbucket\": {\n      \"command\": \"npx\",\n      \"args\": [\n        \"-y\",\n        \"@aseaudi/bitbucket-mcp-server\"\n      ],\n      \"env\": {\n        \"BITBUCKET_USERNAME\": \"your.email@company.com\",\n        \"BITBUCKET_TOKEN\": \"your-http-access-token\",\n        \"BITBUCKET_BASE_URL\": \"https://bitbucket.yourcompany.com\"\n      }\n    }\n  }\n}\n```\n\n### From Source\n\n1. Clone or download this repository\n2. Install dependencies:\n   ```bash\n   npm install\n   ```\n3. Build the TypeScript code:\n   ```bash\n   npm run build\n   ```\n\n## Authentication Setup\n\nThis server uses Bitbucket App Passwords for authentication.\n\n### Creating an App Password\n\n1. Log in to your Bitbucket account\n2. Navigate to: https://bitbucket.org/account/settings/app-passwords/\n3. Click \"Create app password\"\n4. Give it a descriptive label (e.g., \"MCP Server\")\n5. Select the following permissions:\n   - **Account**: Read\n   - **Repositories**: Read, Write\n   - **Pull requests**: Read, Write\n6. Click \"Create\"\n7. **Important**: Copy the generated password immediately (you won't be able to see it again!)\n\n### Running the Setup Script\n\n```bash\nnode scripts/setup-auth.js\n```\n\nThis will guide you through the authentication setup process.\n\n## Configuration\n\nAdd the server to your MCP settings file (usually located at `~/.vscode-server/data/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json`):\n\n```json\n{\n  \"mcpServers\": {\n    \"bitbucket\": {\n      \"command\": \"node\",\n      \"args\": [\"/absolute/path/to/bitbucket-mcp-server/build/index.js\"],\n      \"env\": {\n        \"BITBUCKET_USERNAME\": \"your-username\",\n        \"BITBUCKET_APP_PASSWORD\": \"your-app-password\"\n      }\n    }\n  }\n}\n```\n\nReplace:\n- `/absolute/path/to/bitbucket-mcp-server` with the actual path to this directory\n- `your-username` with your Bitbucket username (not email)\n- `your-app-password` with the app password you created\n\nFor Bitbucket Server, use:\n```json\n{\n  \"mcpServers\": {\n    \"bitbucket\": {\n      \"command\": \"node\",\n      \"args\": [\"/absolute/path/to/bitbucket-mcp-server/build/index.js\"],\n      \"env\": {\n        \"BITBUCKET_USERNAME\": \"your.email@company.com\",\n        \"BITBUCKET_TOKEN\": \"your-http-access-token\",\n        \"BITBUCKET_BASE_URL\": \"https://bitbucket.yourcompany.com\"\n      }\n    }\n  }\n}\n```\n\n**Important for Bitbucket Server users:**\n- Use your full email address as the username (e.g., \"john.doe@company.com\")\n- This is required for approval/review actions to work correctly\n\n## Tool Group Filtering\n\nReduce the number of tools sent to the LLM on every request by setting `BITBUCKET_TOOL_GROUPS` to a comma-separated list of group names. Only tools in the listed groups will be exposed.\n\n### Available groups\n\n| Group | Tools | Platform |\n|---|---|---|\n| `pr_core` | `get_pull_request`, `list_pull_requests`, `create_pull_request`, `update_pull_request`, `merge_pull_request`, `decline_pull_request` | Both |\n| `pr_comments` | `add_comment`, `delete_comment` | Both |\n| `pr_review` | `get_pull_request_diff`, `set_pr_approval`, `set_review_status` | Both |\n| `pr_tasks` | `list_pr_tasks`, `create_pr_task`, `update_pr_task`, `set_pr_task_status`, `delete_pr_task`, `convert_pr_item` | Server only |\n| `commits` | `list_pr_commits`, `list_branch_commits`, `get_commit_detail` | Both |\n| `branches` | `create_branch`, `list_branches`, `get_branch`, `delete_branch` | Both |\n| `files` | `list_directory_content`, `get_file_content`, `write_file_content` (Cloud only), `search_files`, `get_file_blame` (Server only) | Both |\n| `search` | `search_code`, `find_in_files`, `search_repositories` | Server only |\n| `discovery` | `list_projects`, `list_repositories` | Both |\n\n### Example presets\n\n**PR review workflow** (~2,100 tokens):\n```json\n\"env\": {\n  \"BITBUCKET_TOOL_GROUPS\": \"pr_core,pr_review,files\"\n}\n```\n\n**Full PR management** (~3,500 tokens):\n```json\n\"env\": {\n  \"BITBUCKET_TOOL_GROUPS\": \"pr_core,pr_comments,pr_review,pr_tasks\"\n}\n```\n\n**Code exploration only** (~1,400 tokens):\n```json\n\"env\": {\n  \"BITBUCKET_TOOL_GROUPS\": \"files,search,discovery\"\n}\n```\n\nWhen `BITBUCKET_TOOL_GROUPS` is not set, all applicable tools are exposed (default behaviour). Bitbucket Cloud users always have server-only tools automatically hidden regardless of this setting.\n\n## Usage\n\nOnce configured, you can use the available tools:\n\n### Get Pull Request\n\n```typescript\n{\n  \"tool\": \"get_pull_request\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",  // Required - your project key\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123\n  }\n}\n```\n\nReturns detailed information about the pull request including:\n- Title and description\n- Author and reviewers\n- Source and destination branches\n- Approval status\n- Links to web UI and diff\n- **Merge commit details** (when PR is merged):\n  - `merge_commit_hash`: The hash of the merge commit\n  - `merged_by`: Who performed the merge\n  - `merged_at`: When the merge occurred\n  - `merge_commit_message`: The merge commit message\n- **Active comments with nested replies** (unresolved comments that need attention):\n  - `active_comments`: Array of active comments (up to 20 most recent top-level comments)\n    - Comment text and author\n    - Creation date\n    - Whether it's an inline comment (with file path and line number)\n    - **Nested replies** (for Bitbucket Server):\n      - `replies`: Array of reply comments with same structure\n      - Replies can be nested multiple levels deep\n    - **Parent reference** (for Bitbucket Cloud):\n      - `parent_id`: ID of the parent comment for replies\n  - `active_comment_count`: Total count of unresolved comments (including nested replies)\n  - `total_comment_count`: Total count of all comments (including resolved and replies)\n- **File changes**:\n  - `file_changes`: Array of all files modified in the PR\n    - File path\n    - Status (added, modified, removed, or renamed)\n    - Old path (for renamed files)\n  - `file_changes_summary`: Summary statistics\n    - Total files changed\n- And more...\n\n### Search Code\n\nIndex-backed exact-term search via Bitbucket Server's search index (Bitbucket Server only). Fast — one API call.\n\n```typescript\n// Search in a specific repository\n{\n  \"tool\": \"search_code\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"query\": \"TODO\",\n    \"limit\": 50\n  }\n}\n\n// Filter by language and exclude noise\n{\n  \"tool\": \"search_code\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"query\": \"deprecated\",\n    \"lang\": \"java\",\n    \"exclude_terms\": [\"test\", \"spec\"]\n  }\n}\n\n// Filter by extension and post-filter the result lines with a client-side regex\n{\n  \"tool\": \"search_code\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"frontend-app\",\n    \"query\": \"useState\",\n    \"ext\": \"tsx\",\n    \"regex_filter\": \"^\\\\s*const\\\\s+\\\\[\",\n    \"case_variants\": true\n  }\n}\n```\n\n**Inputs**\n\n- `workspace` (required) — project key (e.g. `PROJ`).\n- `query` (required) — exact term or phrase. **No regex / wildcards / fuzzy match** at this layer (the Bitbucket index does not support them).\n- `repository` — repo slug. Omit to search all repos in the project.\n- `lang` — Bitbucket `lang:` modifier (e.g. `python`, `java`). One expression covers all extensions for the language.\n- `ext` — extension without dot (e.g. `tsx`). Use when `lang` is too broad.\n- `path` — subpath scope (Bitbucket `path:` modifier).\n- `exclude_terms` — array of terms to exclude (each becomes `-term`).\n- `archived` — `true` / `false` / `*` (default: active only).\n- `fork` — `true` / `false`.\n- `regex_filter` — client-side regex applied to returned hit lines as a post-filter; lets you narrow results without spending Bitbucket query budget.\n- `case_variants` — if true, also runs the query with snake_case ↔ camelCase converted and merges results (one extra API call).\n- `limit` (default 25) and `start` for pagination.\n\n**Bitbucket index limits to know about**\n\n- Punctuation other than `.` and `_` is stripped at index time. Including `=`, `(`, `:` in your `query` does not narrow it.\n- Case-insensitive. Single-character terms ignored.\n- Implicit AND between terms; OR / NOT / parentheses supported (operators **ALL CAPS**).\n- Hard caps: 250 characters total query, max 9 expressions, only files <512 KiB are indexed, only the default branch is indexed.\n\nWhen constructed clauses exceed the cap, optional clauses are dropped one-at-a-time in priority order (`exclude_terms` → `archived` → `fork` → `ext` → `lang` → `path` → `repo`) and a `QUERY_TRUNCATED` warning is emitted.\n\n**Output (dense JSON)**\n\n```json\n{\n  \"query\": \"doSomething\",\n  \"filters\": { \"project\": \"PROJ\", \"repo\": \"my-repo\" },\n  \"engine\": \"bitbucket_index\",\n  \"total_files\": 2,\n  \"total_matches\": 3,\n  \"files\": [\n    {\n      \"path\": \"src/lib/handler.ts\",\n      \"matches\": [\n        { \"line\": 17, \"text\": \"  const result = await doSomething(payload);\" },\n        { \"line\": 42, \"text\": \"export function doSomething(input: Input) {\" }\n      ]\n    },\n    {\n      \"path\": \"tests/handler.test.ts\",\n      \"matches\": [\n        { \"line\": 9, \"text\": \"  expect(doSomething(sample)).toEqual(expected);\" }\n      ]\n    }\n  ],\n  \"warnings\": [],\n  \"next_start\": null,\n  \"diagnostics\": {\n    \"default_branch_only\": true,\n    \"expression_count\": 3,\n    \"query_length\": 42,\n    \"dropped_clauses\": []\n  }\n}\n```\n\nOnly lines that actually match are returned (no surrounding context unless explicitly requested by `regex_filter`). `total_files` and `total_matches` are distinct. `engine` is `bitbucket_index` for `search_code`.\n\n**Warnings to act on**\n\n- `INDEX_GAP_LIKELY` — Bitbucket returned zero hits but matching files exist. Switch to `find_in_files`. If a `lang:` filter was set, the warning calls it out specifically — Bitbucket may not recognize that language name.\n- `REGEX_FILTER_REJECTED_ALL` — Bitbucket returned hits but your `regex_filter` killed them all. Adjust or drop it.\n- `PROBE_UNAVAILABLE` — index returned zero AND the file-list probe could not run. Cannot tell whether the term is missing or the index has a gap.\n- `QUERY_TRUNCATED` — soft-degrade dropped optional clauses to fit Bitbucket caps; the dropped clauses are listed in `diagnostics.dropped_clauses`.\n- `DEPRECATED_PARAM` — old parameter names (`search_query`, `search_context`, `include_patterns`, `file_pattern`) still work but should be migrated.\n\n### Find in Files\n\nContent search by listing files and reading them through Bitbucket's raw endpoint. Slower than `search_code` (1 + N API calls), but supports full regex and works where the index has gaps (Haskell, feature branches, files Bitbucket's index missed). Bitbucket Server only.\n\n```typescript\n// Recover a function in files the index does not cover (e.g. an unindexed language)\n{\n  \"tool\": \"find_in_files\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"filename_pattern\": \"src/**/*.hs\",\n    \"content_query\": \"doSomething\"\n  }\n}\n\n// Search a feature branch\n{\n  \"tool\": \"find_in_files\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"branch\": \"feat/new-thing\",\n    \"filename_pattern\": \"src/**/*.py\",\n    \"content_query\": \"^class\\\\s+Order\"\n  }\n}\n```\n\n**Inputs**\n\n- `workspace`, `repository`, `content_query` (required). `content_query` is a JS regex (PCRE-style) applied line-by-line to file contents.\n- `filename_pattern` — glob to scope the file set. **Strongly recommended.** Without it, the tool fans out across the whole repo and is likely to truncate or trip rate limits.\n- `branch` — defaults to the default branch.\n- `regex_filter` — optional second regex applied as a post-filter on each candidate hit line.\n- `max_files` — hard cap on files fetched (default 3000). If exceeded, response includes `truncated: true` and (on zero matches) a `POSSIBLE_FALSE_NEGATIVE` warning.\n- `parallelism` — concurrent file fetches (default 4). Higher values risk rate-limiting; on `RATE_LIMITED` warning, lower this and narrow `filename_pattern`.\n- `limit` — max total hit lines (default 25).\n\n**Rate-limit awareness**\n\n`find_in_files` watches HTTP status codes during fan-out:\n- A single `429` aborts the scan immediately.\n- Three or more consecutive `403`s also abort (likely rate-limited rather than per-file permission).\n- A successful read between failures resets the counter.\n\nWhen aborted early, the response includes a `RATE_LIMITED` warning with `aborted_after` / total counts in `diagnostics`.\n\n**Output**\n\nSame dense JSON shape as `search_code`, with `engine: \"find_in_files\"` and `diagnostics` fields specific to fan-out:\n\n```json\n\"diagnostics\": {\n  \"files_scanned\": 16,\n  \"files_attempted\": 16,\n  \"files_failed\": 0,\n  \"files_truncated\": false,\n  \"default_branch_only\": false\n}\n```\n\n**Note**: Both `search_code` and `find_in_files` work only with Bitbucket Server. Bitbucket Cloud support is not planned.\n\n### List Pull Requests\n\n```typescript\n{\n  \"tool\": \"list_pull_requests\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",  // Required - your project key\n    \"repository\": \"my-repo\",\n    \"state\": \"OPEN\",  // Optional: OPEN, MERGED, DECLINED, ALL (default: OPEN)\n    \"author\": \"username\",  // Optional: filter by author (see note below)\n    \"limit\": 25,  // Optional: max results per page (default: 25)\n    \"start\": 0  // Optional: pagination start index (default: 0)\n  }\n}\n```\n\nReturns a paginated list of pull requests with:\n- Array of pull requests with same details as get_pull_request\n- Total count of matching PRs\n- Pagination info (has_more, next_start)\n\n**Note on Author Filter:**\n- For Bitbucket Cloud: Use the username (e.g., \"johndoe\")\n- For Bitbucket Server: Use the full email address (e.g., \"john.doe@company.com\")\n\n### Create Pull Request\n\n```typescript\n{\n  \"tool\": \"create_pull_request\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"title\": \"Add new feature\",\n    \"source_branch\": \"feature/new-feature\",\n    \"destination_branch\": \"main\",\n    \"description\": \"This PR adds a new feature...\",  // Optional\n    \"reviewers\": [\"john.doe\", \"jane.smith\"],  // Optional\n    \"close_source_branch\": true  // Optional (default: false)\n  }\n}\n```\n\n### Update Pull Request\n\n```typescript\n{\n  \"tool\": \"update_pull_request\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"title\": \"Updated title\",  // Optional\n    \"description\": \"Updated description\",  // Optional\n    \"destination_branch\": \"develop\",  // Optional\n    \"reviewers\": [\"new.reviewer\"]  // Optional - see note below\n  }\n}\n```\n\n**Important Note on Reviewers:**\n- When updating a PR without specifying the `reviewers` parameter, existing reviewers and their approval status are preserved\n- When providing the `reviewers` parameter:\n  - The reviewer list is replaced with the new list\n  - For reviewers that already exist on the PR, their approval status is preserved\n  - New reviewers are added without approval status\n- This prevents accidentally removing reviewers when you only want to update the PR description or title\n\n### Add Comment\n\nAdd a comment to a pull request, either as a general comment or inline on specific code:\n\n```javascript\n// General comment\n{\n  \"tool\": \"add_comment\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"comment_text\": \"Great work on this PR!\"\n  }\n}\n\n// Inline comment on specific line\n{\n  \"tool\": \"add_comment\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"comment_text\": \"Consider extracting this into a separate function\",\n    \"file_path\": \"src/utils/helpers.js\",\n    \"line_number\": 42,\n    \"line_type\": \"CONTEXT\"  // ADDED, REMOVED, or CONTEXT\n  }\n}\n\n// Reply to existing comment\n{\n  \"tool\": \"add_comment\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"comment_text\": \"I agree with this suggestion\",\n    \"parent_comment_id\": 456\n  }\n}\n\n// Add comment with code suggestion (single line)\n{\n  \"tool\": \"add_comment\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"comment_text\": \"This variable name could be more descriptive.\",\n    \"file_path\": \"src/utils/helpers.js\",\n    \"line_number\": 42,\n    \"line_type\": \"CONTEXT\",\n    \"suggestion\": \"const userAuthenticationToken = token;\"\n  }\n}\n\n// Add comment with multi-line code suggestion\n{\n  \"tool\": \"add_comment\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"comment_text\": \"This function could be simplified using array methods.\",\n    \"file_path\": \"src/utils/calculations.js\",\n    \"line_number\": 50,\n    \"suggestion_end_line\": 55,\n    \"line_type\": \"CONTEXT\",\n    \"suggestion\": \"function calculateTotal(items) {\\n  return items.reduce((sum, item) => sum + item.price, 0);\\n}\"\n  }\n}\n```\n\nThe suggestion feature formats comments using GitHub-style markdown suggestion blocks that Bitbucket can render. When adding a suggestion:\n- `suggestion` is required and contains the replacement code\n- `file_path` and `line_number` are required when using suggestions\n- `suggestion_end_line` is optional and used for multi-line suggestions (defaults to `line_number`)\n- The comment will be formatted with a ````suggestion` markdown block that may be applicable in the Bitbucket UI\n\n### Using Code Snippets Instead of Line Numbers\n\nThe `add_comment` tool now supports finding line numbers automatically using code snippets. This is especially useful when AI tools analyze diffs and may struggle with exact line numbers:\n\n```javascript\n// Add comment using code snippet\n{\n  \"tool\": \"add_comment\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"comment_text\": \"This variable name could be more descriptive\",\n    \"file_path\": \"src/components/Button.res\",\n    \"code_snippet\": \"let isDisabled = false\",\n    \"search_context\": {\n      \"before\": [\"let onClick = () => {\"],\n      \"after\": [\"setLoading(true)\"]\n    }\n  }\n}\n\n// Handle multiple matches with strategy\n{\n  \"tool\": \"add_comment\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"comment_text\": \"Consider extracting this\",\n    \"file_path\": \"src/utils/helpers.js\",\n    \"code_snippet\": \"return result;\",\n    \"search_context\": {\n      \"before\": [\"const result = calculate();\"],\n      \"after\": [\"}\"]\n    },\n    \"match_strategy\": \"best\"  // Auto-select highest confidence match\n  }\n}\n```\n\n**Code Snippet Parameters:**\n- `code_snippet`: The exact code line to find (alternative to `line_number`)\n- `search_context`: Optional context to disambiguate multiple matches\n  - `before`: Array of lines that should appear before the target\n  - `after`: Array of lines that should appear after the target\n- `match_strategy`: How to handle multiple matches\n  - `\"strict\"` (default): Fail with error showing all matches\n  - `\"best\"`: Auto-select the highest confidence match\n\n**Error Response for Multiple Matches (strict mode):**\n```json\n{\n  \"error\": {\n    \"code\": \"MULTIPLE_MATCHES_FOUND\",\n    \"message\": \"Code snippet 'return result;' found in 3 locations\",\n    \"occurrences\": [\n      {\n        \"line_number\": 42,\n        \"file_path\": \"src/utils/helpers.js\",\n        \"preview\": \"  const result = calculate();\\n> return result;\\n}\",\n        \"confidence\": 0.9,\n        \"line_type\": \"ADDED\"\n      },\n      // ... more matches\n    ],\n    \"suggestion\": \"To resolve, either:\\n1. Add more context...\\n2. Use match_strategy: 'best'...\\n3. Use line_number directly\"\n  }\n}\n```\n\nThis feature is particularly useful for:\n- AI-powered code review tools that analyze diffs\n- Scripts that automatically add comments based on code patterns\n- Avoiding line number confusion in large diffs\n\n**Note on comment replies:**\n- Use `parent_comment_id` to reply to any comment (general or inline)\n- In `get_pull_request` responses:\n  - Bitbucket Server shows replies nested in a `replies` array\n  - Bitbucket Cloud shows a `parent_id` field for reply comments\n- You can reply to replies, creating nested conversations\n\n**Note on inline comments:**\n- `file_path`: The path to the file as shown in the diff\n- `line_number`: The line number as shown in the diff\n- `line_type`: \n  - `ADDED` - For newly added lines (green in diff)\n  - `REMOVED` - For deleted lines (red in diff)\n  - `CONTEXT` - For unchanged context lines\n\n#### Add Comment - Complete Usage Guide\n\nThe `add_comment` tool supports multiple scenarios. Here's when and how to use each approach:\n\n**1. General PR Comments (No file/line)**\n- Use when: Making overall feedback about the PR\n- Required params: `comment_text` only\n- Example: \"LGTM!\", \"Please update the documentation\"\n\n**2. Reply to Existing Comments**\n- Use when: Continuing a conversation thread\n- Required params: `comment_text`, `parent_comment_id`\n- Works for both general and inline comment replies\n\n**3. Inline Comments with Line Number**\n- Use when: You know the exact line number from the diff\n- Required params: `comment_text`, `file_path`, `line_number`\n- Optional: `line_type` (defaults to CONTEXT)\n\n**4. Inline Comments with Code Snippet**\n- Use when: You have the code but not the line number (common for AI tools)\n- Required params: `comment_text`, `file_path`, `code_snippet`\n- The tool will automatically find the line number\n- Add `search_context` if the code appears multiple times\n- Use `match_strategy: \"best\"` to auto-select when multiple matches exist\n\n**5. Code Suggestions**\n- Use when: Proposing specific code changes\n- Required params: `comment_text`, `file_path`, `line_number`, `suggestion`\n- For multi-line: also add `suggestion_end_line`\n- Creates applicable suggestion blocks in Bitbucket UI\n\n**Decision Flow for AI/Automated Tools:**\n```\n1. Do you want to suggest code changes?\n   → Use suggestion with line_number\n   \n2. Do you have the exact line number?\n   → Use line_number directly\n   \n3. Do you have the code snippet but not line number?\n   → Use code_snippet (add search_context if needed)\n   \n4. Is it a general comment about the PR?\n   → Use comment_text only\n   \n5. Are you replying to another comment?\n   → Add parent_comment_id\n```\n\n**Common Pitfalls to Avoid:**\n- Don't use both `line_number` and `code_snippet` - pick one\n- Suggestions always need `file_path` and `line_number`\n- Code snippets must match exactly (including whitespace)\n- REMOVED lines reference the source file, ADDED/CONTEXT reference the destination\n\n### Merge Pull Request\n\n```typescript\n{\n  \"tool\": \"merge_pull_request\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"merge_strategy\": \"squash\",  // Optional: merge-commit, squash, fast-forward\n    \"close_source_branch\": true,  // Optional\n    \"commit_message\": \"Custom merge message\"  // Optional\n  }\n}\n```\n\n### Create Branch\n\n```typescript\n{\n  \"tool\": \"create_branch\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"branch_name\": \"feature/new-feature\",\n    \"from_ref\": \"main\"  // Optional: branch name, full ref, or commit hash. Defaults to the repository default branch.\n  }\n}\n```\n\nCreates a branch and returns:\n- Created branch details\n- The resolved source ref and commit used as the branch starting point\n- Whether the repository default branch was used automatically\n\n### List Branches\n\n```typescript\n{\n  \"tool\": \"list_branches\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"filter\": \"feature\",  // Optional: filter by name pattern\n    \"limit\": 25,  // Optional (default: 25)\n    \"start\": 0  // Optional: for pagination (default: 0)\n  }\n}\n```\n\nReturns a paginated list of branches with:\n- Branch name and ID\n- Latest commit hash\n- Default branch indicator\n- Pagination info\n\n### Delete Branch\n\n```typescript\n{\n  \"tool\": \"delete_branch\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"branch_name\": \"feature/old-feature\",\n    \"force\": false  // Optional (default: false)\n  }\n}\n```\n\n**Note**: Branch deletion requires appropriate permissions. The branch will be permanently deleted.\n\n### Get Branch\n\n```typescript\n{\n  \"tool\": \"get_branch\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"branch_name\": \"feature/new-feature\",\n    \"include_merged_prs\": false  // Optional (default: false)\n  }\n}\n```\n\nReturns comprehensive branch information including:\n- Branch details:\n  - Name and ID\n  - Latest commit (hash, message, author, date)\n  - Default branch indicator\n- Open pull requests from this branch:\n  - PR title and ID\n  - Destination branch\n  - Author and reviewers\n  - Approval status (approved by, changes requested by, pending)\n  - PR URL\n- Merged pull requests (if `include_merged_prs` is true):\n  - PR title and ID\n  - Merge date and who merged it\n- Statistics:\n  - Total open PRs count\n  - Total merged PRs count\n  - Days since last commit\n\nThis tool is particularly useful for:\n- Checking if a branch has open PRs before deletion\n- Getting an overview of branch activity\n- Understanding PR review status\n- Identifying stale branches\n\n### List Branch Commits\n\nGet all commits in a specific branch with advanced filtering options:\n\n```typescript\n// Basic usage - get recent commits\n{\n  \"tool\": \"list_branch_commits\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"branch_name\": \"feature/new-feature\",\n    \"limit\": 50  // Optional (default: 25)\n  }\n}\n\n// Filter by date range\n{\n  \"tool\": \"list_branch_commits\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"branch_name\": \"main\",\n    \"since\": \"2025-01-01T00:00:00Z\",  // ISO date string\n    \"until\": \"2025-01-15T23:59:59Z\"   // ISO date string\n  }\n}\n\n// Filter by author\n{\n  \"tool\": \"list_branch_commits\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"branch_name\": \"develop\",\n    \"author\": \"john.doe@company.com\",  // Email or username\n    \"limit\": 100\n  }\n}\n\n// Exclude merge commits\n{\n  \"tool\": \"list_branch_commits\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"branch_name\": \"release/v2.0\",\n    \"include_merge_commits\": false\n  }\n}\n\n// Search in commit messages\n{\n  \"tool\": \"list_branch_commits\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"branch_name\": \"main\",\n    \"search\": \"bugfix\",  // Search in commit messages\n    \"limit\": 50\n  }\n}\n\n// Combine multiple filters\n{\n  \"tool\": \"list_branch_commits\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"branch_name\": \"develop\",\n    \"author\": \"jane.smith@company.com\",\n    \"since\": \"2025-01-01T00:00:00Z\",\n    \"include_merge_commits\": false,\n    \"search\": \"feature\",\n    \"limit\": 100,\n    \"start\": 0  // For pagination\n  }\n}\n\n// Include CI/CD build status (Bitbucket Server only)\n{\n  \"tool\": \"list_branch_commits\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"branch_name\": \"main\",\n    \"include_build_status\": true,  // Fetch build status for each commit\n    \"limit\": 50\n  }\n}\n```\n\n**Filter Parameters:**\n- `since`: ISO date string - only show commits after this date\n- `until`: ISO date string - only show commits before this date\n- `author`: Filter by author email/username\n- `include_merge_commits`: Boolean to include/exclude merge commits (default: true)\n- `search`: Search for text in commit messages\n- `include_build_status`: Boolean to include CI/CD build status (default: false, Bitbucket Server only)\n\nReturns detailed commit information:\n```json\n{\n  \"branch_name\": \"feature/new-feature\",\n  \"branch_head\": \"abc123def456\",  // Latest commit hash\n  \"commits\": [\n    {\n      \"hash\": \"abc123def456\",\n      \"abbreviated_hash\": \"abc123d\",\n      \"message\": \"Add new feature implementation\",\n      \"author\": {\n        \"name\": \"John Doe\",\n        \"email\": \"john.doe@example.com\"\n      },\n      \"date\": \"2025-01-03T10:30:00Z\",\n      \"parents\": [\"parent1hash\", \"parent2hash\"],\n      \"is_merge_commit\": false,\n      \"build_status\": {  // Only present when include_build_status is true\n        \"successful\": 5,\n        \"failed\": 0,\n        \"in_progress\": 1,\n        \"unknown\": 0\n      }\n    }\n    // ... more commits\n  ],\n  \"total_count\": 150,\n  \"start\": 0,\n  \"limit\": 25,\n  \"has_more\": true,\n  \"next_start\": 25,\n  \"filters_applied\": {\n    \"author\": \"john.doe@example.com\",\n    \"since\": \"2025-01-01\",\n    \"include_merge_commits\": false,\n    \"include_build_status\": true\n  }\n}\n```\n\nThis tool is particularly useful for:\n- Reviewing commit history before releases\n- Finding commits by specific authors\n- Tracking changes within date ranges\n- Searching for specific features or fixes\n- Analyzing branch activity patterns\n- Monitoring CI/CD build status for commits (Bitbucket Server only)\n\n### List PR Commits\n\nGet all commits that are part of a pull request:\n\n```typescript\n// Basic usage\n{\n  \"tool\": \"list_pr_commits\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"limit\": 50,  // Optional (default: 25)\n    \"start\": 0    // Optional: for pagination\n  }\n}\n\n// Include CI/CD build status (Bitbucket Server only)\n{\n  \"tool\": \"list_pr_commits\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"include_build_status\": true,  // Fetch build status for each commit\n    \"limit\": 50\n  }\n}\n```\n\nReturns commit information for the PR:\n```json\n{\n  \"pull_request_id\": 123,\n  \"pull_request_title\": \"Add awesome feature\",\n  \"commits\": [\n    {\n      \"hash\": \"def456ghi789\",\n      \"abbreviated_hash\": \"def456g\",\n      \"message\": \"Initial implementation\",\n      \"author\": {\n        \"name\": \"Jane Smith\",\n        \"email\": \"jane.smith@example.com\"\n      },\n      \"date\": \"2025-01-02T14:20:00Z\",\n      \"parents\": [\"parent1hash\"],\n      \"is_merge_commit\": false,\n      \"build_status\": {  // Only present when include_build_status is true\n        \"successful\": 3,\n        \"failed\": 0,\n        \"in_progress\": 0,\n        \"unknown\": 0\n      }\n    }\n    // ... more commits\n  ],\n  \"total_count\": 5,\n  \"start\": 0,\n  \"limit\": 25,\n  \"has_more\": false\n}\n```\n\nThis tool is particularly useful for:\n- Reviewing all changes in a PR before merging\n- Understanding the development history of a PR\n- Checking commit messages for quality\n- Verifying authorship of changes\n- Analyzing PR complexity by commit count\n- Monitoring CI/CD build status for all PR commits (Bitbucket Server only)\n\n### Get Commit Detail\n\nGet the diff for a specific commit by SHA with structured line-by-line information. Returns files with hunks containing individual lines, each with line numbers and ADDED/REMOVED/CONTEXT type information.\n\n```typescript\n// Basic usage - get full commit diff\n{\n  \"tool\": \"get_commit_detail\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"commit_id\": \"abc123def456\",\n    \"context_lines\": 5  // Optional (default: 3)\n  }\n}\n\n// Get diff for a specific file only\n{\n  \"tool\": \"get_commit_detail\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"commit_id\": \"abc123def456\",\n    \"file_path\": \"src/index.ts\"\n  }\n}\n\n// Exclude generated/lock files\n{\n  \"tool\": \"get_commit_detail\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"commit_id\": \"abc123def456\",\n    \"exclude_patterns\": [\"*.lock\", \"*.svg\", \"node_modules/**\"]\n  }\n}\n\n// Include only specific file types\n{\n  \"tool\": \"get_commit_detail\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"commit_id\": \"abc123def456\",\n    \"include_patterns\": [\"*.ts\", \"src/**/*.js\"]\n  }\n}\n```\n\n**Structured Response Format (Bitbucket Server):**\n\n```json\n{\n  \"commit_id\": \"abc123def456\",\n  \"files\": [\n    {\n      \"file_path\": \"src/index.ts\",\n      \"old_path\": null,\n      \"status\": \"modified\",\n      \"hunks\": [\n        {\n          \"context\": \"export function foo() {\",\n          \"source_start\": 10,\n          \"source_span\": 5,\n          \"destination_start\": 10,\n          \"destination_span\": 6,\n          \"lines\": [\n            {\n              \"source_line\": 10,\n              \"destination_line\": 10,\n              \"type\": \"CONTEXT\",\n              \"content\": \"  const x = 1;\"\n            },\n            {\n              \"source_line\": 11,\n              \"destination_line\": 11,\n              \"type\": \"REMOVED\",\n              \"content\": \"  return x;\"\n            },\n            {\n              \"source_line\": 11,\n              \"destination_line\": 11,\n              \"type\": \"ADDED\",\n              \"content\": \"  return x + 1;\"\n            }\n          ]\n        }\n      ]\n    }\n  ],\n  \"summary\": {\n    \"total_files\": 3,\n    \"files_included\": 1,\n    \"files_excluded\": 2\n  },\n  \"filter_metadata\": {\n    \"filters_applied\": {\n      \"file_path\": \"src/index.ts\"\n    }\n  }\n}\n```\n\nThis tool is particularly useful for:\n- Reviewing exactly what changed in a specific commit\n- Auditing a commit before or after it lands on a branch\n- Getting structured diff data for automated analysis\n\n### Get Pull Request Diff\n\nGet the diff/changes for a pull request with structured line-by-line information. Returns files with hunks containing individual lines, each with line numbers and type information for easy inline commenting.\n\n```typescript\n// Get full diff (default behavior)\n{\n  \"tool\": \"get_pull_request_diff\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"context_lines\": 5  // Optional (default: 3)\n  }\n}\n\n// Exclude specific file types\n{\n  \"tool\": \"get_pull_request_diff\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"exclude_patterns\": [\"*.lock\", \"*.svg\", \"node_modules/**\", \"*.min.js\"]\n  }\n}\n\n// Include only specific file types\n{\n  \"tool\": \"get_pull_request_diff\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"include_patterns\": [\"*.res\", \"*.resi\", \"src/**/*.js\"]\n  }\n}\n\n// Get diff for a specific file only\n{\n  \"tool\": \"get_pull_request_diff\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"file_path\": \"src/components/Button.res\"\n  }\n}\n\n// Combine filters\n{\n  \"tool\": \"get_pull_request_diff\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"include_patterns\": [\"src/**/*\"],\n    \"exclude_patterns\": [\"*.test.js\", \"*.spec.js\"]\n  }\n}\n```\n\n**Filtering Options:**\n- `include_patterns`: Array of glob patterns to include (whitelist)\n- `exclude_patterns`: Array of glob patterns to exclude (blacklist)\n- `file_path`: Get diff for a specific file only\n- Patterns support standard glob syntax (e.g., `*.js`, `src/**/*.res`, `!test/**`)\n\n**Structured Response Format (Bitbucket Server):**\n\nThe response includes structured line-by-line information with line numbers, making it easy for AI tools to add inline comments:\n\n```json\n{\n  \"message\": \"Pull request diff retrieved successfully\",\n  \"pull_request_id\": 123,\n  \"from_hash\": \"abc123...\",\n  \"to_hash\": \"def456...\",\n  \"files\": [\n    {\n      \"file_path\": \"src/components/Button.res\",\n      \"old_path\": null,\n      \"status\": \"modified\",\n      \"hunks\": [\n        {\n          \"context\": \"let make = () => {\",\n          \"source_start\": 27,\n          \"source_span\": 6,\n          \"destination_start\": 27,\n          \"destination_span\": 7,\n          \"lines\": [\n            {\n              \"source_line\": 27,\n              \"destination_line\": 27,\n              \"type\": \"CONTEXT\",\n              \"content\": \"  let onClick = () => {\"\n            },\n            {\n              \"source_line\": 28,\n              \"destination_line\": 28,\n              \"type\": \"CONTEXT\",\n              \"content\": \"    setLoading(true)\"\n            },\n            {\n              \"source_line\": 29,\n              \"destination_line\": 29,\n              \"type\": \"REMOVED\",\n              \"content\": \"    oldFunction()\"\n            },\n            {\n              \"source_line\": 29,\n              \"destination_line\": 29,\n              \"type\": \"ADDED\",\n              \"content\": \"    newFunction()\"\n            },\n            {\n              \"source_line\": 30,\n              \"destination_line\": 30,\n              \"type\": \"CONTEXT\",\n              \"content\": \"  }\"\n            }\n          ]\n        }\n      ]\n    }\n  ],\n  \"summary\": {\n    \"total_files\": 15,\n    \"files_included\": 1,\n    \"files_excluded\": 14\n  },\n  \"filter_metadata\": {\n    \"filters_applied\": {\n      \"file_path\": \"src/components/Button.res\"\n    },\n    \"excluded_file_list\": [\"package-lock.json\", \"logo.svg\"]\n  }\n}\n```\n\n**Line Types and Usage with `add_comment`:**\n\n| Line Type | Description | Use with `add_comment` |\n|-----------|-------------|------------------------|\n| `ADDED` | New line (green in diff) | Use `destination_line` as `line_number`, `line_type: \"ADDED\"` |\n| `REMOVED` | Deleted line (red in diff) | Use `source_line` as `line_number`, `line_type: \"REMOVED\"` |\n| `CONTEXT` | Unchanged context line | Use `destination_line` as `line_number`, `line_type: \"CONTEXT\"` |\n\n**Example: Adding an inline comment on an ADDED line:**\n```typescript\n// From the diff response, we see line 29 was added with content \"    newFunction()\"\n{\n  \"tool\": \"add_comment\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"file_path\": \"src/components/Button.res\",\n    \"line_number\": 29,  // Use destination_line for ADDED\n    \"line_type\": \"ADDED\",\n    \"comment_text\": \"Consider adding error handling here\"\n  }\n}\n```\n\n**Note:** Bitbucket Cloud currently returns raw diff format. The structured format is available for Bitbucket Server only.\n\n### Approve Pull Request\n\n```typescript\n{\n  \"tool\": \"approve_pull_request\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123\n  }\n}\n```\n\n### Request Changes\n\n```typescript\n{\n  \"tool\": \"request_changes\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"comment\": \"Please address the following issues...\"  // Optional\n  }\n}\n```\n\n### List Directory Content\n\n```typescript\n{\n  \"tool\": \"list_directory_content\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"path\": \"src/components\",  // Optional (defaults to root)\n    \"branch\": \"main\"  // Optional (defaults to default branch)\n  }\n}\n```\n\nReturns directory listing with:\n- Path and branch information\n- Array of contents with:\n  - Name\n  - Type (file or directory)\n  - Size (for files)\n  - Full path\n- Total items count\n\n### Search Files\n\nSearch for files by name or path pattern in a repository. Uses glob patterns with case-insensitive matching (like VS Code's Ctrl+P file search).\n\n```typescript\n// Search for all TypeScript files\n{\n  \"tool\": \"search_files\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pattern\": \"*.ts\"\n  }\n}\n\n// Search for files containing \"Controller\" in the name\n{\n  \"tool\": \"search_files\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pattern\": \"**/Controller*\"\n  }\n}\n\n// Search within a specific directory\n{\n  \"tool\": \"search_files\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pattern\": \"*.res\",\n    \"path\": \"src/components\"\n  }\n}\n\n// Search on a specific branch with result limit\n{\n  \"tool\": \"search_files\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pattern\": \"**/*Config*\",\n    \"branch\": \"develop\",\n    \"limit\": 50\n  }\n}\n\n// Case-insensitive search (matches SomeComponent.res, Somefile.res, etc.)\n{\n  \"tool\": \"search_files\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pattern\": \"**/someFile*\"\n  }\n}\n```\n\n**Parameters:**\n- `workspace`: Project key (required)\n- `repository`: Repository slug (required)\n- `pattern`: Glob pattern to filter files (optional, returns all files if not specified)\n  - Supports standard glob syntax: `*.ts`, `**/*.java`, `**/Controller*`\n  - Case-insensitive matching\n- `path`: Subdirectory to search within (optional, defaults to root)\n- `branch`: Branch name (optional, defaults to default branch)\n- `limit`: Maximum number of matching files to return (optional, default: 100)\n\n**Response:**\n```json\n{\n  \"workspace\": \"PROJ\",\n  \"repository\": \"my-repo\",\n  \"branch\": \"master\",\n  \"search_path\": \"/\",\n  \"pattern\": \"*.res\",\n  \"files\": [\n    \"src/App.res\",\n    \"src/components/Button.res\",\n    \"src/utils/DateUtils.res\"\n  ],\n  \"total_files_scanned\": 5000,\n  \"total_matched\": 150,\n  \"returned\": 100,\n  \"truncated\": true\n}\n```\n\nThis tool is particularly useful for:\n- Finding files by name pattern (like VS Code's Ctrl+P)\n- Discovering all files of a certain type in a repository\n- Locating configuration files or specific components\n- Exploring unfamiliar codebases\n\n### Get File Content\n\n```typescript\n{\n  \"tool\": \"get_file_content\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"file_path\": \"src/index.ts\",\n    \"branch\": \"main\",  // Optional (defaults to default branch)\n    \"start_line\": 1,  // Optional: starting line (1-based, use negative for from end)\n    \"line_count\": 100,  // Optional: number of lines to return\n    \"full_content\": false  // Optional: force full content (default: false)\n  }\n}\n```\n\n**Smart Truncation Features:**\n- Automatically truncates large files (>50KB) to prevent token overload\n- Default line counts based on file type:\n  - Config files (.yml, .json): 200 lines\n  - Documentation (.md, .txt): 300 lines\n  - Code files (.ts, .js, .py): 500 lines\n  - Log files: Last 100 lines\n- Use `start_line: -50` to get last 50 lines (tail functionality)\n- Files larger than 1MB require explicit `full_content: true` or line parameters\n\nReturns file content with:\n- File path and branch\n- File size and encoding\n- Content (full or truncated based on parameters)\n- Line information (if truncated):\n  - Total lines in file\n  - Range of returned lines\n  - Truncation indicator\n- Last modified information (commit, author, date)\n\nExample responses:\n\n```json\n// Small file - returns full content\n{\n  \"file_path\": \"package.json\",\n  \"branch\": \"main\",\n  \"size\": 1234,\n  \"encoding\": \"utf-8\",\n  \"content\": \"{\\n  \\\"name\\\": \\\"my-project\\\",\\n  ...\",\n  \"last_modified\": {\n    \"commit_id\": \"abc123\",\n    \"author\": \"John Doe\",\n    \"date\": \"2025-01-21T10:00:00Z\"\n  }\n}\n\n// Large file - automatically truncated\n{\n  \"file_path\": \"src/components/LargeComponent.tsx\",\n  \"branch\": \"main\",\n  \"size\": 125000,\n  \"encoding\": \"utf-8\",\n  \"content\": \"... first 500 lines ...\",\n  \"line_info\": {\n    \"total_lines\": 3500,\n    \"returned_lines\": {\n      \"start\": 1,\n      \"end\": 500\n    },\n    \"truncated\": true,\n    \"message\": \"Showing lines 1-500 of 3500. File size: 122.1KB\"\n  }\n}\n```\n\n### Write File Content\n\nCreate or update one or more text files and commit them directly to a Bitbucket Cloud repository branch.\n\n**Bitbucket Cloud only.** This wraps the Cloud `/src` commit endpoint and writes the full file content you provide.\n\n```typescript\n{\n  \"tool\": \"write_file_content\",\n  \"arguments\": {\n    \"workspace\": \"my-workspace\",\n    \"repository\": \"my-repo\",\n    \"files\": [\n      {\n        \"file_path\": \"src/config/app.env\",\n        \"content\": \"API_URL=https://example.com\\nFEATURE_FLAG=true\\n\"\n      },\n      {\n        \"file_path\": \"src/config/feature-flags.env\",\n        \"content\": \"NEW_CHECKOUT=true\\n\"\n      }\n    ],\n    \"commit_message\": \"Update app env defaults\",\n    \"branch\": \"main\"  // Optional (defaults to repository default branch)\n  }\n}\n```\n\n**Parameters:**\n- `files`: Array of files to create or overwrite in a single commit\n- `file_path`: Repository-relative file path for legacy single-file writes\n- `content`: Full text content for legacy single-file writes\n- `commit_message`: Commit message for the generated commit\n- `branch`: Branch to commit to (optional)\n\nReturns:\n- Branch and commit metadata\n- Commit message used\n- File metadata for the written paths when available\n\nFor backward compatibility, single-file requests using `file_path` and `content` are still accepted.\n\n### Get File Blame\n\nGet per-line authorship (blame) for a file — who last modified each line, the commit hash, and author timestamp. Feed the returned `commit_id` into `get_commit_detail` to see what actually changed.\n\n**Bitbucket Server only.** Bitbucket Cloud does not expose a blame API.\n\n```typescript\n// Full-file blame\n{\n  \"tool\": \"get_file_blame\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"file_path\": \"src/index.ts\"\n  }\n}\n\n// Blame for a specific branch and line range\n{\n  \"tool\": \"get_file_blame\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"file_path\": \"src/index.ts\",\n    \"branch\": \"main\",\n    \"start_line\": 100,\n    \"line_count\": 20\n  }\n}\n\n// Ungrouped — one entry per line\n{\n  \"tool\": \"get_file_blame\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"file_path\": \"src/index.ts\",\n    \"group_by_commit\": false\n  }\n}\n```\n\n**Parameters:**\n- `file_path`: File path, e.g. `\"src/index.ts\"` (required)\n- `branch`: Branch name (optional, defaults to default branch)\n- `start_line`: Starting line (1-based) to limit output (optional)\n- `line_count`: Number of lines to return from `start_line` (optional)\n- `group_by_commit`: Group contiguous lines from the same commit into ranges (default: `true`)\n\n**Response (grouped, default):**\n```json\n{\n  \"file_path\": \"src/index.ts\",\n  \"branch\": \"main\",\n  \"total_lines\": 1982,\n  \"returned_lines\": { \"start\": 1, \"end\": 1982 },\n  \"unique_commits\": 42,\n  \"unique_authors\": 16,\n  \"grouped\": true,\n  \"blame\": [\n    {\n      \"line_start\": 1,\n      \"line_end\": 4,\n      \"commit_id\": \"fbbe61e95f51abb8aed8dd5a472074a77b3d0f46\",\n      \"commit_display_id\": \"fbbe61e95f5\",\n      \"author\": { \"name\": \"Jane Doe\", \"email\": \"jane@example.com\" },\n      \"date\": \"2025-04-15T12:01:01.000Z\",\n      \"original_file_name\": \"src/index.ts\"\n    }\n  ]\n}\n```\n\n**Response (ungrouped, `group_by_commit: false`):** each `blame` entry has a single `line` field instead of `line_start`/`line_end`.\n\nUseful for:\n- Finding the main authors of a file before requesting reviews\n- Tracing who introduced a particular line or block\n- Feeding `commit_id` into `get_commit_detail` to see the full diff of a blamed change\n- Identifying code ownership when refactoring shared modules\n\n### List Projects\n\nList all accessible Bitbucket projects (Server) or workspaces (Cloud):\n\n```typescript\n// List all accessible projects\n{\n  \"tool\": \"list_projects\",\n  \"arguments\": {\n    \"limit\": 25,  // Optional (default: 25)\n    \"start\": 0    // Optional: for pagination (default: 0)\n  }\n}\n\n// Filter by project name\n{\n  \"tool\": \"list_projects\",\n  \"arguments\": {\n    \"name\": \"backend\",  // Partial name match\n    \"limit\": 50\n  }\n}\n\n// Filter by permission level (Bitbucket Server only)\n{\n  \"tool\": \"list_projects\",\n  \"arguments\": {\n    \"permission\": \"PROJECT_WRITE\",  // PROJECT_READ, PROJECT_WRITE, PROJECT_ADMIN\n    \"limit\": 100\n  }\n}\n```\n\n**Parameters:**\n- `name`: Filter by project/workspace name (partial match, optional)\n- `permission`: Filter by permission level (Bitbucket Server only, optional)\n  - `PROJECT_READ`: Read access\n  - `PROJECT_WRITE`: Write access\n  - `PROJECT_ADMIN`: Admin access\n- `limit`: Maximum number of projects to return (default: 25)\n- `start`: Start index for pagination (default: 0)\n\nReturns project/workspace information:\n```json\n{\n  \"projects\": [\n    {\n      \"key\": \"PROJ\",\n      \"id\": 1234,\n      \"name\": \"My Project\",\n      \"description\": \"Project description\",\n      \"is_public\": false,\n      \"type\": \"NORMAL\",  // NORMAL or PERSONAL (Server), WORKSPACE (Cloud)\n      \"url\": \"https://bitbucket.yourcompany.com/projects/PROJ\"\n    }\n    // ... more projects\n  ],\n  \"total_count\": 15,\n  \"start\": 0,\n  \"limit\": 25,\n  \"has_more\": false,\n  \"next_start\": null\n}\n```\n\n**Note**:\n- For Bitbucket Cloud, this returns workspaces (not projects in the traditional sense)\n- For Bitbucket Server, this returns both personal and team projects\n\nThis tool is particularly useful for:\n- Discovering available projects/workspaces for your account\n- Finding project keys needed for other API calls\n- Identifying projects you have specific permissions on\n- Browsing organizational structure\n\n### List Repositories\n\nList repositories within a specific project/workspace or across all accessible repositories:\n\n```typescript\n// List all repositories in a workspace/project\n{\n  \"tool\": \"list_repositories\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",  // Required for Bitbucket Cloud, optional for Server\n    \"limit\": 25,          // Optional (default: 25)\n    \"start\": 0            // Optional: for pagination (default: 0)\n  }\n}\n\n// List all accessible repositories (Bitbucket Server only)\n{\n  \"tool\": \"list_repositories\",\n  \"arguments\": {\n    \"limit\": 100\n  }\n}\n\n// Filter by repository name\n{\n  \"tool\": \"list_repositories\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"name\": \"frontend\",  // Partial name match\n    \"limit\": 50\n  }\n}\n\n// Filter by permission level (Bitbucket Server only)\n{\n  \"tool\": \"list_repositories\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"permission\": \"REPO_WRITE\",  // REPO_READ, REPO_WRITE, REPO_ADMIN\n    \"limit\": 100\n  }\n}\n```\n\n**Parameters:**\n- `workspace`: Project key (Server) or workspace slug (Cloud)\n  - **Required for Bitbucket Cloud**\n  - Optional for Bitbucket Server (omit to list all accessible repos)\n- `name`: Filter by repository name (partial match, optional)\n- `permission`: Filter by permission level (Bitbucket Server only, optional)\n  - `REPO_READ`: Read access\n  - `REPO_WRITE`: Write access\n  - `REPO_ADMIN`: Admin access\n- `limit`: Maximum number of repositories to return (default: 25)\n- `start`: Start index for pagination (default: 0)\n\nReturns repository information:\n```json\n{\n  \"repositories\": [\n    {\n      \"slug\": \"my-repo\",\n      \"id\": 5678,\n      \"name\": \"My Repository\",\n      \"description\": \"Repository description\",\n      \"project_key\": \"PROJ\",\n      \"project_name\": \"My Project\",\n      \"state\": \"AVAILABLE\",  // AVAILABLE, INITIALISING, INITIALISATION_FAILED (Server)\n      \"is_public\": false,\n      \"is_forkable\": true,\n      \"clone_urls\": {\n        \"http\": \"https://bitbucket.yourcompany.com/scm/PROJ/my-repo.git\",\n        \"ssh\": \"ssh://git@bitbucket.yourcompany.com:7999/PROJ/my-repo.git\"\n      },\n      \"url\": \"https://bitbucket.yourcompany.com/projects/PROJ/repos/my-repo\"\n    }\n    // ... more repositories\n  ],\n  \"total_count\": 42,\n  \"start\": 0,\n  \"limit\": 25,\n  \"has_more\": true,\n  \"next_start\": 25,\n  \"workspace\": \"PROJ\"\n}\n```\n\n**Important Notes:**\n- **Bitbucket Cloud** requires the `workspace` parameter. If omitted, you'll receive an error message\n- **Bitbucket Server** allows listing all accessible repos by omitting the `workspace` parameter\n- Clone URLs are provided for both HTTP(S) and SSH protocols\n\nThis tool is particularly useful for:\n- Discovering available repositories in a project/workspace\n- Finding repository slugs needed for other API calls\n- Identifying repositories you have specific permissions on\n- Getting clone URLs for repositories\n- Browsing repository structure within an organization\n\n### Search Repositories\n\nSearch for repositories by name or description (Bitbucket Server only):\n\n```typescript\n// Basic search\n{\n  \"tool\": \"search_repositories\",\n  \"arguments\": {\n    \"search_query\": \"backend\",\n    \"limit\": 10\n  }\n}\n\n// Search within a specific project\n{\n  \"tool\": \"search_repositories\",\n  \"arguments\": {\n    \"search_query\": \"dashboard\",\n    \"workspace\": \"PROJ\",\n    \"limit\": 25\n  }\n}\n```\n\nReturns repository search results with project association.\n\n### Decline Pull Request\n\nDecline/reject a pull request:\n\n```typescript\n{\n  \"tool\": \"decline_pull_request\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"comment\": \"Closing this PR as the feature is no longer needed\"  // Optional\n  }\n}\n```\n\n### Delete Comment\n\nDelete a comment from a pull request:\n\n```typescript\n{\n  \"tool\": \"delete_comment\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"comment_id\": 456\n  }\n}\n```\n\n**Note**: Comments with replies cannot be deleted. Only the comment author, PR author, or repository admin can delete comments.\n\n### PR Task Management (Bitbucket Server only)\n\nTasks are checklist items that can be added to pull requests. They help track action items that need to be completed before merging.\n\n#### List PR Tasks\n\n```typescript\n{\n  \"tool\": \"list_pr_tasks\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123\n  }\n}\n```\n\nReturns all tasks with their status:\n```json\n{\n  \"pull_request_id\": 123,\n  \"tasks\": [\n    {\n      \"id\": 456,\n      \"text\": \"Update documentation\",\n      \"author\": \"John Doe\",\n      \"state\": \"OPEN\",\n      \"created_on\": \"2025-01-25T10:00:00Z\",\n      \"is_resolved\": false\n    }\n  ],\n  \"summary\": {\n    \"total\": 3,\n    \"open\": 2,\n    \"resolved\": 1\n  }\n}\n```\n\n#### Create PR Task\n\n```typescript\n{\n  \"tool\": \"create_pr_task\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"text\": \"Add unit tests for the new feature\"\n  }\n}\n```\n\n#### Update PR Task\n\n```typescript\n{\n  \"tool\": \"update_pr_task\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"task_id\": 456,\n    \"text\": \"Add unit tests and integration tests\"\n  }\n}\n```\n\n#### Mark/Unmark Task as Done\n\n```typescript\n// Mark as done\n{\n  \"tool\": \"mark_pr_task_done\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"task_id\": 456\n  }\n}\n\n// Reopen task\n{\n  \"tool\": \"unmark_pr_task_done\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"task_id\": 456\n  }\n}\n```\n\n#### Delete PR Task\n\n```typescript\n{\n  \"tool\": \"delete_pr_task\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"task_id\": 456\n  }\n}\n```\n\n#### Convert Between Comments and Tasks\n\n```typescript\n// Convert a comment to a task\n{\n  \"tool\": \"convert_comment_to_task\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"comment_id\": 456\n  }\n}\n\n// Convert a task back to a comment\n{\n  \"tool\": \"convert_task_to_comment\",\n  \"arguments\": {\n    \"workspace\": \"PROJ\",\n    \"repository\": \"my-repo\",\n    \"pull_request_id\": 123,\n    \"task_id\": 456\n  }\n}\n```\n\n**Note on Tasks:**\n- Tasks are implemented as comments with `severity: \"BLOCKER\"` in Bitbucket Server\n- Tasks can be in `OPEN` or `RESOLVED` state\n- Only the task creator, PR author, or repository admin can edit text or delete tasks\n- Anyone with read access can mark tasks as done/undone\n\n## Development\n\n- `npm run dev` - Watch mode for development\n- `npm run build` - Build the TypeScript code\n- `npm start` - Run the built server\n\n## Troubleshooting\n\n1. **Authentication errors**: Double-check your username and app password\n2. **404 errors**: Verify the workspace, repository slug, and PR ID\n3. **Permission errors**: Ensure your app password has the required permissions\n\n## License\n\nMIT\n","readmeFilename":"README.md"}