@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
64 lines (62 loc) • 2.9 kB
JavaScript
"use strict";
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 formatter_util_js_1 = require("../utils/formatter.util.js");
const atlassian_repositories_types_js_1 = require("./atlassian.repositories.types.js");
// Import directly from specialized controllers
const atlassian_repositories_content_controller_js_1 = require("../controllers/atlassian.repositories.content.controller.js");
// Create a contextualized logger for this file
const toolLogger = logger_util_js_1.Logger.forContext('tools/atlassian.repositories.tool.ts');
// Log tool initialization
toolLogger.debug('Bitbucket repositories tool initialized');
/**
* Handler for cloning a repository.
*/
async function handleRepoClone(args) {
const methodLogger = logger_util_js_1.Logger.forContext('tools/atlassian.repositories.tool.ts', 'handleRepoClone');
try {
methodLogger.debug('Cloning repository:', args);
// Pass args directly to controller
const result = await (0, atlassian_repositories_content_controller_js_1.handleCloneRepository)(args);
methodLogger.debug('Successfully cloned repository via controller');
return {
content: [
{
type: 'text',
text: (0, formatter_util_js_1.truncateForAI)(result.content, result.rawResponsePath),
},
],
};
}
catch (error) {
methodLogger.error('Failed to clone repository', error);
return (0, error_util_js_1.formatErrorForMcpTool)(error);
}
}
// Tool description
const BB_CLONE_DESCRIPTION = `Clone a Bitbucket repository to your local filesystem using SSH (preferred) or HTTPS.
Provide \`repoSlug\` and \`targetPath\` (absolute path). Clones into \`targetPath/repoSlug\`. SSH keys must be configured; falls back to HTTPS if unavailable.`;
/**
* Register all Bitbucket repository tools with the MCP server.
* Uses the modern registerTool API (SDK v1.22.0+) instead of deprecated tool() method.
*
* Branch creation is now handled by bb_post tool.
*/
function registerTools(server) {
const registerLogger = logger_util_js_1.Logger.forContext('tools/atlassian.repositories.tool.ts', 'registerTools');
registerLogger.debug('Registering Repository tools...');
server.registerTool('bb_clone', {
title: 'Clone Bitbucket Repository',
description: BB_CLONE_DESCRIPTION,
inputSchema: atlassian_repositories_types_js_1.CloneRepositoryToolArgs,
annotations: {
readOnlyHint: false,
destructiveHint: false,
idempotentHint: false,
openWorldHint: true,
},
}, handleRepoClone);
registerLogger.debug('Successfully registered Repository tools');
}
exports.default = { registerTools };