@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
78 lines (77 loc) • 3.1 kB
JavaScript
"use strict";
/**
* Tool for interacting with Confluence comments
*/
Object.defineProperty(exports, "__esModule", { value: true });
const zod_1 = require("zod");
const logger_util_js_1 = require("../utils/logger.util.js");
const error_util_js_1 = require("../utils/error.util.js");
const atlassian_comments_controller_js_1 = require("../controllers/atlassian.comments.controller.js");
// Create logger for this file
const logger = logger_util_js_1.Logger.forContext('tools/atlassian.comments.tool.ts');
/**
* Args schema for listing page comments
*/
const ListPageCommentsArgsSchema = zod_1.z.object({
/**
* The ID of the page to get comments for
*/
pageId: zod_1.z
.string()
.min(1)
.describe('The ID of the Confluence page to retrieve comments for'),
/**
* Maximum number of results to return
*/
limit: zod_1.z
.number()
.int()
.min(1)
.max(100)
.default(25)
.describe('Maximum number of comments to retrieve (1-100)'),
/**
* Starting point for pagination
*/
start: zod_1.z
.number()
.int()
.min(0)
.default(0)
.describe('Starting point for pagination (used for retrieving subsequent pages of results)'),
});
/**
* Handle the request to list comments for a page
* @returns {Promise<{ content: Array<{ type: 'text', text: string }> }>} MCP response with formatted comments list
*/
async function handleListPageComments(args) {
const methodLogger = logger.forMethod('handleListPageComments');
try {
methodLogger.debug('Tool conf_ls_page_comments called', args);
// Call the controller with original args
const result = await atlassian_comments_controller_js_1.atlassianCommentsController.listPageComments({
pageId: args.pageId,
limit: args.limit,
start: args.start,
});
// Format the response for MCP
return {
content: [{ type: 'text', text: result.content }],
};
}
catch (error) {
methodLogger.error('Tool conf_ls_page_comments failed', error);
return (0, error_util_js_1.formatErrorForMcpTool)(error);
}
}
/**
* Register all comment-related tools
*/
function registerTools(server) {
const registerLogger = logger.forMethod('registerTools');
registerLogger.debug('Registering Confluence comments tools...');
// Register the list comments tool
server.tool('conf_ls_page_comments', 'Lists comments for a Confluence page, identified by `pageId`. Includes both page-level and inline comments. Shows comment content and metadata in Markdown format. Supports pagination via `limit` and `start` parameters. Pagination information including next offset value is included directly in the returned text content. Requires Confluence credentials to be configured. Returns comment details as Markdown.', ListPageCommentsArgsSchema.shape, handleListPageComments);
registerLogger.debug('Successfully registered Confluence comments tools');
}
exports.default = { registerTools };