diff --git a/src/index.ts b/src/index.ts index 03678b2..6e16186 100644 --- a/src/index.ts +++ b/src/index.ts @@ -262,6 +262,269 @@ class BitbucketMCPServer { required: ['workspace', 'repository', 'pullRequestId'], }, }, + // ── Repository / workspace ──────────────────────────────────────── + { + name: 'list_workspaces', + description: 'List all Bitbucket workspaces the authenticated user belongs to', + inputSchema: { + type: 'object', + properties: { + page: { type: 'integer', description: 'Page number (1-based)' }, + pagelen: { type: 'integer', description: 'Results per page (default 10, max 100)' }, + }, + }, + }, + { + name: 'list_repositories', + description: 'List repositories in a Bitbucket workspace', + inputSchema: { + type: 'object', + properties: { + workspace: { type: 'string' }, + role: { type: 'string', enum: ['member', 'contributor', 'owner'] }, + page: { type: 'integer' }, + pagelen: { type: 'integer' }, + }, + required: ['workspace'], + }, + }, + { + name: 'get_repository', + description: 'Get metadata for a specific Bitbucket repository', + inputSchema: { + type: 'object', + properties: { + workspace: { type: 'string' }, + repository: { type: 'string' }, + }, + required: ['workspace', 'repository'], + }, + }, + { + name: 'list_branches', + description: 'List branches in a Bitbucket repository', + inputSchema: { + type: 'object', + properties: { + workspace: { type: 'string' }, + repository: { type: 'string' }, + filter_by_name: { type: 'string', description: 'Filter branches whose name contains this string' }, + page: { type: 'integer' }, + pagelen: { type: 'integer' }, + }, + required: ['workspace', 'repository'], + }, + }, + // ── PR write ────────────────────────────────────────────────────── + { + name: 'create_pull_request', + description: 'Create a new pull request in a Bitbucket repository', + inputSchema: { + type: 'object', + properties: { + workspace: { type: 'string' }, + repository: { type: 'string' }, + title: { type: 'string' }, + source_branch: { type: 'string' }, + destination_branch: { type: 'string' }, + description: { type: 'string' }, + reviewers: { type: 'array', items: { type: 'string' }, description: 'Reviewer account UUIDs' }, + close_source_branch: { type: 'boolean' }, + }, + required: ['workspace', 'repository', 'title', 'source_branch', 'destination_branch'], + }, + }, + { + name: 'update_pull_request', + description: 'Update the title, description, reviewers, or destination branch of a pull request', + inputSchema: { + type: 'object', + properties: { + workspace: { type: 'string' }, + repository: { type: 'string' }, + pullRequestId: { type: 'integer' }, + title: { type: 'string' }, + description: { type: 'string' }, + reviewers: { type: 'array', items: { type: 'string' } }, + destination_branch: { type: 'string' }, + }, + required: ['workspace', 'repository', 'pullRequestId'], + }, + }, + { + name: 'merge_pull_request', + description: 'Merge an open pull request', + inputSchema: { + type: 'object', + properties: { + workspace: { type: 'string' }, + repository: { type: 'string' }, + pullRequestId: { type: 'integer' }, + merge_strategy: { type: 'string', enum: ['merge_commit', 'squash', 'fast_forward'] }, + commit_message: { type: 'string' }, + close_source_branch: { type: 'boolean' }, + }, + required: ['workspace', 'repository', 'pullRequestId'], + }, + }, + { + name: 'decline_pull_request', + description: 'Decline (close) an open pull request', + inputSchema: { + type: 'object', + properties: { + workspace: { type: 'string' }, + repository: { type: 'string' }, + pullRequestId: { type: 'integer' }, + }, + required: ['workspace', 'repository', 'pullRequestId'], + }, + }, + { + name: 'approve_pull_request', + description: 'Approve a pull request as the authenticated user', + inputSchema: { + type: 'object', + properties: { + workspace: { type: 'string' }, + repository: { type: 'string' }, + pullRequestId: { type: 'integer' }, + }, + required: ['workspace', 'repository', 'pullRequestId'], + }, + }, + { + name: 'unapprove_pull_request', + description: 'Remove approval from a pull request', + inputSchema: { + type: 'object', + properties: { + workspace: { type: 'string' }, + repository: { type: 'string' }, + pullRequestId: { type: 'integer' }, + }, + required: ['workspace', 'repository', 'pullRequestId'], + }, + }, + { + name: 'request_changes_pull_request', + description: 'Request changes on a pull request as the authenticated user', + inputSchema: { + type: 'object', + properties: { + workspace: { type: 'string' }, + repository: { type: 'string' }, + pullRequestId: { type: 'integer' }, + }, + required: ['workspace', 'repository', 'pullRequestId'], + }, + }, + { + name: 'remove_request_changes_pull_request', + description: 'Remove a request-changes vote from a pull request', + inputSchema: { + type: 'object', + properties: { + workspace: { type: 'string' }, + repository: { type: 'string' }, + pullRequestId: { type: 'integer' }, + }, + required: ['workspace', 'repository', 'pullRequestId'], + }, + }, + // ── Comment write ───────────────────────────────────────────────── + { + name: 'add_pull_request_comment', + description: 'Add a comment to a pull request (general or inline on a specific file/line)', + inputSchema: { + type: 'object', + properties: { + workspace: { type: 'string' }, + repository: { type: 'string' }, + pullRequestId: { type: 'integer' }, + content: { type: 'string', description: 'Comment text (Markdown supported)' }, + inline_path: { type: 'string', description: 'File path for inline comment' }, + inline_line: { type: 'integer', description: 'Line number for inline comment' }, + parent_comment_id: { type: 'integer', description: 'Parent comment ID to reply to' }, + }, + required: ['workspace', 'repository', 'pullRequestId', 'content'], + }, + }, + { + name: 'update_pull_request_comment', + description: 'Edit the text of an existing pull request comment', + inputSchema: { + type: 'object', + properties: { + workspace: { type: 'string' }, + repository: { type: 'string' }, + pullRequestId: { type: 'integer' }, + commentId: { type: 'integer' }, + content: { type: 'string' }, + }, + required: ['workspace', 'repository', 'pullRequestId', 'commentId', 'content'], + }, + }, + { + name: 'delete_pull_request_comment', + description: 'Delete a comment from a pull request', + inputSchema: { + type: 'object', + properties: { + workspace: { type: 'string' }, + repository: { type: 'string' }, + pullRequestId: { type: 'integer' }, + commentId: { type: 'integer' }, + }, + required: ['workspace', 'repository', 'pullRequestId', 'commentId'], + }, + }, + // ── Task write ──────────────────────────────────────────────────── + { + name: 'create_pull_request_task', + description: 'Create a review task on a pull request', + inputSchema: { + type: 'object', + properties: { + workspace: { type: 'string' }, + repository: { type: 'string' }, + pullRequestId: { type: 'integer' }, + content: { type: 'string', description: 'Task description text' }, + comment_id: { type: 'integer', description: 'Anchor task to this comment ID' }, + }, + required: ['workspace', 'repository', 'pullRequestId', 'content'], + }, + }, + { + name: 'update_pull_request_task', + description: 'Update a pull request task content or resolve/unresolve it', + inputSchema: { + type: 'object', + properties: { + workspace: { type: 'string' }, + repository: { type: 'string' }, + pullRequestId: { type: 'integer' }, + taskId: { type: 'integer' }, + content: { type: 'string' }, + state: { type: 'string', enum: ['RESOLVED', 'UNRESOLVED'] }, + }, + required: ['workspace', 'repository', 'pullRequestId', 'taskId'], + }, + }, + { + name: 'delete_pull_request_task', + description: 'Delete a pull request task', + inputSchema: { + type: 'object', + properties: { + workspace: { type: 'string' }, + repository: { type: 'string' }, + pullRequestId: { type: 'integer' }, + taskId: { type: 'integer' }, + }, + required: ['workspace', 'repository', 'pullRequestId', 'taskId'], + }, + }, ], }; });