UNPKG

@aashari/mcp-server-atlassian-jira

Version:

Node.js/TypeScript MCP server for Atlassian Jira. Equips AI systems (LLMs) with tools to list/get projects, search/get issues (using JQL/ID), and view dev info (commits, PRs). Connects AI capabilities directly into Jira project management and issue tracki

61 lines (60 loc) 2.91 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 atlassian_search_types_js_1 = require("./atlassian.search.types.js"); const atlassian_search_controller_js_1 = __importDefault(require("../controllers/atlassian.search.controller.js")); /** * MCP Tool: Search Jira * * Searches Jira content using JQL (Jira Query Language). * Returns a formatted markdown response with search results. * * @param {SearchToolArgsType} args - Tool arguments for the search query * @returns {Promise<{ content: Array<{ type: 'text', text: string }> }>} MCP response with formatted search results * @throws Will return error message if search fails */ async function search(args) { const toolLogger = logger_util_js_1.Logger.forContext('tools/atlassian.search.tool.ts', 'search'); toolLogger.debug('Searching Jira with JQL:', args); try { // Pass the search options to the search controller const message = await atlassian_search_controller_js_1.default.search({ jql: args.jql, limit: args.limit, cursor: args.cursor, }); toolLogger.debug('Search completed successfully'); return { content: [ { type: 'text', text: message.content, }, ], }; } catch (error) { toolLogger.error('Failed to search Jira', error); return (0, error_util_js_1.formatErrorForMcpTool)(error); } } /** * Register Atlassian Search MCP Tools * * Registers the search tool with the MCP server. * The tool is registered with its schema, description, and handler function. * * @param {McpServer} server - The MCP server instance to register tools with */ function registerTools(server) { const toolLogger = logger_util_js_1.Logger.forContext('tools/atlassian.search.tool.ts', 'registerTools'); toolLogger.debug('Registering Atlassian Search tools'); // Register the search tool server.tool('jira_search_issues', `Searches for Jira issues using a JQL query (\`jql\`), with pagination support (\`limit\`, \`cursor\`).\n\n- Provides advanced search capabilities across projects using complex JQL.\n- Useful for combining multiple criteria or searching text content.\nReturns a formatted list of matching issues including key, summary, type, status, project, and dates.\n**Note:** Requires valid JQL syntax. See Jira documentation for JQL details.`, atlassian_search_types_js_1.SearchToolArgs.shape, search); toolLogger.debug('Successfully registered Atlassian Search tools'); } exports.default = { registerTools };