kanban-zone-mcp-server 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kanban Zone
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,109 @@
1
+ # Kanban Zone MCP Server
2
+
3
+ [Model Context Protocol](https://modelcontextprotocol.io/) server that lets AI assistants (Claude Desktop, Claude Code, Cursor, VS Code, Windsurf, and any stdio-capable MCP client) drive your [Kanban Zone](https://kanbanzone.com) workspace via the public API.
4
+
5
+ 23 tools across boards, cards, comments, checklists, and tasks. No delete operations.
6
+
7
+ ## What you can do
8
+
9
+ - Read your boards, columns, labels, members, and custom fields.
10
+ - Create, list, get, update, and move cards.
11
+ - Inspect a card's history and time-in-column metrics.
12
+ - Add comments.
13
+ - Create, update, and list checklists — including bulk task creation in a single call.
14
+ - Create, update, and move tasks.
15
+
16
+ ## Quick start (Claude Desktop)
17
+
18
+ 1. **Get an API key.** In Kanban Zone: **Org Settings → Integrations → API Key**. Copy the whole thing — it looks like `accessId:apiKey`.
19
+
20
+ 2. **Edit your config.**
21
+
22
+ - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
23
+ - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
24
+
25
+ ```json
26
+ {
27
+ "mcpServers": {
28
+ "kanbanzone": {
29
+ "command": "npx",
30
+ "args": ["-y", "kanban-zone-mcp-server"],
31
+ "env": {
32
+ "KANBANZONE_API_KEY": "accessId:apiKey"
33
+ }
34
+ }
35
+ }
36
+ }
37
+ ```
38
+
39
+ 3. **Restart Claude Desktop.** The Kanban Zone tools appear in the tool picker.
40
+
41
+ 4. **Try it.** Ask Claude: *"Is my Kanban Zone connection working?"* — Claude calls `kanbanzone_get_me` and replies with your org name.
42
+
43
+ ## Quick start (Claude Code)
44
+
45
+ ```bash
46
+ claude mcp add kanbanzone \
47
+ -e KANBANZONE_API_KEY=accessId:apiKey \
48
+ -- npx -y kanban-zone-mcp-server
49
+ ```
50
+
51
+ ## Configuration
52
+
53
+ | Variable | Required | Default | Description |
54
+ | --- | --- | --- | --- |
55
+ | `KANBANZONE_API_KEY` | yes | — | Composite credential `accessId:apiKey`. Generate in **Org Settings → Integrations → API Key**. |
56
+ | `KANBANZONE_BASE_URL` | no | `https://integrations.kanbanzone.io/v1` | Override only when pointing at a non-production environment. |
57
+
58
+ The server validates the key on startup. A missing or malformed value (no `:` separator) exits immediately with a message pointing at the org settings page.
59
+
60
+ ## Tools
61
+
62
+ 23 tools, all prefixed with `kanbanzone_`:
63
+
64
+ | Group | Tools |
65
+ | --- | --- |
66
+ | **Organization & Auth** | `get_me`, `get_organization` |
67
+ | **Boards** | `list_boards`, `get_board`, `list_board_columns`, `list_board_labels`, `list_board_members`, `list_board_custom_fields` |
68
+ | **Cards** | `create_card`, `list_cards`, `get_card`, `update_card`, `move_card`, `get_card_history`, `get_card_metrics` |
69
+ | **Comments** | `create_comment`, `list_card_comments` |
70
+ | **Checklists** | `create_checklist`, `update_checklist`, `list_card_checklists` |
71
+ | **Tasks** | `create_task`, `update_task`, `move_task` |
72
+
73
+ User-facing docs with example prompts: <https://docs.kanbanzone.io/mcp>.
74
+ Full input/output schemas: <https://docs.kanbanzone.io/api>.
75
+
76
+ ## Running from source
77
+
78
+ If you'd rather run from a local clone (development, contributions, custom modifications):
79
+
80
+ ```bash
81
+ git clone https://github.com/kanbanzone/kanban-zone-mcp-server.git
82
+ cd kanban-zone-mcp-server
83
+ npm install
84
+ KANBANZONE_API_KEY=accessId:apiKey node src/index.js
85
+ ```
86
+
87
+ Plain JavaScript — no compile step.
88
+
89
+ ## Troubleshooting
90
+
91
+ **`401` on every tool call.** API key is wrong or expired. Regenerate it.
92
+
93
+ **Tools don't appear in the client.** Confirm the path is correct and the client was restarted after editing config. For `npx` installs, run `npx -y kanban-zone-mcp-server` once manually to make sure it downloads cleanly.
94
+
95
+ **`Card does not exist` on a card you can see.** It's a mirror — pass `board=<publicId>` to disambiguate which mirror.
96
+
97
+ **Truncation warnings on `list_cards`.** Paginate with `page` / `count`, or narrow with `columns`, `owner`, `label`, or `daysSinceLastUpdate`.
98
+
99
+ ## Security
100
+
101
+ This server runs locally on your machine. It does not transmit data to any third-party AI service — every API call goes directly to `https://integrations.kanbanzone.io`. Your API key never leaves your machine except as an `Authorization: Basic` header on those direct calls.
102
+
103
+ ## What's next
104
+
105
+ The server is local-stdio only today. A hosted version (paste a URL into your client, no install) is on the roadmap.
106
+
107
+ ## License
108
+
109
+ [MIT](./LICENSE).
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "kanban-zone-mcp-server",
3
+ "version": "0.1.0",
4
+ "description": "Model Context Protocol server for the Kanban Zone public API",
5
+ "license": "MIT",
6
+ "homepage": "https://docs.kanbanzone.io/mcp",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/kanbanzone/kanban-zone-mcp-server.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/kanbanzone/kanban-zone-mcp-server/issues"
13
+ },
14
+ "keywords": [
15
+ "mcp",
16
+ "model-context-protocol",
17
+ "kanban",
18
+ "kanbanzone",
19
+ "ai"
20
+ ],
21
+ "main": "src/index.js",
22
+ "bin": {
23
+ "kanban-zone-mcp": "src/index.js"
24
+ },
25
+ "files": [
26
+ "src",
27
+ "README.md",
28
+ "LICENSE"
29
+ ],
30
+ "scripts": {
31
+ "start": "node src/index.js"
32
+ },
33
+ "engines": {
34
+ "node": ">=18"
35
+ },
36
+ "dependencies": {
37
+ "@modelcontextprotocol/sdk": "^1.6.1",
38
+ "axios": "^1.7.9",
39
+ "zod": "^3.23.8"
40
+ }
41
+ }
package/src/client.js ADDED
@@ -0,0 +1,120 @@
1
+ const axios = require('axios');
2
+ const { DEFAULT_BASE_URL, REQUEST_TIMEOUT_MS } = require('./constants');
3
+
4
+ // Throws on missing/malformed key so index.js can exit before opening the stdio transport.
5
+ const parseApiKey = raw => {
6
+ if (!raw || !raw.trim()) {
7
+ throw new Error(
8
+ 'KANBANZONE_API_KEY is required. Generate one in Kanban Zone → Org Settings → Integrations → API Key.'
9
+ );
10
+ }
11
+ const idx = raw.indexOf(':');
12
+ if (idx <= 0 || idx === raw.length - 1) {
13
+ throw new Error(
14
+ 'KANBANZONE_API_KEY is malformed — expected "accessId:apiKey". Re-copy it from Org Settings → Integrations → API Key.'
15
+ );
16
+ }
17
+ return { accessId: raw.slice(0, idx), secret: raw.slice(idx + 1) };
18
+ };
19
+
20
+ let clientConfig = null;
21
+
22
+ const initApiClient = () => {
23
+ const { accessId, secret } = parseApiKey(process.env.KANBANZONE_API_KEY);
24
+ clientConfig = {
25
+ accessId,
26
+ secret,
27
+ baseUrl: (process.env.KANBANZONE_BASE_URL && process.env.KANBANZONE_BASE_URL.trim()) || DEFAULT_BASE_URL,
28
+ };
29
+ };
30
+
31
+ const requireConfig = () => {
32
+ if (!clientConfig) {
33
+ throw new Error('API client not initialized — call initApiClient() before any tool handler.');
34
+ }
35
+ return clientConfig;
36
+ };
37
+
38
+ const buildUrl = (baseUrl, endpoint) => {
39
+ const base = baseUrl.replace(/\/$/, '');
40
+ const path = endpoint.replace(/^\//, '');
41
+ return `${base}/${path}`;
42
+ };
43
+
44
+ const makeApiRequest = async (endpoint, { method = 'GET', body, query } = {}) => {
45
+ const config = requireConfig();
46
+ const cleanedQuery = query
47
+ ? Object.fromEntries(Object.entries(query).filter(([, value]) => value !== undefined && value !== null))
48
+ : undefined;
49
+
50
+ const response = await axios.request({
51
+ method,
52
+ url: buildUrl(config.baseUrl, endpoint),
53
+ data: body,
54
+ params: cleanedQuery,
55
+ timeout: REQUEST_TIMEOUT_MS,
56
+ auth: { username: config.accessId, password: config.secret },
57
+ headers: {
58
+ 'Content-Type': 'application/json',
59
+ Accept: 'application/json',
60
+ },
61
+ });
62
+ return response.data;
63
+ };
64
+
65
+ const handleApiError = error => {
66
+ if (axios.isAxiosError(error)) {
67
+ const status = error.response && error.response.status;
68
+ const data = (error.response && error.response.data) || undefined;
69
+ const upstreamMessage = data && (data.message || data.error);
70
+
71
+ if (status === 400) {
72
+ return upstreamMessage
73
+ ? `Validation error: ${upstreamMessage}`
74
+ : 'Validation error: the upstream API rejected the request body or query parameters.';
75
+ }
76
+ if (status === 401) {
77
+ return 'Authentication failed. Check KANBANZONE_API_KEY — get a fresh one from Org Settings → Integrations → API Key.';
78
+ }
79
+ if (status === 403) {
80
+ return 'Permission denied. The API key is valid but does not have access to this resource.';
81
+ }
82
+ if (status === 404) {
83
+ return upstreamMessage
84
+ ? `Not found: ${upstreamMessage}`
85
+ : 'Not found. Double-check the ID — and for mirror cards, pass the `board` (publicId) parameter.';
86
+ }
87
+ if (status === 429) {
88
+ return 'Rate limit exceeded. Wait a moment before retrying.';
89
+ }
90
+ if (status && status >= 500) {
91
+ return `Upstream API error (${status}). Try again shortly; if it persists this is a Kanban Zone issue.`;
92
+ }
93
+ if (error.code === 'ECONNABORTED') {
94
+ return 'Request timed out. Try again or narrow the request (filters, smaller `count`).';
95
+ }
96
+ if (error.code === 'ENOTFOUND' || error.code === 'ECONNREFUSED') {
97
+ return 'Could not reach the Kanban Zone API. Check KANBANZONE_BASE_URL or your network.';
98
+ }
99
+ }
100
+ const message = error instanceof Error ? error.message : String(error);
101
+ return `Unexpected error: ${message}`;
102
+ };
103
+
104
+ const safeRun = async fn => {
105
+ try {
106
+ return await fn();
107
+ } catch (error) {
108
+ return {
109
+ isError: true,
110
+ content: [{ type: 'text', text: handleApiError(error) }],
111
+ };
112
+ }
113
+ };
114
+
115
+ module.exports = {
116
+ initApiClient,
117
+ makeApiRequest,
118
+ handleApiError,
119
+ safeRun,
120
+ };
@@ -0,0 +1,23 @@
1
+ const DEFAULT_BASE_URL = 'https://integrations.kanbanzone.io/v1';
2
+
3
+ // List tools that exceed this halve their results and return a `truncated` note,
4
+ // telling the agent to paginate or filter.
5
+ const CHARACTER_LIMIT = 25000;
6
+
7
+ const DEFAULT_PAGE_SIZE = 20;
8
+ const MAX_PAGE_SIZE = 100;
9
+
10
+ const SERVER_NAME = 'kanban-zone-mcp-server';
11
+ const SERVER_VERSION = '0.1.0';
12
+
13
+ const REQUEST_TIMEOUT_MS = 30000;
14
+
15
+ module.exports = {
16
+ DEFAULT_BASE_URL,
17
+ CHARACTER_LIMIT,
18
+ DEFAULT_PAGE_SIZE,
19
+ MAX_PAGE_SIZE,
20
+ SERVER_NAME,
21
+ SERVER_VERSION,
22
+ REQUEST_TIMEOUT_MS,
23
+ };
package/src/format.js ADDED
@@ -0,0 +1,41 @@
1
+ const { z } = require('zod');
2
+ const { CHARACTER_LIMIT } = require('./constants');
3
+
4
+ const ResponseFormat = {
5
+ MARKDOWN: 'markdown',
6
+ JSON: 'json',
7
+ };
8
+
9
+ const responseFormatField = z
10
+ .enum([ResponseFormat.MARKDOWN, ResponseFormat.JSON])
11
+ .default(ResponseFormat.MARKDOWN)
12
+ .describe("Output format. 'markdown' (default) is human-readable; 'json' is the raw structured payload.");
13
+
14
+ const toJsonString = value => JSON.stringify(value, null, 2);
15
+
16
+ // Caller passes the full rendered string and a `rerender(items)` callback so we can
17
+ // shrink the items array and re-render until we're under CHARACTER_LIMIT.
18
+ const truncateIfNeeded = ({ items, rendered, rerender }) => {
19
+ if (rendered.length <= CHARACTER_LIMIT) {
20
+ return { text: rendered, truncated: false, keptCount: items.length };
21
+ }
22
+
23
+ let kept = Math.max(1, Math.floor(items.length / 2));
24
+ let next = rerender(items.slice(0, kept));
25
+ while (next.length > CHARACTER_LIMIT && kept > 1) {
26
+ kept = Math.max(1, Math.floor(kept / 2));
27
+ next = rerender(items.slice(0, kept));
28
+ }
29
+
30
+ const note =
31
+ `\n\n> Response truncated from ${items.length} to ${kept} items to stay under ${CHARACTER_LIMIT} characters. ` +
32
+ `Use pagination (\`page\`/\`count\`) or narrower filters to see the rest.`;
33
+ return { text: next + note, truncated: true, keptCount: kept };
34
+ };
35
+
36
+ module.exports = {
37
+ ResponseFormat,
38
+ responseFormatField,
39
+ toJsonString,
40
+ truncateIfNeeded,
41
+ };
package/src/index.js ADDED
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env node
2
+ /* eslint-disable no-console */
3
+ // Stdio entry point. The MCP SDK is ESM-only; everything else is CommonJS, so the SDK
4
+ // is dynamically imported inside main().
5
+
6
+ const { initApiClient } = require('./client');
7
+ const { registerAllTools } = require('./tools');
8
+ const { SERVER_NAME, SERVER_VERSION } = require('./constants');
9
+
10
+ const main = async () => {
11
+ // Validate config before opening stdio so a missing/malformed key fails clean instead
12
+ // of blowing up on every tool call later.
13
+ try {
14
+ initApiClient();
15
+ } catch (err) {
16
+ console.error(err.message);
17
+ process.exit(1);
18
+ }
19
+
20
+ const { McpServer } = await import('@modelcontextprotocol/sdk/server/mcp.js');
21
+ const { StdioServerTransport } = await import('@modelcontextprotocol/sdk/server/stdio.js');
22
+
23
+ const server = new McpServer({ name: SERVER_NAME, version: SERVER_VERSION });
24
+ registerAllTools(server);
25
+
26
+ const transport = new StdioServerTransport();
27
+ await server.connect(transport);
28
+
29
+ // stdio convention: never log to stdout — it carries the MCP protocol.
30
+ console.error(`${SERVER_NAME} v${SERVER_VERSION} running via stdio.`);
31
+ };
32
+
33
+ main().catch(err => {
34
+ console.error('Fatal:', err);
35
+ process.exit(1);
36
+ });
package/src/schemas.js ADDED
@@ -0,0 +1,29 @@
1
+ const { z } = require('zod');
2
+ const { DEFAULT_PAGE_SIZE, MAX_PAGE_SIZE } = require('./constants');
3
+
4
+ const objectIdField = z.string().regex(/^[a-f0-9]{24}$/i, 'Must be a 24-character MongoDB ObjectId');
5
+
6
+ // Boards are addressed by publicId (e.g. "OeMrbG8g") in the public API, not by ObjectId.
7
+ const boardPublicIdField = z.string().regex(/^[A-Za-z0-9]{6,12}$/, 'Must be a board publicId (e.g. "OeMrbG8g")');
8
+
9
+ const pageField = z.number().int().min(1).default(1).describe('1-based page number.');
10
+
11
+ const countField = z
12
+ .number()
13
+ .int()
14
+ .min(1)
15
+ .max(MAX_PAGE_SIZE)
16
+ .default(DEFAULT_PAGE_SIZE)
17
+ .describe(`Items per page (1-${MAX_PAGE_SIZE}, default ${DEFAULT_PAGE_SIZE}).`);
18
+
19
+ const isoDateField = z.string().refine(value => !Number.isNaN(Date.parse(value)), {
20
+ message: 'Must be an ISO-8601 date or datetime string',
21
+ });
22
+
23
+ module.exports = {
24
+ objectIdField,
25
+ boardPublicIdField,
26
+ pageField,
27
+ countField,
28
+ isoDateField,
29
+ };
@@ -0,0 +1,253 @@
1
+ const { z } = require('zod');
2
+ const { makeApiRequest, safeRun } = require('../client');
3
+ const { responseFormatField, ResponseFormat, toJsonString, truncateIfNeeded } = require('../format');
4
+ const { boardPublicIdField } = require('../schemas');
5
+
6
+ const READ_ANNOTATIONS = {
7
+ readOnlyHint: true,
8
+ destructiveHint: false,
9
+ idempotentHint: true,
10
+ openWorldHint: true,
11
+ };
12
+
13
+ const renderBoardLine = board => `- **${board.title}** (${board.publicId})`;
14
+
15
+ const registerBoardsTools = server => {
16
+ server.registerTool(
17
+ 'kanbanzone_list_boards',
18
+ {
19
+ title: 'List boards',
20
+ description: [
21
+ 'List all boards in the organization with optional related data.',
22
+ '',
23
+ 'Args (all optional):',
24
+ ' - include_archived (boolean): include archived boards.',
25
+ ' - include_columns (boolean): include columns for each board.',
26
+ ' - include_labels (boolean): include labels for each board.',
27
+ ' - include_members (boolean): include member lists for each board.',
28
+ ' - include_custom_fields (boolean): include custom fields per board.',
29
+ ' - response_format ("markdown" | "json"): output format. Defaults to markdown.',
30
+ '',
31
+ 'Examples:',
32
+ ' - "What boards do I have?"',
33
+ ' - "Show me my boards including their columns"',
34
+ ].join('\n'),
35
+ inputSchema: {
36
+ include_archived: z.boolean().optional(),
37
+ include_columns: z.boolean().optional(),
38
+ include_labels: z.boolean().optional(),
39
+ include_members: z.boolean().optional(),
40
+ include_custom_fields: z.boolean().optional(),
41
+ response_format: responseFormatField,
42
+ },
43
+ annotations: READ_ANNOTATIONS,
44
+ },
45
+ async ({
46
+ include_archived,
47
+ include_columns,
48
+ include_labels,
49
+ include_members,
50
+ include_custom_fields,
51
+ response_format,
52
+ }) =>
53
+ safeRun(async () => {
54
+ const data = await makeApiRequest('/boards', {
55
+ query: {
56
+ includeArchived: include_archived ? 'true' : undefined,
57
+ includeColumns: include_columns ? 'true' : undefined,
58
+ includeLabels: include_labels ? 'true' : undefined,
59
+ includeMembers: include_members ? 'true' : undefined,
60
+ includeCustomFields: include_custom_fields ? 'true' : undefined,
61
+ },
62
+ });
63
+
64
+ const boards = Array.isArray(data) ? data : data.boards || [];
65
+
66
+ if (response_format === ResponseFormat.JSON) {
67
+ return {
68
+ content: [{ type: 'text', text: toJsonString(boards) }],
69
+ structuredContent: { boards },
70
+ };
71
+ }
72
+
73
+ const rerender = items =>
74
+ [`# Boards (${items.length})`, '', ...items.map(renderBoardLine)].join('\n');
75
+ const { text } = truncateIfNeeded({
76
+ items: boards,
77
+ rendered: rerender(boards),
78
+ rerender,
79
+ });
80
+
81
+ return {
82
+ content: [{ type: 'text', text }],
83
+ structuredContent: { boards },
84
+ };
85
+ })
86
+ );
87
+
88
+ server.registerTool(
89
+ 'kanbanzone_get_board',
90
+ {
91
+ title: 'Get a board',
92
+ description: [
93
+ 'Fetch a single board by its publicId.',
94
+ '',
95
+ 'Args:',
96
+ ' - board (string, required): the board publicId, e.g. "OeMrbG8g".',
97
+ ' - include_columns (boolean): include columns.',
98
+ ' - include_labels (boolean): include labels.',
99
+ ' - include_members (boolean): include members.',
100
+ ' - include_custom_fields (boolean): include custom fields.',
101
+ ' - response_format ("markdown" | "json"): output format. Defaults to markdown.',
102
+ '',
103
+ 'Examples:',
104
+ ' - "Show me the OeMrbG8g board with its columns"',
105
+ ].join('\n'),
106
+ inputSchema: {
107
+ board: boardPublicIdField.describe('Board publicId, e.g. "OeMrbG8g".'),
108
+ include_columns: z.boolean().optional(),
109
+ include_labels: z.boolean().optional(),
110
+ include_members: z.boolean().optional(),
111
+ include_custom_fields: z.boolean().optional(),
112
+ response_format: responseFormatField,
113
+ },
114
+ annotations: READ_ANNOTATIONS,
115
+ },
116
+ async ({ board, include_columns, include_labels, include_members, include_custom_fields, response_format }) =>
117
+ safeRun(async () => {
118
+ const data = await makeApiRequest(`/boards/${encodeURIComponent(board)}`, {
119
+ query: {
120
+ includeColumns: include_columns ? 'true' : undefined,
121
+ includeLabels: include_labels ? 'true' : undefined,
122
+ includeMembers: include_members ? 'true' : undefined,
123
+ includeCustomFields: include_custom_fields ? 'true' : undefined,
124
+ },
125
+ });
126
+
127
+ const text =
128
+ response_format === ResponseFormat.JSON
129
+ ? toJsonString(data)
130
+ : `# ${data.title}\n- **publicId**: ${data.publicId}${data.description ? `\n- **description**: ${data.description}` : ''}`;
131
+
132
+ return {
133
+ content: [{ type: 'text', text }],
134
+ structuredContent: data,
135
+ };
136
+ })
137
+ );
138
+
139
+ // Columns / labels / members / custom-fields all render the same way — a tiny spec table
140
+ // generates four near-identical tools.
141
+ const subResources = [
142
+ {
143
+ name: 'kanbanzone_list_board_columns',
144
+ title: 'List board columns',
145
+ path: 'columns',
146
+ label: 'Columns',
147
+ extraSchema: {
148
+ query: z
149
+ .string()
150
+ .optional()
151
+ .describe('Optional substring to filter column titles.'),
152
+ include_default: z
153
+ .boolean()
154
+ .optional()
155
+ .describe('Include the default "Backlog" / "Done" / archive columns.'),
156
+ },
157
+ buildQuery: ({ query, include_default }) => ({
158
+ query,
159
+ includeDefault: include_default ? 'true' : undefined,
160
+ }),
161
+ renderItem: column => `- **${column.title}** (\`${column._id}\`)${column.bucketState ? ` — ${column.bucketState}` : ''}`,
162
+ example: '"List columns on the OeMrbG8g board"',
163
+ },
164
+ {
165
+ name: 'kanbanzone_list_board_labels',
166
+ title: 'List board labels',
167
+ path: 'labels',
168
+ label: 'Labels',
169
+ extraSchema: {},
170
+ buildQuery: () => ({}),
171
+ renderItem: label => `- **${label.description || '(no description)'}** (\`${label._id}\`)${label.color ? ` color ${label.color}` : ''}`,
172
+ example: '"What labels are available on this board?"',
173
+ },
174
+ {
175
+ name: 'kanbanzone_list_board_members',
176
+ title: 'List board members',
177
+ path: 'members',
178
+ label: 'Members',
179
+ extraSchema: {},
180
+ buildQuery: () => ({}),
181
+ renderItem: member => {
182
+ const name = [member.firstName, member.lastName].filter(Boolean).join(' ') || member.email;
183
+ return `- **${name}** (${member.email}) — \`${member._id}\``;
184
+ },
185
+ example: '"Who can I assign cards to on this board?"',
186
+ },
187
+ {
188
+ name: 'kanbanzone_list_board_custom_fields',
189
+ title: 'List board custom fields',
190
+ path: 'custom-fields',
191
+ label: 'Custom fields',
192
+ extraSchema: {},
193
+ buildQuery: () => ({}),
194
+ renderItem: field => `- **${field.label || field.name}** (\`${field._id}\`) — type ${field.type}`,
195
+ example: '"What custom fields does this board have?"',
196
+ },
197
+ ];
198
+
199
+ for (const sub of subResources) {
200
+ server.registerTool(
201
+ sub.name,
202
+ {
203
+ title: sub.title,
204
+ description: [
205
+ `${sub.title} for a board.`,
206
+ '',
207
+ 'Args:',
208
+ ' - board (string, required): the board publicId, e.g. "OeMrbG8g".',
209
+ ...Object.keys(sub.extraSchema).map(key => ` - ${key}: see schema.`),
210
+ ' - response_format ("markdown" | "json"): output format. Defaults to markdown.',
211
+ '',
212
+ `Example: ${sub.example}`,
213
+ ].join('\n'),
214
+ inputSchema: {
215
+ board: boardPublicIdField.describe('Board publicId, e.g. "OeMrbG8g".'),
216
+ ...sub.extraSchema,
217
+ response_format: responseFormatField,
218
+ },
219
+ annotations: READ_ANNOTATIONS,
220
+ },
221
+ async args =>
222
+ safeRun(async () => {
223
+ const { board, response_format } = args;
224
+ const data = await makeApiRequest(`/boards/${encodeURIComponent(board)}/${sub.path}`, {
225
+ query: sub.buildQuery(args),
226
+ });
227
+ const items = Array.isArray(data) ? data : [];
228
+
229
+ if (response_format === ResponseFormat.JSON) {
230
+ return {
231
+ content: [{ type: 'text', text: toJsonString(items) }],
232
+ structuredContent: { items },
233
+ };
234
+ }
235
+
236
+ const rerender = list =>
237
+ [`# ${sub.label} (${list.length})`, '', ...list.map(sub.renderItem)].join('\n');
238
+ const { text } = truncateIfNeeded({
239
+ items,
240
+ rendered: rerender(items),
241
+ rerender,
242
+ });
243
+
244
+ return {
245
+ content: [{ type: 'text', text }],
246
+ structuredContent: { items },
247
+ };
248
+ })
249
+ );
250
+ }
251
+ };
252
+
253
+ module.exports = { registerBoardsTools };