@aaronsb/jira-cloud-mcp 0.7.0 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/handlers/project-handlers.js +13 -26
- package/build/index.js +10 -2
- package/package.json +1 -1
|
@@ -81,22 +81,18 @@ async function handleGetProject(jiraClient, args) {
|
|
|
81
81
|
catch {
|
|
82
82
|
// Non-fatal — continue without issue types
|
|
83
83
|
}
|
|
84
|
-
// If status counts are requested,
|
|
84
|
+
// If status counts are requested, use the count API for exact totals
|
|
85
85
|
if (includeStatusCounts) {
|
|
86
86
|
try {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
statusCounts[status] = (statusCounts[status] || 0) + 1;
|
|
94
|
-
}
|
|
95
|
-
projectData.statusCounts = statusCounts;
|
|
87
|
+
const [total, open, done] = await Promise.all([
|
|
88
|
+
jiraClient.countIssues(`project = ${projectKey}`),
|
|
89
|
+
jiraClient.countIssues(`project = ${projectKey} AND resolution = Unresolved`),
|
|
90
|
+
jiraClient.countIssues(`project = ${projectKey} AND resolution != Unresolved`),
|
|
91
|
+
]);
|
|
92
|
+
projectData.statusCounts = { Total: total, Open: open, Done: done };
|
|
96
93
|
}
|
|
97
94
|
catch (error) {
|
|
98
95
|
console.error(`Error getting status counts for project ${projectKey}:`, error);
|
|
99
|
-
// Continue even if status counts fail
|
|
100
96
|
}
|
|
101
97
|
}
|
|
102
98
|
// Handle expansions
|
|
@@ -166,26 +162,17 @@ async function handleListProjects(jiraClient, args) {
|
|
|
166
162
|
description: project.description || undefined,
|
|
167
163
|
lead: project.lead || undefined,
|
|
168
164
|
}));
|
|
169
|
-
// If status counts are requested,
|
|
165
|
+
// If status counts are requested, use count API (fast, exact, parallel)
|
|
170
166
|
if (includeStatusCounts) {
|
|
171
|
-
|
|
172
|
-
for (const project of projectDataList) {
|
|
167
|
+
await Promise.all(projectDataList.map(async (project) => {
|
|
173
168
|
try {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
// Count issues by status
|
|
177
|
-
const statusCounts = {};
|
|
178
|
-
for (const issue of searchResult.issues) {
|
|
179
|
-
const status = issue.status;
|
|
180
|
-
statusCounts[status] = (statusCounts[status] || 0) + 1;
|
|
181
|
-
}
|
|
182
|
-
project.statusCounts = statusCounts;
|
|
169
|
+
const total = await jiraClient.countIssues(`project = ${project.key}`);
|
|
170
|
+
project.statusCounts = { Total: total };
|
|
183
171
|
}
|
|
184
172
|
catch (error) {
|
|
185
|
-
console.error(`Error getting
|
|
186
|
-
// Continue with other projects even if one fails
|
|
173
|
+
console.error(`Error getting count for project ${project.key}:`, error);
|
|
187
174
|
}
|
|
188
|
-
}
|
|
175
|
+
}));
|
|
189
176
|
}
|
|
190
177
|
// Render to markdown with pagination
|
|
191
178
|
const rendererProjects = projectDataList.map(project => ({
|
package/build/index.js
CHANGED
|
@@ -22,7 +22,11 @@ import { toolSchemas } from './schemas/tool-schemas.js';
|
|
|
22
22
|
// Jira credentials from environment variables
|
|
23
23
|
const JIRA_EMAIL = process.env.JIRA_EMAIL;
|
|
24
24
|
const JIRA_API_TOKEN = process.env.JIRA_API_TOKEN;
|
|
25
|
-
|
|
25
|
+
// Normalize host: ensure https:// prefix, strip trailing slashes
|
|
26
|
+
const rawHost = process.env.JIRA_HOST?.trim();
|
|
27
|
+
const JIRA_HOST = rawHost
|
|
28
|
+
? (rawHost.startsWith('http') ? rawHost : `https://${rawHost}`).replace(/\/+$/, '')
|
|
29
|
+
: undefined;
|
|
26
30
|
if (!JIRA_EMAIL || !JIRA_API_TOKEN || !JIRA_HOST) {
|
|
27
31
|
const missing = [
|
|
28
32
|
!JIRA_API_TOKEN && 'JIRA_API_TOKEN',
|
|
@@ -34,7 +38,11 @@ if (!JIRA_EMAIL || !JIRA_API_TOKEN || !JIRA_HOST) {
|
|
|
34
38
|
process.exit(1);
|
|
35
39
|
}
|
|
36
40
|
const require = createRequire(import.meta.url);
|
|
37
|
-
|
|
41
|
+
let version = '0.0.0';
|
|
42
|
+
try {
|
|
43
|
+
version = require('../package.json').version;
|
|
44
|
+
}
|
|
45
|
+
catch { /* MCPB bundle — version unavailable */ }
|
|
38
46
|
/** Map manage_jira_issue update args to GraphIssue field patches */
|
|
39
47
|
function extractChangedFields(args) {
|
|
40
48
|
const fields = {};
|
package/package.json
CHANGED