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

74 lines (73 loc) 4.33 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 formatter_util_js_1 = require("../utils/formatter.util.js"); const atlassian_search_controller_js_1 = __importDefault(require("../controllers/atlassian.search.controller.js")); const cliLogger = logger_util_js_1.Logger.forContext('cli/atlassian.search.cli.ts'); /** * Register Atlassian Search commands * * @param {Command} program - Commander program instance */ function register(program) { const methodLogger = cliLogger.forMethod('register'); methodLogger.debug('Registering Atlassian search commands...'); // Register the search command program .command('search') .description('Search for Bitbucket content across repositories, pull requests, commits, and code\n\n' + ' PURPOSE: Provides a unified search interface for Bitbucket workspaces, searching across repository names/descriptions, ' + 'pull request titles/descriptions, commit messages, and code content to help locate resources.\n\n' + ' Use Case: Useful when you need to find specific content across your Bitbucket workspace such as ' + 'repositories by name, pull requests by description, commits by message, or code by content.\n\n' + ' Output: Formatted search results including repository details, pull request information, commit data, or code snippets ' + 'with matching content highlighted. Supports pagination.\n\n' + ' Examples:\n' + ' $ mcp-atlassian-bitbucket search --workspace-slug my-team --scope repositories --query "api"\n' + ' $ mcp-atlassian-bitbucket search --workspace-slug my-team --repo-slug backend --scope commits --query "update"\n' + ' $ mcp-atlassian-bitbucket search --workspace-slug my-team --query "function getUser" --scope code') .requiredOption('-w, --workspace-slug <slug>', 'Workspace slug containing the content to search') .option('-r, --repo-slug <slug>', 'Repository slug (required for pull request search, optional for code search)') .option('-q, --query <query>', 'Search query to filter results by name, description, etc. (required for code search)') .option('-s, --scope <scope>', 'Search scope: "repositories", "pullrequests", "commits", "code", or "all" (default)') .option('-l, --limit <number>', 'Maximum number of items to return per page (1-100)') .option('-c, --cursor <string>', 'Pagination cursor for repositories/PRs, or page number for code search') .action(async (options) => { try { const actionLogger = cliLogger.forMethod('search'); actionLogger.debug('Executing search command with options:', options); // Parse limit as number if provided if (options.limit) { options.limit = parseInt(options.limit, 10); } // For code search, cursor is actually a page number if (options.scope === 'code' && options.cursor) { options.page = parseInt(options.cursor, 10); } // Map CLI options to controller options const controllerOptions = { workspaceSlug: options.workspaceSlug, repoSlug: options.repoSlug, query: options.query, scope: options.scope, limit: options.limit, cursor: options.cursor, page: options.page, }; const result = await atlassian_search_controller_js_1.default.search(controllerOptions); console.log(result.content); if (result.pagination) { console.log((0, formatter_util_js_1.formatPagination)(result.pagination.count || 0, result.pagination.hasMore, result.pagination.nextCursor)); } } catch (error) { (0, error_util_js_1.handleCliError)(error); } }); methodLogger.debug('Successfully registered Atlassian search commands'); } exports.default = { register };