UNPKG

@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

55 lines (54 loc) 2.27 kB
"use strict"; /** * Service for interacting with Confluence comments API */ Object.defineProperty(exports, "__esModule", { value: true }); exports.atlassianCommentsService = void 0; const logger_util_js_1 = require("../utils/logger.util.js"); const transport_util_js_1 = require("../utils/transport.util.js"); const error_util_js_1 = require("../utils/error.util.js"); const defaults_util_js_1 = require("../utils/defaults.util.js"); // Create logger for this file const logger = logger_util_js_1.Logger.forContext('services/vendor.atlassian.comments.service.ts'); /** * List comments for a specific Confluence page * * @param params - Parameters for the request * @returns Response containing the list of comments */ async function listPageComments(params) { const { pageId, limit = defaults_util_js_1.PAGE_DEFAULTS.PAGE_SIZE, start = 0, bodyFormat = defaults_util_js_1.PAGE_DEFAULTS.BODY_FORMAT, } = params; const methodLogger = logger.forMethod('listPageComments'); methodLogger.debug('Listing comments for page', { pageId, limit, start, bodyFormat, }); // Get Atlassian credentials const credentials = (0, transport_util_js_1.getAtlassianCredentials)(); if (!credentials) { throw (0, error_util_js_1.createAuthMissingError)('Atlassian credentials are required for this operation'); } // Set up query parameters const queryParams = new URLSearchParams({ limit: limit.toString(), start: start.toString(), }); // Different endpoints and parameters depending on whether we use REST API or v2 API // For now, we'll use the REST API which has better comment support // Expand both the body format and inline properties for inline comments const path = `/wiki/rest/api/content/${pageId}/child/comment?${queryParams.toString()}&expand=body.${bodyFormat},extensions.inlineProperties`; // Make the API request const response = await (0, transport_util_js_1.fetchAtlassian)(credentials, path); methodLogger.debug('Retrieved comments', { count: response.results.length, total: response.size, pageId, }); return response; } // Export service functions exports.atlassianCommentsService = { listPageComments, };