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

202 lines (201 loc) 8.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ListBranchesToolArgs = exports.GetFileContentToolArgs = exports.CloneRepositoryToolArgs = exports.CreateBranchToolArgsSchema = exports.GetCommitHistoryToolArgs = exports.GetRepositoryToolArgs = exports.ListRepositoriesToolArgs = 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-repositories tool arguments */ exports.ListRepositoriesToolArgs = zod_1.z.object({ /** * Workspace slug containing the repositories */ workspaceSlug: zod_1.z .string() .optional() .describe('Workspace slug containing the repositories. 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"'), /** * Optional query to filter repositories */ query: zod_1.z .string() .optional() .describe('Query string to filter repositories by name or other properties (text search). Example: "api" for repositories with "api" in the name/description. If omitted, returns all repositories.'), /** * Optional sort parameter */ sort: zod_1.z .string() .optional() .describe('Field to sort results by. Common values: "name", "created_on", "updated_on". Prefix with "-" for descending order. Example: "-updated_on" for most recently updated first.'), /** * Optional role filter */ role: zod_1.z .string() .optional() .describe('Filter repositories by the authenticated user\'s role. Common values: "owner", "admin", "contributor", "member". If omitted, returns repositories of all roles.'), /** * Optional project key filter */ projectKey: zod_1.z .string() .optional() .describe('Filter repositories by project key. Example: "project-api"'), /** * Maximum number of repositories to return (default: 25) */ ...PaginationArgs, }); /** * Schema for get-repository tool arguments */ exports.GetRepositoryToolArgs = 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 to retrieve */ repoSlug: zod_1.z .string() .min(1, 'Repository slug is required') .describe('Repository slug to retrieve. This must be a valid repository in the specified workspace. Example: "project-api"'), }); /** * Schema for get-commit-history tool arguments. */ exports.GetCommitHistoryToolArgs = zod_1.z.object({ workspaceSlug: zod_1.z .string() .optional() .describe('Workspace slug containing the repository. If not provided, the system will use your default workspace. Example: "myteam"'), repoSlug: zod_1.z .string() .min(1, 'Repository slug is required') .describe('Repository slug whose commit history is to be retrieved. Example: "project-api"'), revision: zod_1.z .string() .optional() .describe('Optional branch name, tag, or commit hash to view history from. If omitted, uses the default branch.'), path: zod_1.z .string() .optional() .describe('Optional file path to filter commit history. Only shows commits affecting this file.'), ...PaginationArgs, // Includes limit and cursor }); /** * Schema for create-branch tool arguments. */ exports.CreateBranchToolArgsSchema = zod_1.z.object({ 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"'), repoSlug: zod_1.z .string() .min(1, 'Repository slug is required') .describe('Repository slug where the branch will be created.'), newBranchName: zod_1.z .string() .min(1, 'New branch name is required') .describe('The name for the new branch.'), sourceBranchOrCommit: zod_1.z .string() .min(1, 'Source branch or commit is required') .describe('The name of the branch or the commit hash to branch from.'), }); /** * Schema for clone-repository tool arguments. */ exports.CloneRepositoryToolArgs = zod_1.z.object({ workspaceSlug: zod_1.z .string() .optional() .describe('Bitbucket workspace slug containing the repository. If not provided, the tool will use your default workspace (either configured via BITBUCKET_DEFAULT_WORKSPACE or the first workspace in your account). Example: "myteam"'), repoSlug: zod_1.z .string() .min(1, 'Repository slug is required') .describe('Repository name/slug to clone. This is the short name of the repository. Example: "project-api"'), targetPath: zod_1.z .string() .min(1, 'Target path is required') .describe('Directory path where the repository will be cloned. IMPORTANT: Absolute paths are strongly recommended (e.g., "/home/user/projects" or "C:\\Users\\name\\projects"). Relative paths will be resolved relative to the server\'s working directory, which may not be what you expect. The repository will be cloned into a subdirectory at targetPath/repoSlug. Make sure you have write permissions to this location.'), }); /** * Schema for get-file-content tool arguments. */ exports.GetFileContentToolArgs = zod_1.z.object({ workspaceSlug: zod_1.z .string() .optional() .describe('Workspace slug containing the repository. If not provided, the system will use your default workspace. Example: "myteam"'), repoSlug: zod_1.z .string() .min(1, 'Repository slug is required') .describe('Repository slug containing the file. Example: "project-api"'), filePath: zod_1.z .string() .min(1, 'File path is required') .describe('Path to the file within the repository. Example: "README.md" or "src/main.js"'), revision: zod_1.z .string() .optional() .describe('Optional branch name, tag, or commit hash to retrieve the file from. If omitted, uses the default branch.'), }); /** * Schema for list-branches tool arguments */ exports.ListBranchesToolArgs = 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 list branches from */ repoSlug: zod_1.z .string() .min(1, 'Repository slug is required') .describe('Repository slug to list branches from. Must be a valid repository slug in the specified workspace. Example: "project-api"'), /** * Optional query to filter branches */ query: zod_1.z .string() .optional() .describe('Query string to filter branches by name or other properties (text search).'), /** * Optional sort parameter */ sort: zod_1.z .string() .optional() .describe('Field to sort branches by. Common values: "name" (default), "-name", "target.date". Prefix with "-" for descending order.'), /** * Maximum number of branches to return (default: 25) */ ...PaginationArgs, });