
List repository branches
Get branch details by name
Create a new branch
Delete a branch
Get repository default branch
List repository commits with filters
Get commit details by hash
Get commit diff
Approve a commit
Remove commit approval
List commit build statuses
List commit comments
List repository pipelines
Get pipeline details by UUID
Trigger a new pipeline run
Stop a running pipeline
List pipeline steps
Get pipeline step details
Get pipeline step logs
List pipeline variables
List pull requests with filtering options
Get pull request details by ID
Create a new pull request
Update pull request details
Merge a pull request
Decline a pull request
Approve a pull request
Remove approval from a pull request
List pull request comments
Add a comment to a pull request
List pull request commits
Get pull request diff
List pull request build statuses
Get pull request activity log
Request changes on a pull request
List repositories in a workspace with pagination
Get repository details by slug
Create a new repository in a workspace
Update repository settings
Delete repository permanently
List repository forks
Fork a repository
List repository watchers
Get authenticated user profile
List user email addresses
List accessible workspaces
Get workspace details
List workspace members
Validate Bitbucket credentials. Verifies credentials during setup.
List repository webhooks
Get webhook details by UUID
Create a repository webhook
Update webhook configuration
Delete webhook permanently

In an mcp.json file, add the configuration below, and restart Cursor.
Learn more in the official documentation ↗
1{
2 "mcpServers": {
3 "agent-handler": {
4 "url": "https://ah-api-develop.merge.dev/api/v1/tool-packs/{TOOL_PACK_ID}/registered-users/{REGISTERED_USER_ID}/mcp",
5 "headers": {
6 "Authorization": "Bearer yMt*****"
7 }
8 }
9 }
10}
11Open your Claude Desktop configuration file and add the server configuration below. You'll also need to restart the application for the changes to take effect.
Make sure Claude is using the Node v20+.
Learn more in the official documentation ↗
1{
2 "mcpServers": {
3 "agent-handler": {
4 "command": "npx",
5 "args": [
6 "-y",
7 "mcp-remote@latest",
8 "https://ah-api-develop.merge.dev/api/v1/tool-packs/{TOOL_PACK_ID}/registered-users/{REGISTERED_USER_ID}/mcp",
9 "--header",
10 "Authorization: Bearer ${AUTH_TOKEN}"
11 ],
12 "env": {
13 "AUTH_TOKEN": "yMt*****"
14 }
15 }
16 }
17}Open your Windsurf MCP configuration file and add the server configuration below.
Click on the refresh button in the top right of the Manage MCP server page or in the top right of the chat box in the box icon.
Learn more in the official documentation ↗
1{
2 "mcpServers": {
3 "agent-handler": {
4 "command": "npx",
5 "args": [
6 "-y",
7 "mcp-remote@latest",
8 "https://ah-api.merge.dev/api/v1/tool-packs/<tool-pack-id>/registered-users/<registered-user-id>/mcp",
9 "--header",
10 "Authorization: Bearer ${AUTH_TOKEN}"
11 ],
12 "env": {
13 "AUTH_TOKEN": "<ah-production-access-key>"
14 }
15 }
16 }
17 }In Command Palette (Cmd+Shift+P on macOS, Ctrl+Shift+P on Windows), run "MCP: Open User Configuration".
You can then add the configuration below and press "start" right under servers. Enter the auth token when prompted.
Learn more in the official documentation ↗
1{
2 "inputs": [
3 {
4 "type": "promptString",
5 "id": "agent-handler-auth",
6 "description": "Agent Handler AUTH_TOKEN", // "yMt*****" when prompt
7 "password": true
8 }
9 ],
10 "servers": {
11 "agent-handler": {
12 "type": "stdio",
13 "command": "npx",
14 "args": [
15 "-y",
16 "mcp-remote@latest",
17 "https://ah-api-develop.merge.dev/api/v1/tool-packs/{TOOL_PACK_ID}/registered-users/{REGISTERED_USER_ID}/mcp",
18 "--header",
19 "Authorization: Bearer ${input:agent-handler-auth}"
20 ]
21 }
22 }
23}It's an MCP server that lets your agents interact with Bitbucket via tools. Your agents can invoke these tools to create and manage repositories, open and merge pull requests, trigger and monitor pipelines, manage branches, and more.
Bitbucket offers an official MCP server, but you can also use one from a third-party platform, like Merge Agent Handler.
The use cases naturally depend on the agent you've built, but here are a few common ones:
create_pullrequest</code> to open a corresponding PR in the linked Bitbucket repository, pre-populated with the ticket title, branch name, and descriptionget_pipeline_step_log</code> to retrieve the error output, posts a structured alert to the team's Slack channel with the relevant log lines, and calls <code class="blog_inline-code">trigger_pipeline</code> to retry if the failure matches a known transient patternlist_branches</code> to identify branches without recent commits, cross-references open pull requests to avoid flagging active work, and posts a stale branch report for the team to review and clean upcreate_branch</code> to cut a release branch from main, calls <code class="blog_inline-code">trigger_pipeline</code> to kick off the build, and posts a pipeline status update to the team channel once the run completesHere are some of the most commonly used tools:
<code class="blog_inline-code">list_pullrequests</code> retrieves all pull requests in a repository, filterable by state such as open, merged, or declined. Good for agents that need to audit review status or generate a summary of pending work before taking an action<code class="blog_inline-code">create_pullrequest</code> opens a new pull request from a source branch to a target branch with a specified title and description. Use this when an agent needs to initiate code review in response to an event in another system, like a completed ticket or a passing test suite<code class="blog_inline-code">merge_pullrequest</code> merges an approved pull request into the target branch. Call this when an agent is automating a release or promotion workflow and needs to advance code after all review conditions are met<code class="blog_inline-code">trigger_pipeline</code> kicks off a Bitbucket pipeline for a specified branch or commit. Useful for agents that need to run a build or deployment in response to an external trigger, like a scheduled release or a merge event in a dependent repository<code class="blog_inline-code">get_pipeline_step_log</code> retrieves the log output for a specific step in a pipeline run. Call this when an agent needs to diagnose a failure, extract build artifacts, or surface error details for a downstream alert<code class="blog_inline-code">create_branch</code> creates a new branch in a repository from a specified source commit or branch. Helpful when an agent needs to automate branch provisioning as part of a release, feature, or hotfix workflowSeveral things set Merge Agent Handler's Bitbucket MCP server apart from building your own or using a standalone alternative:
You can take the following steps:
1. Create or log into your Merge Agent Handler account and navigate to Tool Packs (collections of connector tools scoped to a specific use case).
2. Create a new Tool Pack, then find and enable the Bitbucket connector. Choose which tools to include: enable read tools like <code class="blog_inline-code">list_pullrequests</code> and <code class="blog_inline-code">list_pipelines</code> for monitoring use cases, or add write tools like <code class="blog_inline-code">create_pullrequest</code> and <code class="blog_inline-code">trigger_pipeline</code> if your agent needs to open PRs or run builds.
3. Add a Registered User inside the Tool Pack. This is the identity context under which your agent operates. Merge generates a unique MCP URL scoped to this user once it's created.
4. From the Registered User detail page, authenticate Bitbucket by completing the OAuth flow. Merge stores and manages the credentials going forward.
5. Copy the MCP URL from the Tool Pack detail page and generate an API key from Settings. You'll need both to connect your agent.
6. Add the MCP server to your agent or IDE using the MCP URL and API key. Your Bitbucket tools are now accessible through that endpoint.
Whether you're an engineer experimenting with agents or a product manager looking to add tools, you can get started for free now