CONNECT APP
Build with Bitbucket
Developer Tools
- OAuth
MCP
Give your agent Bitbucket tools
Every Bitbucket action is exposed as an MCP tool on Pipedream's remote server. Point a client at it with your end user's ID and Connect resolves that user's Bitbucket account for each tool call — you store no tokens.
// accessToken: mint a short-lived token with the Connect SDK — see the MCP guide
const transport = new StreamableHTTPClientTransport(
new URL("https://remote.mcp.pipedream.net/v3"),
{
requestInit: {
headers: {
Authorization: `Bearer ${accessToken}`,
"x-pd-project-id": "{project_id}",
"x-pd-environment": "production",
"x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
"x-pd-app-slug": "bitbucket",
},
},
},
)
const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)
const { tools } = await mcp.listTools()
// e.g. run Create Snippet Comment:
const result = await mcp.callTool({
name: "bitbucket-create-snippet-comment",
arguments: {
workspaceId: "Workspace",
snippetId: "Snippet",
},
})# access_token: mint a short-lived token with the Connect SDK — see the MCP guide
headers = {
"Authorization": f"Bearer {access_token}",
"x-pd-project-id": "{project_id}",
"x-pd-environment": "production",
"x-pd-external-user-id": "{external_user_id}", # any stable ID for this user in your system
"x-pd-app-slug": "bitbucket",
}
async with streamablehttp_client("https://remote.mcp.pipedream.net/v3", headers=headers) as (read, write, _):
async with ClientSession(read, write) as session:
await session.initialize()
tools = await session.list_tools()
# e.g. run Create Snippet Comment:
result = await session.call_tool("bitbucket-create-snippet-comment", {
"workspaceId": "Workspace",
"snippetId": "Snippet",
})API PROXY
Call the Bitbucket API directly
For an endpoint with no pre-built tool, the Connect proxy forwards your request to the Bitbucket API with the connected user's credentials attached. You store no tokens and write no refresh logic.
const resp = await pd.proxy.get({
externalUserId: "{external_user_id}", // any stable ID for this user in your system
accountId: "apn_xxxxxxx",
url: "https://api.bitbucket.org/2.0/user",
})
// Any allowed Bitbucket endpoint works here. Pipedream attaches the
// connected account's credentials to the outgoing request.# The path segment is the target URL, URL-safe base64 encoded:
# https://api.bitbucket.org/2.0/user
curl "https://api.pipedream.com/v1/connect/{project_id}/proxy/aHR0cHM6Ly9hcGkuYml0YnVja2V0Lm9yZy8yLjAvdXNlcg?external_user_id={external_user_id}&account_id=apn_xxxxxxx" \
-H "Authorization: Bearer {access_token}" \
-H "x-pd-environment: production"SDK
Run Bitbucket actions from your backend
Connect a user's Bitbucket account once, then run Create Snippet Comment on their behalf from your own code — TypeScript, Python, or plain HTTP.
import { PipedreamClient } from "@pipedream/sdk"
const pd = new PipedreamClient({
projectId: process.env.PIPEDREAM_PROJECT_ID!,
clientId: process.env.PIPEDREAM_CLIENT_ID!,
clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
projectEnvironment: "production",
})
const result = await pd.actions.run({
id: "bitbucket-create-snippet-comment",
externalUserId: "{external_user_id}", // any stable ID for this user in your system
configuredProps: {
bitbucket: { authProvisionId: "apn_xxxxxxx" },
workspaceId: "Workspace",
snippetId: "Snippet",
},
})from pipedream import Pipedream
pd = Pipedream(
client_id="{oauth_client_id}",
client_secret="{oauth_client_secret}",
project_id="{project_id}",
project_environment="production",
)
result = pd.actions.run(
id="bitbucket-create-snippet-comment",
external_user_id="{external_user_id}", # any stable ID for this user in your system
configured_props={
"bitbucket": {"authProvisionId": "apn_xxxxxxx"},
"workspaceId": "Workspace",
"snippetId": "Snippet",
},
)curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
-H "Content-Type: application/json" \
-H "X-PD-Environment: production" \
-H "Authorization: Bearer {access_token}" \
-d '{
"external_user_id": "{external_user_id}",
"id": "bitbucket-create-snippet-comment",
"configured_props": {
"bitbucket": { "authProvisionId": "apn_xxxxxxx" },
"workspaceId": "Workspace",
"snippetId": "Snippet"
}
}'TOOLS
Bitbucket actions
On-demand operations your product or agent can configure and run on behalf of a connected user.
-
Create Snippet Comment
actionCreates a new snippet comment. See docs hereWritev0.4.5 -
Get File From Repository
actionGets the actual file contents of a download artifact and not the artifact's metadata. See docs hereRead-onlyv0.1.5 -
Get snippet
actionGet a snippet. See docs hereRead-onlyv0.0.4 -
List Workspace Options
actionRetrieves available options for the Workspace field.Read-onlyv0.0.2
EVENTS
Bitbucket triggers
Event sources your backend can deploy for users and receive through a webhook.
-
New Commit (Instant)
triggerEmit new event when a new commit is pushed to a branch. See docs hereInstantv0.0.6 -
New Pull Request (Instant)
triggerEmit new event when a new pull request is created in a repository. See docs hereInstantv0.0.5 -
New Branch (Instant)
triggerEmit new event when a new branch is created. See docs hereInstantv0.0.5 -
New Commit Comment (Instant)
triggerEmit new event when a commit receives a comment. See docs hereInstantv0.0.5 -
New Event from any Repository
triggerEmit new event when an event occurs from any repository belonging to the user. See docs hereInstantv0.0.2 -
New Pipeline Event (Instant)
triggerEmit new event when a pipeline event occurs. See docs hereInstantv0.0.6 -
New Repository (Instant)
triggerEmit new event when a new repository is created in a workspace. See docs hereInstantv0.0.4 -
New Repository Event (Instant)
triggerEmit new event when a repository-wide event occurs. See docs hereInstantv0.0.3 -
New Review Request (Instant)
triggerEmit new event when a reviewer is added to a pull request.Instantv0.0.4 -
New Tag (Instant)
triggerEmit new event when a commit is tagged. See docs hereInstantv0.0.4 -
New Workspace Event (Instant)
triggerEmit new event when a workspace-wide event occurs. See docs hereInstantv0.0.5
MULTI-APP
Use Bitbucket with other popular apps
Most products don't stop at one integration. Pair Bitbucket with the other apps your users rely on, and ship use cases that span both.
- App slug
- bitbucket
- Authentication
- OAuth
- Categories
- Developer Tools
- Actions
- 4
- Triggers
- 11
- API proxy
- Available
OAuth scopes
These are the scopes Pipedream's managed Bitbucket OAuth client requests when one of your users connects an account. Supply your own OAuth client to request a different set.
- account
- account:write
- team:write
- repository:write
- pullrequest:write
- snippet:write
- issue:write
- wiki
- webhook