# Bitbucket — how to use (mcp.ai)

Bitbucket is a Git-based code hosting and collaboration platform supporting private and public repositories, enabling teams to manage and review code through pull requests and integrations

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_bitbucket?ms=1781542140000`
Add it as a custom/remote MCP connector in your client (Claude, Cursor, VS Code…), then authenticate when prompted. Once connected, ask the agent to use the server's tools (e.g. `bitbucket_create_branch`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/bitbucket`
Auth: `Authorization: Bearer sk_live_…` — create a workspace API key at https://mcp.ai/settings/api-keys
Discover endpoints: `GET https://api.mcp.ai/api/bitbucket/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/bitbucket/create/branch` — Creates a new branch in a bitbucket repository from a target commit hash; the branch name must be unique, adhere to bitbucket's naming conventions, and not include the 'refs/heads/' prefix.
  - body: { name: string, repo_slug: string, workspace: string, target_hash: string }
- `POST https://api.mcp.ai/api/bitbucket/create/issue` — Creates a new issue in a bitbucket repository, setting the authenticated user as reporter; ensures assignee (if provided) has repository access, and that any specified milestone, version, or component
  - body: { kind?: string, title: string, due_on?: string, content: string, assignee?: string, priority?: string, repo_slug: string, workspace: string, version_id?: integer, component_id?: integer, milestone_id?: integer }
- `POST https://api.mcp.ai/api/bitbucket/create/issue/comment` — Adds a new comment with markdown support to an existing bitbucket issue.
  - body: { content: string, issue_id: string, repo_slug: string, workspace: string }
- `POST https://api.mcp.ai/api/bitbucket/create/pull/request` — Creates a new pull request in a specified bitbucket repository, ensuring the source branch exists and is distinct from the (optional) destination branch.
  - body: { title: string, repo_slug: string, reviewers?: object[], workspace: string, description?: string, source_branch: string, destination_branch?: string, close_source_branch?: boolean }
- `POST https://api.mcp.ai/api/bitbucket/create/repository` — Creates a new bitbucket 'git' repository in a specified workspace, defaulting to the workspace's oldest project if `project key` is not provided.
  - body: { has_wiki?: boolean, language?: string, repo_slug: string, workspace: string, has_issues?: boolean, is_private?: boolean, description?: string, fork_policy?: string, project_key?: string }
- `POST https://api.mcp.ai/api/bitbucket/create/snippet/comment` — Posts a new top-level comment or a threaded reply to an existing comment on a specified bitbucket snippet.
  - body: { content: string, parent_id?: integer, workspace: string, encoded_id: string }
- `POST https://api.mcp.ai/api/bitbucket/delete/issue` — Permanently deletes a specific issue, identified by its `issue id`, from the repository specified by `repo slug` within the given `workspace`.
  - body: { issue_id: string, repo_slug: string, workspace: string }
- `POST https://api.mcp.ai/api/bitbucket/delete/repository` — Permanently deletes a specified bitbucket repository; this action is irreversible and does not affect forks.
  - body: { repo_slug: string, workspace: string }
- `POST https://api.mcp.ai/api/bitbucket/get/current/user` — Retrieves the profile information (uuid, display name, links, creation date) for the currently authenticated bitbucket user.
- `POST https://api.mcp.ai/api/bitbucket/get/file/from/repository` — Retrieves a specific file's content from a bitbucket repository at a given commit (hash, branch, or tag), failing if the file path is invalid for that commit.
  - body: { path: string, commit: string, repo_slug: string, workspace: string }
- `POST https://api.mcp.ai/api/bitbucket/get/pull/request` — Get a single pull request by id with complete details.
  - body: { repo_slug: string, workspace: string, pull_request_id: integer }
- `POST https://api.mcp.ai/api/bitbucket/get/snippet` — Retrieves a specific bitbucket snippet by its encoded id from an existing workspace, returning its metadata and file structure.
  - body: { workspace: string, encoded_id: string, accept_format?: string }
- `POST https://api.mcp.ai/api/bitbucket/list/pull/requests` — Lists pull requests in a specified, accessible bitbucket repository, optionally filtering by state (open, merged, declined).
  - body: { page?: integer, state?: string, pagelen?: integer, repo_slug: string, workspace: string }
- `POST https://api.mcp.ai/api/bitbucket/list/repositories/in/workspace` — Lists repositories in a specified bitbucket workspace, accessible to the authenticated user, with options to filter by role or query string, and sort results.
  - body: { q?: string, role?: string, sort?: string, workspace: string }
- `POST https://api.mcp.ai/api/bitbucket/list/workspace/members` — Lists all members of a specified bitbucket workspace; the workspace must exist.
  - body: { workspace: string }
- `POST https://api.mcp.ai/api/bitbucket/list/workspaces` — Lists bitbucket workspaces accessible to the authenticated user, optionally filtered and sorted.
  - body: { q?: string, sort?: string }
- `POST https://api.mcp.ai/api/bitbucket/update/issue` — Updates an existing issue in a bitbucket repository by modifying specified attributes; requires `workspace`, `repo slug`, `issue id`, and at least one attribute to update.
  - body: { kind?: string, state?: string, title?: string, content?: string, version?: string, issue_id: string, priority?: string, component?: string, milestone?: string, repo_slug: string, workspace: string, assignee_account_id?: string }

## More
- Page: https://mcp.ai/bitbucket
- Agent spec (llms.txt): https://mcp.ai/bitbucket/llms.txt
- Postman collection: https://mcp.ai/bitbucket/postman.json
