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

234 lines (233 loc) 8.81 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CreatePullRequestToolArgs = exports.CreatePullRequestCommentToolArgs = exports.ListPullRequestCommentsToolArgs = exports.GetPullRequestToolArgs = exports.ListPullRequestsToolArgs = void 0; const zod_1 = require("zod"); /** * Base pagination arguments for all tools */ const PaginationArgs = { limit: zod_1.z .number() .int() .positive() .max(100) .optional() .describe('Maximum number of items to return (1-100). Controls the response size. Defaults to 25 if omitted.'), cursor: zod_1.z .string() .optional() .describe('Pagination cursor for retrieving the next set of results. Obtained from previous response when more results are available.'), }; /** * Schema for list-pull-requests tool arguments */ exports.ListPullRequestsToolArgs = zod_1.z.object({ /** * Workspace slug containing the repository */ workspaceSlug: zod_1.z .string() .optional() .describe('Workspace slug containing the repository. If not provided, the system will use your default workspace (either configured via BITBUCKET_DEFAULT_WORKSPACE or the first workspace in your account). Example: "myteam"'), /** * Repository slug containing the pull requests */ repoSlug: zod_1.z .string() .min(1, 'Repository slug is required') .describe('Repository slug containing the pull requests. This must be a valid repository in the specified workspace. Example: "project-api"'), /** * Filter by pull request state */ state: zod_1.z .enum(['OPEN', 'MERGED', 'DECLINED', 'SUPERSEDED']) .optional() .describe('Filter pull requests by state. Options: "OPEN" (active PRs), "MERGED" (completed PRs), "DECLINED" (rejected PRs), or "SUPERSEDED" (replaced PRs). If omitted, defaults to showing all states.'), /** * Filter query for pull requests */ query: zod_1.z .string() .optional() .describe('Filter pull requests by title, description, or author (text search). Uses Bitbucket query syntax.'), /** * Maximum number of pull requests to return (default: 50) */ ...PaginationArgs, }); /** * Schema for get-pull-request tool arguments */ exports.GetPullRequestToolArgs = zod_1.z.object({ /** * Workspace slug containing the repository */ workspaceSlug: zod_1.z .string() .optional() .describe('Workspace slug containing the repository. If not provided, the system will use your default workspace. Example: "myteam"'), /** * Repository slug containing the pull request */ repoSlug: zod_1.z .string() .min(1, 'Repository slug is required') .describe('Repository slug containing the pull request. This must be a valid repository in the specified workspace. Example: "project-api"'), /** * Pull request identifier */ prId: zod_1.z .string() .min(1, 'Pull request ID is required') .describe('Numeric ID of the pull request to retrieve as a string. Must be a valid pull request ID in the specified repository. Example: "42"'), /** * Optional flag to request the full diff */ includeFullDiff: zod_1.z .boolean() .optional() .describe('Set to true to retrieve the full diff content instead of just the summary. Default: true (rich output by default)') .default(true), /** * Optional flag to include comments */ includeComments: zod_1.z .boolean() .optional() .describe('Set to true to retrieve comments for the pull request. Default: false. Note: Enabling this may increase response time for pull requests with many comments due to additional API calls.') .default(false), }); /** * Schema for list-pr-comments tool arguments */ exports.ListPullRequestCommentsToolArgs = zod_1.z.object({ /** * Workspace slug containing the repository */ workspaceSlug: zod_1.z .string() .optional() .describe('Workspace slug containing the repository. If not provided, the system will use your default workspace. Example: "myteam"'), /** * Repository slug containing the pull request */ repoSlug: zod_1.z .string() .min(1, 'Repository slug is required') .describe('Repository slug containing the pull request. This must be a valid repository in the specified workspace. Example: "project-api"'), /** * Pull request identifier */ prId: zod_1.z .string() .min(1, 'Pull request ID is required') .describe('Numeric ID of the pull request to retrieve comments from as a string. Must be a valid pull request ID in the specified repository. Example: "42"'), /** * Pagination parameters */ ...PaginationArgs, }); /** * Schema for create-pr-comment tool arguments */ exports.CreatePullRequestCommentToolArgs = zod_1.z.object({ /** * Workspace slug containing the repository */ workspaceSlug: zod_1.z .string() .optional() .describe('Workspace slug containing the repository. If not provided, the system will use your default workspace. Example: "myteam"'), /** * Repository slug containing the pull request */ repoSlug: zod_1.z .string() .min(1, 'Repository slug is required') .describe('Repository slug containing the pull request. This must be a valid repository in the specified workspace. Example: "project-api"'), /** * Pull request identifier */ prId: zod_1.z .string() .min(1, 'Pull request ID is required') .describe('Numeric ID of the pull request to add a comment to as a string. Must be a valid pull request ID in the specified repository. Example: "42"'), /** * Comment content */ content: zod_1.z .string() .min(1, 'Comment content is required') .describe('The content of the comment to add to the pull request in Markdown format. Bitbucket Cloud natively accepts Markdown - supports headings, lists, code blocks, links, and other standard Markdown syntax.'), /** * Optional inline location for the comment */ inline: zod_1.z .object({ path: zod_1.z .string() .min(1, 'File path is required for inline comments') .describe('The file path to add the comment to.'), line: zod_1.z .number() .int() .positive() .describe('The line number to add the comment to.'), }) .optional() .describe('Optional inline location for the comment. If provided, this will create a comment on a specific line in a file.'), }); /** * Arguments schema for the pull_requests_create tool */ exports.CreatePullRequestToolArgs = zod_1.z.object({ /** * Workspace slug containing the repository */ workspaceSlug: zod_1.z .string() .optional() .describe('Workspace slug containing the repository. If not provided, the system will use your default workspace. Example: "myteam"'), /** * Repository slug to create the pull request in */ repoSlug: zod_1.z .string() .min(1, 'Repository slug is required') .describe('Repository slug to create the pull request in. This must be a valid repository in the specified workspace. Example: "project-api"'), /** * Title of the pull request */ title: zod_1.z .string() .min(1, 'Pull request title is required') .describe('Title for the pull request. Example: "Add new feature"'), /** * Source branch name */ sourceBranch: zod_1.z .string() .min(1, 'Source branch name is required') .describe('Source branch name (the branch containing your changes). Example: "feature/new-login"'), /** * Destination branch name */ destinationBranch: zod_1.z .string() .optional() .describe('Destination branch name (the branch you want to merge into, defaults to main). Example: "develop"'), /** * Description for the pull request */ description: zod_1.z .string() .optional() .describe('Optional description for the pull request in Markdown format. Supports standard Markdown syntax including headings, lists, code blocks, and links.'), /** * Whether to close the source branch after merge */ closeSourceBranch: zod_1.z .boolean() .optional() .describe('Whether to close the source branch after the pull request is merged. Default: false'), });