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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kanban-zone-mcp-server",
3
- "version": "0.1.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
@@ -8,7 +8,7 @@ const DEFAULT_PAGE_SIZE = 20;
8
8
  const MAX_PAGE_SIZE = 100;
9
9
 
10
10
  const SERVER_NAME = 'kanban-zone-mcp-server';
11
- const SERVER_VERSION = '0.1.1';
11
+ const SERVER_VERSION = '0.1.2';
12
12
 
13
13
  const REQUEST_TIMEOUT_MS = 30000;
14
14
 
@@ -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 number = card.number !== undefined ? `#${card.number} ` : '';
12
- const owner = card.owner && card.owner.email ? ` — owner ${card.owner.email}` : '';
13
- return `- ${number}**${card.title}** (\`${card._id}\`)${owner}`;
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
- // Upstream returns either a bare array or a paginated wrapper depending on filters.
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 };