Skip to main content
Glama
bobmaertz

Bitbucket MCP Server

by bobmaertz
branches.ts1.94 kB
import type { BitbucketClient } from '../client.js'; import type { Branch, CreateBranchParams, PaginatedResponse, ListOptions } from '../types/index.js'; /** * Branches resource API */ export class BranchesResource { constructor(private client: BitbucketClient) {} /** * List branches for a repository */ async list( workspace: string, repoSlug: string, options?: ListOptions ): Promise<PaginatedResponse<Branch>> { const params = new URLSearchParams(); if (options?.page) params.append('page', options.page.toString()); if (options?.pagelen) params.append('pagelen', options.pagelen.toString()); if (options?.q) params.append('q', options.q); if (options?.sort) params.append('sort', options.sort); const path = `/repositories/${workspace}/${repoSlug}/refs/branches${ params.toString() ? `?${params.toString()}` : '' }`; return this.client.get<PaginatedResponse<Branch>>(path); } /** * Get a specific branch */ async get(workspace: string, repoSlug: string, branchName: string): Promise<Branch> { // Branch names may contain slashes, need to encode properly const encodedBranchName = encodeURIComponent(branchName); const path = `/repositories/${workspace}/${repoSlug}/refs/branches/${encodedBranchName}`; return this.client.get<Branch>(path); } /** * Create a new branch */ async create(workspace: string, repoSlug: string, params: CreateBranchParams): Promise<Branch> { const path = `/repositories/${workspace}/${repoSlug}/refs/branches`; return this.client.post<Branch>(path, params); } /** * Delete a branch */ async delete(workspace: string, repoSlug: string, branchName: string): Promise<void> { const encodedBranchName = encodeURIComponent(branchName); const path = `/repositories/${workspace}/${repoSlug}/refs/branches/${encodedBranchName}`; await this.client.delete<void>(path); } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bobmaertz/bitbucket-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server