Skip to main content

Bitbucket MCP server

Bitbucket Cloud is Atlassian's Git-based source code collaboration platform for repositories, pull requests, pipelines, and issue tracking. An AI agent with access to Bitbucket can manage repositories, review and merge pull requests, run pipelines, track issues, and coordinate development workflows without manual Bitbucket UI operations.

Setting up an MCP server

This article covers the standard steps for creating an MCP server in AI Gateway and connecting it to an AI client. The steps are the same for every integration — application-specific details (API credentials, OAuth endpoints, and scopes) are covered in the individual application pages.

Before you begin

You'll need:

  • Access to AI Gateway with permission to create MCP servers
  • API credentials for the application you're connecting (see the relevant application page for what to collect)

Create an MCP server

Find the API in the catalog

  1. Sign in to AI Gateway and select MCP Servers from the left navigation.
  2. Select New MCP Server.
  3. Search for the application you want to connect, then select it from the catalog.

Configure the server

  1. Enter a Name for your server — something descriptive that identifies both the application and its purpose.
  2. Enter a Description so your team knows what the server is for.
  3. Set the Timeout value. 30 seconds works for most APIs; increase to 60 seconds for APIs that return large payloads.
  4. Toggle Production mode on if this server will be used in a live workflow.
  5. Select Next.

Configure authentication

Enter the authentication details for the application. This varies by service — see the Authentication section of the relevant application page for the specific credentials, OAuth URLs, and scopes to use.

Configure security

  1. Set any Rate limits appropriate for your use case and the API's own limits.
  2. Enable Logging if you want AI Gateway to record requests and responses for auditing.
  3. Select Next.

Deploy

Review the summary, then select Deploy. AI Gateway provisions the server and provides a server URL you'll use when configuring your AI client.


Connect to an AI client

Once your server is deployed, you'll need to add it to the AI client your team uses. Select your client for setup instructions:

Tips

  • You can create multiple MCP servers for the same application — for example, a read-only server for reporting agents and a read-write server for automation workflows.
  • If you're unsure which OAuth scopes to request, start with the minimum read-only set and add write scopes only when needed. Most application pages include scope recommendations.
  • You can edit a server's name, description, timeout, and security settings after deployment without redeploying.

Authentication

Bitbucket uses OAuth 2.0 authentication. Create an OAuth consumer in your Bitbucket workspace under Settings > OAuth consumers, and configure the callback URL for your AI Gateway. Prefer OAuth or API tokens — Bitbucket app passwords are deprecated.

ValueSetting
Auth endpointhttps://bitbucket.org/site/oauth2/authorize
Token endpointhttps://bitbucket.org/site/oauth2/access_token
Base URLhttps://api.bitbucket.org/2.0
Scopesrepository, repository:write, repository:admin, pullrequest, pullrequest:write, pipeline, pipeline:write, pipeline:variable, issue, issue:write, project, account, webhook, snippet, snippet:write

Available tools

This MCP server enables repository management, pull request workflows, Bitbucket Pipelines, issue tracking, workspace and project operations, and source browsing for Bitbucket Cloud.

ToolDescription
List repositoriesRetrieve repositories in a workspace or public repositories
Get repositoryRetrieve repository details and configuration
Create repositoryCreate a new repository in a workspace
Update repositoryModify repository settings and metadata
Delete repositoryRemove a repository
Fork repositoryFork a repository into another workspace
List branchesRetrieve open branches in a repository
Create branchCreate a new branch from an existing commit
Get branchRetrieve branch details
Delete branchDelete a branch
List tagsRetrieve tags in a repository
Create tagCreate a git tag for a version
List pull requestsRetrieve pull requests with filtering options
Create pull requestCreate a pull request between branches
Get pull requestRetrieve pull request details and status
Update pull requestModify PR title, description, or reviewers
Approve pull requestApprove a pull request
Merge pull requestMerge an approved pull request
Decline pull requestDecline a pull request without merging
Comment on pull requestAdd or update comments on a pull request
List pipelinesRetrieve recent pipeline runs for a repository
Run pipelineTrigger a Bitbucket Pipelines run
Get pipelineRetrieve pipeline execution status
Stop pipelineStop a running pipeline
Get pipeline stepsRetrieve steps and logs for a pipeline
List issuesRetrieve issues with filtering options
Create issueCreate a new issue with title and description
Get issueRetrieve issue details and comments
Update issueModify issue status, assignee, or fields
Comment on issueAdd a comment to an issue
List commitsRetrieve commits for a repository or revision
Get commitRetrieve commit details and comments
Compare commitsDiff two commits or get a patch
Get file contentsRetrieve file or directory contents from source
Create commitCreate a commit by uploading file changes
List workspacesRetrieve workspaces for the current user
Get workspaceRetrieve workspace details
List projectsRetrieve projects in a workspace
Create webhookCreate a repository or workspace webhook
List snippetsRetrieve code snippets in a workspace
Search codeSearch for code across team or workspace repositories

Tips

Only request the OAuth scopes your integration actually needs — excessive scopes are a security risk if your token is compromised.

Use workspace and repository slugs or UUIDs consistently — Bitbucket accepts either form in most path parameters; UUIDs are stable when slugs change.

Follow pagination links — list endpoints return a next URL and honor pagelen; do not assume a single response contains all results.

Prefer API tokens or OAuth over app passwords — app passwords are deprecated; API tokens use Basic auth with your Atlassian email as the username.

Commit bitbucket-pipelines.yml before triggering pipelines via the API, or the run will fail to find a pipeline definition.

Check merge and approval state before merging — branch restrictions and required approvals can cause merge requests to fail even when the PR looks ready.