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

79 lines (78 loc) 3.87 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const logger_util_js_1 = require("../utils/logger.util.js"); const error_util_js_1 = require("../utils/error.util.js"); const atlassian_diff_controller_js_1 = __importDefault(require("../controllers/atlassian.diff.controller.js")); const atlassian_diff_types_js_1 = require("./atlassian.diff.types.js"); // Create a contextualized logger for this file const toolLogger = logger_util_js_1.Logger.forContext('tools/atlassian.diff.tool.ts'); // Log tool initialization toolLogger.debug('Bitbucket diff tool initialized'); /** * Handles branch diff requests * @param args - Arguments for the branch diff operation * @returns MCP tool response */ async function branchDiff(args) { const methodLogger = toolLogger.forMethod('branchDiff'); try { methodLogger.debug('Processing branch diff tool request', args); // Pass args directly to controller without any business logic const result = await atlassian_diff_controller_js_1.default.branchDiff(args); methodLogger.debug('Successfully retrieved branch diff from controller'); return { content: [ { type: 'text', text: result.content, }, ], }; } catch (error) { methodLogger.error('Failed to retrieve branch diff', error); return (0, error_util_js_1.formatErrorForMcpTool)(error); } } /** * Handles commit diff requests * @param args - Arguments for the commit diff operation * @returns MCP tool response */ async function commitDiff(args) { const methodLogger = toolLogger.forMethod('commitDiff'); try { methodLogger.debug('Processing commit diff tool request', args); // Pass args directly to controller without any business logic const result = await atlassian_diff_controller_js_1.default.commitDiff(args); methodLogger.debug('Successfully retrieved commit diff from controller'); return { content: [ { type: 'text', text: result.content, }, ], }; } catch (error) { methodLogger.error('Failed to retrieve commit diff', error); return (0, error_util_js_1.formatErrorForMcpTool)(error); } } /** * Register all Bitbucket diff tools with the MCP server. */ function registerTools(server) { const registerLogger = logger_util_js_1.Logger.forContext('tools/atlassian.diff.tool.ts', 'registerTools'); registerLogger.debug('Registering Diff tools...'); // Register the branch diff tool server.tool('bb_diff_branches', `Shows changes between branches in a repository identified by \`workspaceSlug\` and \`repoSlug\`. Compares changes in \`sourceBranch\` relative to \`destinationBranch\`. Limits the number of files to show with \`limit\`. Returns the diff as formatted Markdown showing file changes, additions, and deletions. Requires Bitbucket credentials to be configured.`, atlassian_diff_types_js_1.BranchDiffArgsSchema.shape, branchDiff); // Register the commit diff tool server.tool('bb_diff_commits', `Shows changes between commits in a repository identified by \`workspaceSlug\` and \`repoSlug\`. Requires \`sinceCommit\` and \`untilCommit\` to identify the specific commits to compare. Returns the diff as formatted Markdown showing file changes, additions, and deletions between the commits. Requires Bitbucket credentials to be configured.`, atlassian_diff_types_js_1.CommitDiffArgsSchema.shape, commitDiff); registerLogger.debug('Successfully registered Diff tools'); } exports.default = { registerTools };