kanban-zone-mcp-server 0.1.1 → 0.1.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/package.json +3 -2
- package/src/constants.js +1 -1
- package/src/tools/cards.js +24 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kanban-zone-mcp-server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Model Context Protocol server for the Kanban Zone public API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://docs.kanbanzone.io/mcp",
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"LICENSE"
|
|
30
30
|
],
|
|
31
31
|
"scripts": {
|
|
32
|
-
"start": "node src/index.js"
|
|
32
|
+
"start": "node src/index.js",
|
|
33
|
+
"test": "node --test"
|
|
33
34
|
},
|
|
34
35
|
"engines": {
|
|
35
36
|
"node": ">=18"
|
package/src/constants.js
CHANGED
package/src/tools/cards.js
CHANGED
|
@@ -7,10 +7,29 @@ const READ = { readOnlyHint: true, destructiveHint: false, idempotentHint: true,
|
|
|
7
7
|
const WRITE = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true };
|
|
8
8
|
const IDEMPOTENT_WRITE = { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true };
|
|
9
9
|
|
|
10
|
+
// list_cards nests card fields under CardItem; search_cards returns them flat. Handle both.
|
|
10
11
|
const renderCardLine = card => {
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
12
|
+
const c = (card && card.CardItem) || card || {};
|
|
13
|
+
const id = (card && card._id) || c._id;
|
|
14
|
+
const number = c.number !== undefined ? `#${c.number} ` : '';
|
|
15
|
+
const ownerEmail = c.owner && typeof c.owner === 'object' ? c.owner.email : c.owner;
|
|
16
|
+
const owner = ownerEmail ? ` — owner ${ownerEmail}` : '';
|
|
17
|
+
return `- ${number}**${c.title}** (\`${id}\`)${owner}`;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// The /cards list envelope is { count, totalAvailable, cards, hasMore }; tolerate a bare
|
|
21
|
+
// array or search-style { total, has_more } names too, so pagination metadata stays accurate.
|
|
22
|
+
const summarizeListResponse = (data, page, count) => {
|
|
23
|
+
const items = Array.isArray(data) ? data : (data && (data.cards || data.results || data.items)) || [];
|
|
24
|
+
const envelope = data && !Array.isArray(data) ? data : {};
|
|
25
|
+
const total = [envelope.totalAvailable, envelope.total].find(v => typeof v === 'number') ?? items.length;
|
|
26
|
+
const hasMore =
|
|
27
|
+
typeof envelope.hasMore === 'boolean'
|
|
28
|
+
? envelope.hasMore
|
|
29
|
+
: typeof envelope.has_more === 'boolean'
|
|
30
|
+
? envelope.has_more
|
|
31
|
+
: total > page * count;
|
|
32
|
+
return { items, total, hasMore };
|
|
14
33
|
};
|
|
15
34
|
|
|
16
35
|
const registerCardsTools = server => {
|
|
@@ -136,10 +155,7 @@ const registerCardsTools = server => {
|
|
|
136
155
|
},
|
|
137
156
|
});
|
|
138
157
|
|
|
139
|
-
|
|
140
|
-
const items = Array.isArray(data) ? data : data.cards || data.results || [];
|
|
141
|
-
const total = typeof data.total === 'number' ? data.total : items.length;
|
|
142
|
-
const hasMore = total > page * count;
|
|
158
|
+
const { items, total, hasMore } = summarizeListResponse(data, page, count);
|
|
143
159
|
|
|
144
160
|
if (response_format === ResponseFormat.JSON) {
|
|
145
161
|
return {
|
|
@@ -444,4 +460,4 @@ const registerCardsTools = server => {
|
|
|
444
460
|
);
|
|
445
461
|
};
|
|
446
462
|
|
|
447
|
-
module.exports = { registerCardsTools };
|
|
463
|
+
module.exports = { registerCardsTools, renderCardLine, summarizeListResponse };
|