@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
218 lines (217 loc) • 7.97 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreatePullRequestToolArgs = exports.AddPullRequestCommentToolArgs = 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()
.min(1, 'Workspace slug is required')
.describe('Workspace slug containing the repository. Must be a valid workspace slug from your Bitbucket 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()
.min(1, 'Workspace slug is required')
.describe('Workspace slug containing the repository. Must be a valid workspace slug from your Bitbucket account. 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"'),
});
/**
* Schema for list-pr-comments tool arguments
*/
exports.ListPullRequestCommentsToolArgs = zod_1.z.object({
/**
* Workspace slug containing the repository
*/
workspaceSlug: zod_1.z
.string()
.min(1, 'Workspace slug is required')
.describe('Workspace slug containing the repository. Must be a valid workspace slug from your Bitbucket account. 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 add-pr-comment tool arguments
*/
exports.AddPullRequestCommentToolArgs = zod_1.z.object({
/**
* Workspace slug containing the repository
*/
workspaceSlug: zod_1.z
.string()
.min(1, 'Workspace slug is required')
.describe('Workspace slug containing the repository. Must be a valid workspace slug from your Bitbucket account. 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. Can include markdown formatting.'),
/**
* 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()
.min(1, 'Workspace slug is required')
.describe('Workspace slug containing the repository. Must be a valid workspace slug from your Bitbucket account. 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.'),
/**
* 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'),
});