@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
68 lines (67 loc) • 3.2 kB
JavaScript
;
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 atlassian_search_controller_js_1 = __importDefault(require("../controllers/atlassian.search.controller.js"));
const error_handler_util_js_1 = require("../utils/error-handler.util.js");
const workspace_util_js_1 = require("../utils/workspace.util.js");
// Set up a logger for this module
const logger = logger_util_js_1.Logger.forContext('cli/atlassian.search.cli.ts');
/**
* Register the search commands with the CLI
* @param program The commander program to register commands with
*/
function register(program) {
program
.command('search')
.description('Search Bitbucket for content matching a query')
.requiredOption('-q, --query <query>', 'Search query')
.option('-w, --workspace <workspace>', 'Workspace slug')
.option('-r, --repo <repo>', 'Repository slug (required for PR search)')
.option('-t, --type <type>', 'Search type (code, content, repositories, pullrequests)', 'code')
.option('-c, --content-type <contentType>', 'Content type for content search (e.g., wiki, issue)')
.option('-l, --language <language>', 'Filter code search by programming language')
.option('-e, --extension <extension>', 'Filter code search by file extension')
.option('--limit <limit>', 'Maximum number of results to return', '20')
.option('--cursor <cursor>', 'Pagination cursor')
.action(async (options) => {
const methodLogger = logger.forMethod('search');
try {
methodLogger.debug('CLI search command called with:', options);
// Handle workspace
let workspace = options.workspace;
if (!workspace) {
workspace = await (0, workspace_util_js_1.getDefaultWorkspace)();
if (!workspace) {
console.error('Error: No workspace provided and no default workspace configured');
process.exit(1);
}
methodLogger.debug(`Using default workspace: ${workspace}`);
}
// Prepare controller options
const controllerOptions = {
workspace,
repo: options.repo,
query: options.query,
type: options.type,
contentType: options.contentType,
language: options.language,
extension: options.extension,
limit: options.limit
? parseInt(options.limit, 10)
: undefined,
cursor: options.cursor,
};
// Call the controller
const result = await atlassian_search_controller_js_1.default.search(controllerOptions);
// Output the result
console.log(result.content);
}
catch (error) {
(0, error_handler_util_js_1.handleCliError)(error);
}
});
}
exports.default = { register };