kanban-zone-mcp-server 0.1.3 → 0.2.0

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.3",
3
+ "version": "0.2.0",
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",
package/src/client.js CHANGED
@@ -1,4 +1,5 @@
1
1
  const axios = require('axios');
2
+ const { AsyncLocalStorage } = require('node:async_hooks');
2
3
  const { DEFAULT_BASE_URL, REQUEST_TIMEOUT_MS } = require('./constants');
3
4
 
4
5
  // Throws on missing/malformed key so index.js can exit before opening the stdio transport.
@@ -17,7 +18,11 @@ const parseApiKey = raw => {
17
18
  return { accessId: raw.slice(0, idx), secret: raw.slice(idx + 1) };
18
19
  };
19
20
 
21
+ // stdio: the credential is read once from env at boot into this singleton.
20
22
  let clientConfig = null;
23
+ // A host that serves multiple credentials from one process can bind per-call credentials in this
24
+ // store instead of the boot singleton; see runWithCredentials.
25
+ const credentialStore = new AsyncLocalStorage();
21
26
 
22
27
  const initApiClient = () => {
23
28
  const { accessId, secret } = parseApiKey(process.env.KANBANZONE_API_KEY);
@@ -28,7 +33,17 @@ const initApiClient = () => {
28
33
  };
29
34
  };
30
35
 
36
+ // Run fn with call-scoped credentials ({ accessId, secret, baseUrl }) that override the boot
37
+ // singleton for the duration of fn's async execution — lets one process serve multiple tenants.
38
+ const runWithCredentials = (credentials, fn) => credentialStore.run(credentials, fn);
39
+
40
+ // A per-call store (if a host set one) wins; otherwise the boot singleton (stdio). Additive —
41
+ // the stdio path is unchanged when no store is present.
31
42
  const requireConfig = () => {
43
+ const scoped = credentialStore.getStore();
44
+ if (scoped) {
45
+ return scoped;
46
+ }
32
47
  if (!clientConfig) {
33
48
  throw new Error('API client not initialized — call initApiClient() before any tool handler.');
34
49
  }
@@ -117,4 +132,5 @@ module.exports = {
117
132
  makeApiRequest,
118
133
  handleApiError,
119
134
  safeRun,
135
+ runWithCredentials,
120
136
  };
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.3';
11
+ const SERVER_VERSION = '0.2.0';
12
12
 
13
13
  const REQUEST_TIMEOUT_MS = 30000;
14
14
 
@@ -378,7 +378,8 @@ const registerCardsTools = server => {
378
378
  response_format === ResponseFormat.JSON
379
379
  ? toJsonString(data)
380
380
  : `# Metrics for card ${id}\n${toJsonString(data)}`;
381
- return { content: [{ type: 'text', text }], structuredContent: data };
381
+ // The metrics endpoint returns an array; MCP structuredContent must be an object.
382
+ return { content: [{ type: 'text', text }], structuredContent: { metrics: data } };
382
383
  })
383
384
  );
384
385
 
@@ -117,9 +117,10 @@ const registerTasksTools = server => {
117
117
  method: 'POST',
118
118
  body: { checklistFrom, checklistTo, position },
119
119
  });
120
+ // The move endpoint returns a plain string; MCP structuredContent must be an object.
120
121
  return {
121
122
  content: [{ type: 'text', text: `Moved task ${id}.` }],
122
- structuredContent: data || { ok: true },
123
+ structuredContent: { ok: true },
123
124
  };
124
125
  })
125
126
  );