UNPKG

@aashari/mcp-server-atlassian-bitbucket

Version:

Node.js/TypeScript MCP server for Atlassian Bitbucket. Enables AI systems (LLMs) to interact with workspaces, repositories, and pull requests via tools (list, get, comment, search). Connects AI directly to version control workflows through the standard MC

201 lines (200 loc) 8.61 kB
import { PullRequestDetailed, PullRequestsResponse, ListPullRequestsParams, GetPullRequestParams, GetPullRequestCommentsParams, PullRequestCommentsResponse, PullRequestComment, CreatePullRequestCommentParams, CreatePullRequestParams, DiffstatResponse } from './vendor.atlassian.pullrequests.types.js'; /** * List pull requests for a repository * @param {ListPullRequestsParams} params - Parameters for the request * @param {string} params.workspace - The workspace slug or UUID * @param {string} params.repo_slug - The repository slug or UUID * @param {PullRequestState | PullRequestState[]} [params.state] - Filter by pull request state (default: 'OPEN') * @param {string} [params.q] - Query string to filter pull requests * @param {string} [params.sort] - Property to sort by (e.g., 'created_on', '-updated_on') * @param {number} [params.page] - Page number for pagination * @param {number} [params.pagelen] - Number of items per page * @returns {Promise<PullRequestsResponse>} Response containing pull requests * @example * ```typescript * // List open pull requests in a repository, sorted by creation date * const response = await list({ * workspace: 'myworkspace', * repo_slug: 'myrepo', * sort: '-created_on', * pagelen: 25 * }); * ``` */ declare function list(params: ListPullRequestsParams): Promise<PullRequestsResponse>; /** * Get detailed information about a specific Bitbucket pull request * * Retrieves comprehensive details about a single pull request. * * @async * @memberof VendorAtlassianPullRequestsService * @param {GetPullRequestParams} params - Parameters for the request * @param {string} params.workspace - The workspace slug or UUID * @param {string} params.repo_slug - The repository slug or UUID * @param {number} params.pull_request_id - The ID of the pull request * @returns {Promise<PullRequestDetailed>} Promise containing the detailed pull request information * @throws {Error} If Atlassian credentials are missing or API request fails * @example * // Get pull request details * const pullRequest = await get({ * workspace: 'my-workspace', * repo_slug: 'my-repo', * pull_request_id: 123 * }); */ declare function get(params: GetPullRequestParams): Promise<PullRequestDetailed>; /** * Get comments for a specific Bitbucket pull request * * Retrieves all comments on a specific pull request, including general comments and * inline code review comments. Supports pagination. * * @async * @memberof VendorAtlassianPullRequestsService * @param {GetPullRequestCommentsParams} params - Parameters for the request * @param {string} params.workspace - The workspace slug or UUID * @param {string} params.repo_slug - The repository slug or UUID * @param {number} params.pull_request_id - The ID of the pull request * @param {number} [params.page] - Page number for pagination * @param {number} [params.pagelen] - Number of items per page * @returns {Promise<PullRequestCommentsResponse>} Promise containing the pull request comments * @throws {Error} If Atlassian credentials are missing or API request fails * @example * // Get comments for a pull request * const comments = await getComments({ * workspace: 'my-workspace', * repo_slug: 'my-repo', * pull_request_id: 123, * pagelen: 25 * }); */ declare function getComments(params: GetPullRequestCommentsParams): Promise<PullRequestCommentsResponse>; /** * Add a comment to a specific Bitbucket pull request * * Creates a new comment on a pull request, either as a general comment or * as an inline code comment attached to a specific file and line. * * @async * @memberof VendorAtlassianPullRequestsService * @param {CreatePullRequestCommentParams} params - Parameters for the request * @param {string} params.workspace - The workspace slug or UUID * @param {string} params.repo_slug - The repository slug or UUID * @param {number} params.pull_request_id - The ID of the pull request * @param {Object} params.content - The content of the comment * @param {string} params.content.raw - The raw text of the comment * @param {Object} [params.inline] - Optional inline comment location * @param {string} params.inline.path - The file path for the inline comment * @param {number} params.inline.to - The line number in the file * @returns {Promise<PullRequestComment>} Promise containing the created comment * @throws {Error} If Atlassian credentials are missing or API request fails * @example * // Add a general comment to a pull request * const comment = await addComment({ * workspace: 'my-workspace', * repo_slug: 'my-repo', * pull_request_id: 123, * content: { raw: "This looks good to me!" } * }); * * // Add an inline code comment * const comment = await addComment({ * workspace: 'my-workspace', * repo_slug: 'my-repo', * pull_request_id: 123, * content: { raw: "Consider using a constant here instead." }, * inline: { path: "src/main.js", to: 42 } * }); */ declare function createComment(params: CreatePullRequestCommentParams): Promise<PullRequestComment>; /** * Create a new pull request * @param {CreatePullRequestParams} params - Parameters for the request * @param {string} params.workspace - The workspace slug or UUID * @param {string} params.repo_slug - The repository slug or UUID * @param {string} params.title - Title of the pull request * @param {string} params.source.branch.name - Source branch name * @param {string} params.destination.branch.name - Destination branch name (defaults to main/master) * @param {string} [params.description] - Optional description for the pull request * @param {boolean} [params.close_source_branch] - Whether to close the source branch after merge (default: false) * @returns {Promise<PullRequestDetailed>} Detailed information about the created pull request * @example * ```typescript * // Create a new pull request * const pullRequest = await create({ * workspace: 'myworkspace', * repo_slug: 'myrepo', * title: 'Add new feature', * source: { * branch: { * name: 'feature/new-feature' * } * }, * destination: { * branch: { * name: 'main' * } * }, * description: 'This PR adds a new feature...', * close_source_branch: true * }); * ``` */ declare function create(params: CreatePullRequestParams): Promise<PullRequestDetailed>; /** * Get raw diff content for a specific Bitbucket pull request * * Retrieves the raw diff content showing actual code changes in the pull request. * The diff is returned in a standard unified diff format. * * @async * @memberof VendorAtlassianPullRequestsService * @param {GetPullRequestParams} params - Parameters for the request * @param {string} params.workspace - The workspace slug or UUID * @param {string} params.repo_slug - The repository slug or UUID * @param {number} params.pull_request_id - The ID of the pull request * @returns {Promise<string>} Promise containing the raw diff content * @throws {Error} If Atlassian credentials are missing or API request fails * @example * // Get raw diff content for a pull request * const diffContent = await getRawDiff({ * workspace: 'my-workspace', * repo_slug: 'my-repo', * pull_request_id: 123 * }); */ declare function getRawDiff(params: GetPullRequestParams): Promise<string>; /** * Get the diffstat information for a pull request * * Returns summary statistics about the changes in a pull request, * including files changed, insertions, and deletions. * * @async * @memberof VendorAtlassianPullRequestsService * @param {GetPullRequestParams} params - Parameters for the request * @returns {Promise<DiffstatResponse>} Promise containing the diffstat response */ declare function getDiffstat(params: GetPullRequestParams): Promise<DiffstatResponse>; /** * Fetches the raw diff content from a specific Bitbucket API URL. * Used primarily for fetching file-specific diffs linked from inline comments. * * @async * @param {string} url - The exact Bitbucket API URL to fetch the diff from. * @returns {Promise<string>} Promise containing the raw diff content as a string. * @throws {Error} If Atlassian credentials are missing or the API request fails. */ declare function getDiffForUrl(url: string): Promise<string>; declare const _default: { list: typeof list; get: typeof get; getComments: typeof getComments; createComment: typeof createComment; create: typeof create; getRawDiff: typeof getRawDiff; getDiffstat: typeof getDiffstat; getDiffForUrl: typeof getDiffForUrl; }; export default _default;