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
- Sign in to AI Gateway and select MCP Servers from the left navigation.
- Select New MCP Server.
- Search for the application you want to connect, then select it from the catalog.
Configure the server
- Enter a Name for your server — something descriptive that identifies both the application and its purpose.
- Enter a Description so your team knows what the server is for.
- Set the Timeout value. 30 seconds works for most APIs; increase to 60 seconds for APIs that return large payloads.
- Toggle Production mode on if this server will be used in a live workflow.
- 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
- Set any Rate limits appropriate for your use case and the API's own limits.
- Enable Logging if you want AI Gateway to record requests and responses for auditing.
- 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.
| Value | Setting |
|---|---|
| Auth endpoint | https://bitbucket.org/site/oauth2/authorize |
| Token endpoint | https://bitbucket.org/site/oauth2/access_token |
| Base URL | https://api.bitbucket.org/2.0 |
| Scopes | repository, 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.
| Tool | Description |
|---|---|
| List repositories | Retrieve repositories in a workspace or public repositories |
| Get repository | Retrieve repository details and configuration |
| Create repository | Create a new repository in a workspace |
| Update repository | Modify repository settings and metadata |
| Delete repository | Remove a repository |
| Fork repository | Fork a repository into another workspace |
| List branches | Retrieve open branches in a repository |
| Create branch | Create a new branch from an existing commit |
| Get branch | Retrieve branch details |
| Delete branch | Delete a branch |
| List tags | Retrieve tags in a repository |
| Create tag | Create a git tag for a version |
| List pull requests | Retrieve pull requests with filtering options |
| Create pull request | Create a pull request between branches |
| Get pull request | Retrieve pull request details and status |
| Update pull request | Modify PR title, description, or reviewers |
| Approve pull request | Approve a pull request |
| Merge pull request | Merge an approved pull request |
| Decline pull request | Decline a pull request without merging |
| Comment on pull request | Add or update comments on a pull request |
| List pipelines | Retrieve recent pipeline runs for a repository |
| Run pipeline | Trigger a Bitbucket Pipelines run |
| Get pipeline | Retrieve pipeline execution status |
| Stop pipeline | Stop a running pipeline |
| Get pipeline steps | Retrieve steps and logs for a pipeline |
| List issues | Retrieve issues with filtering options |
| Create issue | Create a new issue with title and description |
| Get issue | Retrieve issue details and comments |
| Update issue | Modify issue status, assignee, or fields |
| Comment on issue | Add a comment to an issue |
| List commits | Retrieve commits for a repository or revision |
| Get commit | Retrieve commit details and comments |
| Compare commits | Diff two commits or get a patch |
| Get file contents | Retrieve file or directory contents from source |
| Create commit | Create a commit by uploading file changes |
| List workspaces | Retrieve workspaces for the current user |
| Get workspace | Retrieve workspace details |
| List projects | Retrieve projects in a workspace |
| Create webhook | Create a repository or workspace webhook |
| List snippets | Retrieve code snippets in a workspace |
| Search code | Search 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.
Cequence AI Gateway