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.
@@ -0,0 +1,19 @@
1
+ const { registerOrganizationTools } = require('./organization');
2
+ const { registerBoardsTools } = require('./boards');
3
+ const { registerCardsTools } = require('./cards');
4
+ const { registerCommentsTools } = require('./comments');
5
+ const { registerChecklistsTools } = require('./checklists');
6
+ const { registerTasksTools } = require('./tasks');
7
+ const { registerLabelsTools } = require('./labels');
8
+
9
+ const registerAllTools = server => {
10
+ registerOrganizationTools(server);
11
+ registerBoardsTools(server);
12
+ registerCardsTools(server);
13
+ registerCommentsTools(server);
14
+ registerChecklistsTools(server);
15
+ registerTasksTools(server);
16
+ registerLabelsTools(server);
17
+ };
18
+
19
+ module.exports = { registerAllTools };
@@ -0,0 +1,142 @@
1
+ const { z } = require('zod');
2
+ const { makeApiRequest, safeRun } = require('../client');
3
+ const { responseFormatField, ResponseFormat, toJsonString } = require('../format');
4
+ const { objectIdField, boardPublicIdField } = require('../schemas');
5
+
6
+ const READ = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true };
7
+ const WRITE = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true };
8
+ const IDEMPOTENT_WRITE = { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true };
9
+
10
+ const renderLabel = label => {
11
+ const defaultTag = label.isDefault ? ' _(default)_' : '';
12
+ const color = label.color ? ` \`${label.color}\`` : '';
13
+ return `- **${label.description}**${color}${defaultTag} — id: \`${label.id}\`, position: ${label.position}`;
14
+ };
15
+
16
+ const registerLabelsTools = server => {
17
+ server.registerTool(
18
+ 'kanbanzone_create_label',
19
+ {
20
+ title: 'Create a label on a board',
21
+ description: [
22
+ 'Create a label on a board. Each board can have at most one default label —',
23
+ 'setting `is_default: true` automatically clears the flag on any existing default',
24
+ 'label for the same board.',
25
+ '',
26
+ 'Args:',
27
+ ' - board (string, required): board publicId.',
28
+ ' - color (string, required): hex color, e.g. "#FF0000".',
29
+ ' - description (string, required): human-readable label text.',
30
+ ' - is_default (boolean, optional): mark this label as the board default.',
31
+ ' - position (number, optional): sort position. Defaults to end of the list.',
32
+ '',
33
+ 'Examples:',
34
+ ' - "Add an Urgent label to board OeMrbG8g with color #FF0000"',
35
+ ' - "Create a default Backlog label on board OeMrbG8g"',
36
+ ].join('\n'),
37
+ inputSchema: {
38
+ board: boardPublicIdField,
39
+ color: z.string().min(1).max(32),
40
+ description: z.string().min(1).max(120),
41
+ is_default: z.boolean().optional(),
42
+ position: z.number().int().min(0).optional(),
43
+ },
44
+ annotations: WRITE,
45
+ },
46
+ async ({ board, color, description, is_default, position }) =>
47
+ safeRun(async () => {
48
+ const body = { board, color, description };
49
+ if (is_default !== undefined) body.isDefault = is_default;
50
+ if (position !== undefined) body.position = position;
51
+ const data = await makeApiRequest('/labels', { method: 'POST', body });
52
+ return {
53
+ content: [
54
+ {
55
+ type: 'text',
56
+ text: `Created label **${data.description}** (\`${data.id}\`) on board ${board}${
57
+ data.isDefault ? ' as the new default' : ''
58
+ }.`,
59
+ },
60
+ ],
61
+ structuredContent: data,
62
+ };
63
+ })
64
+ );
65
+
66
+ server.registerTool(
67
+ 'kanbanzone_get_label',
68
+ {
69
+ title: 'Get a label',
70
+ description: [
71
+ 'Fetch one label by its ObjectId.',
72
+ '',
73
+ 'Args:',
74
+ ' - id (string, required): label ObjectId.',
75
+ ' - response_format ("markdown" | "json").',
76
+ '',
77
+ 'Examples:',
78
+ ' - "Show me label 670aabbccddeeff001122334"',
79
+ ].join('\n'),
80
+ inputSchema: {
81
+ id: objectIdField,
82
+ response_format: responseFormatField,
83
+ },
84
+ annotations: READ,
85
+ },
86
+ async ({ id, response_format }) =>
87
+ safeRun(async () => {
88
+ const data = await makeApiRequest(`/labels/${id}`);
89
+ const text =
90
+ response_format === ResponseFormat.JSON ? toJsonString(data) : renderLabel(data);
91
+ return { content: [{ type: 'text', text }], structuredContent: data };
92
+ })
93
+ );
94
+
95
+ server.registerTool(
96
+ 'kanbanzone_update_label',
97
+ {
98
+ title: 'Update a label',
99
+ description: [
100
+ 'Update one or more fields on an existing label. Only included fields are changed.',
101
+ '',
102
+ 'Setting `is_default: true` automatically clears the flag on every other label on',
103
+ 'the same board. Setting `is_default: false` just unsets it — the board may end up',
104
+ 'with no default label.',
105
+ '',
106
+ 'Args:',
107
+ ' - id (string, required): label ObjectId.',
108
+ ' - color (string, optional): hex color, e.g. "#FF0000".',
109
+ ' - description (string, optional): human-readable label text.',
110
+ ' - is_default (boolean, optional): mark as board default (clears others).',
111
+ ' - position (number, optional): sort position.',
112
+ '',
113
+ 'Examples:',
114
+ ' - "Rename label 670... to High Priority"',
115
+ ' - "Make label 670... the default for its board"',
116
+ ].join('\n'),
117
+ inputSchema: {
118
+ id: objectIdField,
119
+ color: z.string().min(1).max(32).optional(),
120
+ description: z.string().min(1).max(120).optional(),
121
+ is_default: z.boolean().optional(),
122
+ position: z.number().int().min(0).optional(),
123
+ },
124
+ annotations: IDEMPOTENT_WRITE,
125
+ },
126
+ async ({ id, color, description, is_default, position }) =>
127
+ safeRun(async () => {
128
+ const body = {};
129
+ if (color !== undefined) body.color = color;
130
+ if (description !== undefined) body.description = description;
131
+ if (is_default !== undefined) body.isDefault = is_default;
132
+ if (position !== undefined) body.position = position;
133
+ const data = await makeApiRequest(`/labels/${id}`, { method: 'PATCH', body });
134
+ return {
135
+ content: [{ type: 'text', text: `Updated label **${data.description}**.` }],
136
+ structuredContent: data,
137
+ };
138
+ })
139
+ );
140
+ };
141
+
142
+ module.exports = { registerLabelsTools };
@@ -0,0 +1,121 @@
1
+ const { z } = require('zod');
2
+ const { makeApiRequest, safeRun } = require('../client');
3
+ const { responseFormatField, ResponseFormat, toJsonString } = require('../format');
4
+
5
+ const READ_ANNOTATIONS = {
6
+ readOnlyHint: true,
7
+ destructiveHint: false,
8
+ idempotentHint: true,
9
+ openWorldHint: true,
10
+ };
11
+
12
+ const registerOrganizationTools = server => {
13
+ server.registerTool(
14
+ 'kanbanzone_get_me',
15
+ {
16
+ title: 'Get current organization (auth check)',
17
+ description: [
18
+ 'Verify the configured API key works and return the organization name.',
19
+ 'Use this first when troubleshooting setup — if it returns the org name, auth is working.',
20
+ '',
21
+ 'Returns:',
22
+ ' { success: true, name: <organization name> }',
23
+ '',
24
+ 'Examples:',
25
+ ' - "Is my Kanban Zone connection working?"',
26
+ ' - "Which organization am I connected to?"',
27
+ ].join('\n'),
28
+ inputSchema: { response_format: responseFormatField },
29
+ annotations: READ_ANNOTATIONS,
30
+ },
31
+ async ({ response_format }) =>
32
+ safeRun(async () => {
33
+ const data = await makeApiRequest('/me');
34
+ const text =
35
+ response_format === ResponseFormat.JSON
36
+ ? toJsonString(data)
37
+ : `Connected to **${data.name}**.`;
38
+ return {
39
+ content: [{ type: 'text', text }],
40
+ structuredContent: data,
41
+ };
42
+ })
43
+ );
44
+
45
+ server.registerTool(
46
+ 'kanbanzone_get_organization',
47
+ {
48
+ title: 'Get organization context',
49
+ description: [
50
+ 'Fetch the organization profile, with optional related data: members, boards, columns, labels, and custom fields.',
51
+ 'Useful for orienting an agent at session start ("what does this workspace look like?").',
52
+ '',
53
+ 'Args (all optional):',
54
+ ' - include_members (boolean): include licensed and unlicensed member lists.',
55
+ ' - include_boards (boolean): include board summaries.',
56
+ ' - include_columns (boolean): include columns under each board (implies include_boards).',
57
+ ' - include_labels (boolean): include labels under each board (implies include_boards).',
58
+ ' - include_custom_fields (boolean): include workspace-level custom fields.',
59
+ ' - response_format ("markdown" | "json"): output format. Defaults to markdown.',
60
+ '',
61
+ 'Examples:',
62
+ ' - "List every board with its columns"',
63
+ ' - "Who are the members of this Kanban Zone workspace?"',
64
+ ].join('\n'),
65
+ inputSchema: {
66
+ include_members: z.boolean().optional(),
67
+ include_boards: z.boolean().optional(),
68
+ include_columns: z.boolean().optional(),
69
+ include_labels: z.boolean().optional(),
70
+ include_custom_fields: z.boolean().optional(),
71
+ response_format: responseFormatField,
72
+ },
73
+ annotations: READ_ANNOTATIONS,
74
+ },
75
+ async ({
76
+ include_members,
77
+ include_boards,
78
+ include_columns,
79
+ include_labels,
80
+ include_custom_fields,
81
+ response_format,
82
+ }) =>
83
+ safeRun(async () => {
84
+ const data = await makeApiRequest('/organization', {
85
+ query: {
86
+ includeMembers: include_members ? 'true' : undefined,
87
+ includeBoards: include_boards ? 'true' : undefined,
88
+ includeColumns: include_columns ? 'true' : undefined,
89
+ includeLabels: include_labels ? 'true' : undefined,
90
+ includeCustomFields: include_custom_fields ? 'true' : undefined,
91
+ },
92
+ });
93
+
94
+ let text;
95
+ if (response_format === ResponseFormat.JSON) {
96
+ text = toJsonString(data);
97
+ } else {
98
+ const lines = [`# ${data.name || 'Organization'}`];
99
+ if (Array.isArray(data.boards)) {
100
+ lines.push('', `## Boards (${data.boards.length})`);
101
+ for (const board of data.boards) {
102
+ lines.push(`- **${board.title}** (${board.publicId})`);
103
+ }
104
+ }
105
+ if (data.licensedMembers || data.unlicensedMembers) {
106
+ const total =
107
+ (data.licensedMembers || []).length + (data.unlicensedMembers || []).length;
108
+ lines.push('', `## Members (${total})`);
109
+ }
110
+ text = lines.join('\n');
111
+ }
112
+
113
+ return {
114
+ content: [{ type: 'text', text }],
115
+ structuredContent: data,
116
+ };
117
+ })
118
+ );
119
+ };
120
+
121
+ module.exports = { registerOrganizationTools };
@@ -0,0 +1,128 @@
1
+ const { z } = require('zod');
2
+ const { makeApiRequest, safeRun } = require('../client');
3
+ const { isoDateField, objectIdField } = require('../schemas');
4
+
5
+ const WRITE = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true };
6
+ const IDEMPOTENT_WRITE = { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true };
7
+
8
+ const registerTasksTools = server => {
9
+ server.registerTool(
10
+ 'kanbanzone_create_task',
11
+ {
12
+ title: 'Create a task in a checklist',
13
+ description: [
14
+ 'Add a task to an existing checklist.',
15
+ '',
16
+ 'Args:',
17
+ ' - checklist (string, required): checklist ObjectId.',
18
+ ' - description (string, required): the task text.',
19
+ ' - position (number, optional, ≥0): if omitted, the task is appended.',
20
+ ' - dueAt (string, optional): ISO date.',
21
+ ' - owner (string, optional): account ObjectId or email.',
22
+ '',
23
+ 'Examples:',
24
+ ' - "Add a task \'Update README\' to checklist 670..."',
25
+ ].join('\n'),
26
+ inputSchema: {
27
+ checklist: objectIdField,
28
+ description: z.string().min(1).max(2000),
29
+ position: z.number().int().min(0).optional(),
30
+ dueAt: isoDateField.optional(),
31
+ owner: z.string().optional(),
32
+ },
33
+ annotations: WRITE,
34
+ },
35
+ async ({ checklist, description, position, dueAt, owner }) =>
36
+ safeRun(async () => {
37
+ const body = { checklist, description };
38
+ if (position !== undefined) body.position = position;
39
+ if (dueAt !== undefined) body.dueAt = dueAt;
40
+ if (owner !== undefined) body.owner = owner;
41
+ const data = await makeApiRequest('/tasks', { method: 'POST', body });
42
+ return {
43
+ content: [{ type: 'text', text: `Task created in checklist ${checklist}.` }],
44
+ structuredContent: data,
45
+ };
46
+ })
47
+ );
48
+
49
+ server.registerTool(
50
+ 'kanbanzone_update_task',
51
+ {
52
+ title: 'Update a task',
53
+ description: [
54
+ 'Update fields on an existing task. Only included fields are changed.',
55
+ '',
56
+ 'Args:',
57
+ ' - id (string, required): task ObjectId.',
58
+ ' - description (string, optional)',
59
+ ' - completed (boolean, optional)',
60
+ ' - completedOn (string, optional): ISO date — only honoured when completed=true.',
61
+ ' - dueAt (string, optional): ISO date.',
62
+ ' - owner (string, optional): account ObjectId or email.',
63
+ ' - position (number, optional, ≥0)',
64
+ '',
65
+ 'Examples:',
66
+ ' - "Mark task 670... as complete"',
67
+ ' - "Reassign task 670... to alice@example.com"',
68
+ ].join('\n'),
69
+ inputSchema: {
70
+ id: objectIdField,
71
+ description: z.string().min(1).max(2000).optional(),
72
+ completed: z.boolean().optional(),
73
+ completedOn: isoDateField.optional(),
74
+ dueAt: isoDateField.optional(),
75
+ owner: z.string().optional(),
76
+ position: z.number().int().min(0).optional(),
77
+ },
78
+ annotations: IDEMPOTENT_WRITE,
79
+ },
80
+ async ({ id, ...updates }) =>
81
+ safeRun(async () => {
82
+ const data = await makeApiRequest(`/tasks/${id}`, { method: 'PATCH', body: updates });
83
+ return {
84
+ content: [{ type: 'text', text: `Updated task ${id}.` }],
85
+ structuredContent: data,
86
+ };
87
+ })
88
+ );
89
+
90
+ server.registerTool(
91
+ 'kanbanzone_move_task',
92
+ {
93
+ title: 'Move a task to another checklist',
94
+ description: [
95
+ 'Move a task between checklists (or reorder within the same checklist).',
96
+ '',
97
+ 'Args:',
98
+ ' - id (string, required): task ObjectId.',
99
+ ' - checklistFrom (string, required): source checklist ObjectId.',
100
+ ' - checklistTo (string, required): destination checklist ObjectId. Pass the same value as checklistFrom to reorder in place.',
101
+ ' - position (number, required, ≥0): destination position.',
102
+ '',
103
+ 'Examples:',
104
+ ' - "Move task 670... from checklist A to checklist B at position 0"',
105
+ ].join('\n'),
106
+ inputSchema: {
107
+ id: objectIdField,
108
+ checklistFrom: objectIdField,
109
+ checklistTo: objectIdField,
110
+ position: z.number().int().min(0),
111
+ },
112
+ annotations: IDEMPOTENT_WRITE,
113
+ },
114
+ async ({ id, checklistFrom, checklistTo, position }) =>
115
+ safeRun(async () => {
116
+ const data = await makeApiRequest(`/tasks/${id}/move`, {
117
+ method: 'POST',
118
+ body: { checklistFrom, checklistTo, position },
119
+ });
120
+ return {
121
+ content: [{ type: 'text', text: `Moved task ${id}.` }],
122
+ structuredContent: data || { ok: true },
123
+ };
124
+ })
125
+ );
126
+ };
127
+
128
+ module.exports = { registerTasksTools };