MetorialDocs

Set up Bitbucket in Metorial for Claude, ChatGPT and Cursor

Share Bitbucket with your team in Claude, ChatGPT and Cursor through Metorial: OAuth or API token sign-in, 24 tools (9 read-only).

To give your team Bitbucket in Claude, ChatGPT, Cursor and other AI clients, an admin shares the Bitbucket integration in a Metorial portal, and each person signs in to Bitbucket with their own account. Agents can manage Git repositories, pull requests, and CI/CD pipelines on Bitbucket Cloud. The integration has 24 tools, 9 read-only, 14 write and 1 destructive, plus 3 triggers.

What you'll learn

  • How an admin shares Bitbucket in a portal and how each person connects
  • What Bitbucket asks for when you connect, and where to find it
  • How to keep the 9 read-only tools and reject the other 15

Before you start

Sign-in methods

MethodTypeWhat a person provides
API TokenAPI tokenemail and token
OAuth (default)OAuthSigns in to Bitbucket

The portal and metorial setup use OAuth unless someone picks another method.

API Token

To connect, a person enters these values:

  • email: Basic-auth username: your **Atlassian account email** (Bitbucket → Personal settings → Email aliases) when using an **API token**; your **Bitbucket username** (same settings page) when using an **app password** (deprecated until June 2026).
  • token: Basic-auth password: a **Bitbucket** API token from id.atlassian.com → Security → Create API token **with scopes** → app **Bitbucket** (e.g. grant **Repositories: Write** to create repos), or an app password with matching Bitbucket scopes.

OAuth

People sign in to Bitbucket and approve the permissions it lists.

Setup settings

Whichever method you pick, setup also asks for:

  • workspace: Bitbucket workspace slug. All API operations will be scoped to this workspace.

Use your own Bitbucket OAuth app

With your own OAuth app, people see your company's name on the Bitbucket consent screen, and the client ID and secret belong to you.

Start the credentials in Metorial

In the dashboard, select Settings, then Organization Settings. Under Integrations and MCP, select Provider Auth, then Create Auth Credentials. Choose Bitbucket and copy the Redirect URI.

Register the app with Bitbucket

Bitbucket calls the app an OAuth consumer, and it belongs to a workspace. Open the workspace, select the Settings cog, then Workspace settings, and under Apps and features select OAuth consumers. Click Add consumer, enter a Name, paste the redirect URI from Metorial as the Callback URL, select the permissions, and click Save. Click the consumer's name to see its key and secret: the key is the client ID.

Bitbucket sets scopes on the consumer, not per sign-in. Select the same permissions in Metorial's Scopes picker, because Bitbucket rejects a request for any scope the consumer lacks.

Finish in Metorial

Copy the app's client ID and client secret. Back in Metorial, enter a Name, the Client ID and the Client Secret, review Scopes, and select Create. Then pick these credentials for the Bitbucket integration.

Admin: share Bitbucket in a portal

In the dashboard

Open Shared Resources

Open Workforce, choose the portal, and select Shared Resources under Access.

Share a new integration

Select Share a Resource, then New Integration, and choose Bitbucket. Under Auth Method, keep OAuth or pick another. For how members connect, choose Each person connects, so everyone signs in to Bitbucket as themselves.

Limit the tools

Under Tool Filters, set the write and destructive groups to Reject if agents should only read from Bitbucket.

Choose who gets it

Add the access groups that should see Bitbucket. When a person asks for access from the portal, the request appears under Access Requests.

With the CLI

The CLI cannot create the per-user Bitbucket integration. Once it exists, check which groups have it:

metorial-admin portals access list <portal-id> --type provider_template --search bitbucket

Employee: connect Bitbucket

In the portal

Open Bitbucket in the catalog

Sign in to your portal and open Bitbucket. The status reads Available.

Authenticate

Under Quick setup, select Authenticate. A Bitbucket sign-in tab opens. Sign in and approve the permissions listed.

Confirm

The status changes to Configured. If it later reads Needs reconnect, select Reconnect and sign in again.

With the CLI

metorial catalog search bitbucket
metorial setup <catalog-item-id>

catalog search prints the catalog item ID. metorial setup uses OAuth. To connect with API Token instead, find its ID with metorial catalog get <catalog-item-id> and add --auth-method <auth-method-id>.

Add it to your AI client

metorial install adds your Bitbucket connection to a local MCP client such as Claude Code, Cursor or Codex. metorial list prints the integration ID and metorial client list the client identifiers.

metorial list bitbucket
metorial client list
metorial install <client-identifier> <integration-id>

For a client that takes a server URL, such as ChatGPT, metorial install custom <integration-id> creates an installation token and shows the endpoint details.

Make it read-only

Open the integration's Tool Filters and set the write and destructive groups to Reject. Agents keep the 9 read-only tools, such as search_code and list_commits, and lose the 14 write tools, such as manage_tags or fork_repository, and the destructive tool delete_repository.

Employees see the result on the integration's page in the portal under Tool access. For the full walkthrough, see Tool permissions.

Check it worked

metorial list bitbucket
metorial tools <integration-id>
metorial call <integration-id> list_repositories -d '{}'

metorial tools lists the 24 tools, minus any you rejected. list_repositories takes no input. It lists repositories in the configured workspace.

To see every input a tool takes, run metorial schema <integration-id> <tool-key>.

Tools

Read-only tools (9)

  • browse_source: Browse repository source files at a specific revision (branch, tag, or commit hash). Needs repoSlug and revision.
  • get_pull_request: Retrieve detailed information about a specific pull request including its description, reviewers, merge details, and comments summary. Needs repoSlug and pullRequestId.
  • list_workspace_members: List all members in the configured workspace.
  • list_pull_requests: List pull requests for a repository. Needs repoSlug.
  • search_code: Search for code across repositories in the workspace, optionally scoped to one repository. Needs searchQuery.
  • list_commits: List commits in a repository, optionally filtered by branch. Needs repoSlug.
  • get_repository: Retrieve detailed information about a specific repository including its settings, main branch, project, and links. Needs repoSlug.
  • list_repositories: List repositories in the configured workspace.
  • list_pull_request_comments: Retrieve comments on a pull request, including threaded replies and inline code comment metadata. Needs repoSlug and pullRequestId.

Write tools (14)

  • fork_repository: Fork an existing repository. Needs repoSlug.
  • manage_branches: List, create, or delete branches in a repository. Needs repoSlug and action.
  • manage_pull_request: Perform actions on a pull request: **approve**, **unapprove**, **merge**, **decline**, **request_changes**, or **remove_change_request**. Needs repoSlug, pullRequestId and action.
  • update_repository: Update repository settings (wiki, fork policy, project, privacy, language, name, description). Needs repoSlug.
  • manage_projects: List, create, update, or delete projects in the workspace. Needs action.
  • manage_pipelines: List, get, trigger, or stop Bitbucket Pipelines. - **list**: View recent pipelines and their statuses. - **get**: Get details of a specific pipeline including steps. - **trigger**: Start a new pipeline on a branch, tag, or custom pattern. - **stop**: Stop a running pipeline. Needs repoSlug and action.
  • create_pull_request: Create a new pull request to merge changes from a source branch into a destination branch. Needs repoSlug, title, sourceBranch and destinationBranch.
  • create_repository: Create a new Git repository in the configured workspace. **Only repoSlug is required.** Display **name** defaults to the slug; **isPrivate** defaults to **true** and is always sent so the create payload matches Bitbucket's expectations. Needs repoSlug.
  • create_commit_status: Create or update a build status on a specific commit. Needs repoSlug, commitHash, state and key.
  • manage_tags: List, create, or delete tags in a repository. Needs repoSlug and action.
  • comment_on_pull_request: Add a comment to a pull request. Needs repoSlug, pullRequestId and content.
  • manage_branch_restrictions: List, get, create, update, or delete branch restriction rules. Needs repoSlug and action.
  • manage_default_reviewers: List, get, add, or remove repository default reviewers. Needs repoSlug and action.
  • manage_webhooks: List, create, get, update, or delete repository webhooks. Needs repoSlug and action.

Destructive tools (1)

  • delete_repository: Permanently delete a repository from the workspace. Needs repoSlug.

Triggers

Bitbucket has 3 triggers, which fire on events in Bitbucket:

  • repository_events: Triggers on repository-level events including pushes, forks, metadata updates, transfers, commit comments, build statuses, and deletions.
  • pull_request_events: Triggers on pull request activity including creation, updates, approvals, merges, declines, change requests, and comments.
  • issue_events: Triggers on issue tracker events including issue creation, updates, and new comments.

Next steps