@aashari/mcp-server-atlassian-confluence
Version:
Node.js/TypeScript MCP server for Atlassian Confluence. Provides tools enabling AI systems (LLMs) to list/get spaces & pages (content formatted as Markdown) and search via CQL. Connects AI seamlessly to Confluence knowledge bases using the standard MCP in
65 lines (63 loc) • 3.16 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_util_js_1 = require("../utils/error.util.js");
const formatter_util_js_1 = require("../utils/formatter.util.js");
/**
* CLI module for searching Confluence content.
* Provides commands for searching content using Confluence Query Language (CQL).
* All commands require valid Atlassian credentials.
*/
/**
* Register Confluence Search CLI commands with the Commander program
* @param program - The Commander program instance to register commands with
* @throws Error if command registration fails
*/
function register(program) {
const cliLogger = logger_util_js_1.Logger.forContext('cli/atlassian.search.cli.ts', 'register');
cliLogger.debug('Registering Confluence Search CLI commands...');
registerSearchCommand(program);
cliLogger.debug('CLI commands registered successfully');
}
/**
* Register the command for searching Confluence content
* @param program - The Commander program instance
*/
function registerSearchCommand(program) {
program
.command('search')
.description(`Search for Confluence content (pages, blog posts, attachments, etc.) using CQL (Confluence Query Language).
PURPOSE: Perform powerful, targeted searches across your entire Confluence instance using the flexible CQL syntax. Find content based on text, labels, space, type, dates, and more.`)
.option('-q, --cql <query>', 'Filter content using Confluence Query Language (CQL) syntax (e.g., "text ~ \'project plan\' AND space = DEV")')
.option('-l, --limit <number>', 'Maximum number of items to return (1-100)')
.option('-c, --cursor <string>', 'Pagination cursor for retrieving the next set of results')
.action(async (options) => {
const actionLogger = logger_util_js_1.Logger.forContext('cli/atlassian.search.cli.ts', 'search');
try {
actionLogger.debug('Processing command options:', {
...options,
});
// Parse limit if provided
if (options.limit) {
const limit = parseInt(options.limit, 10);
if (isNaN(limit) || limit < 1 || limit > 100) {
throw new Error('Limit must be a number between 1 and 100.');
}
options.limit = limit;
}
const result = await atlassian_search_controller_js_1.default.search(options);
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);
}
});
}
exports.default = { register };