@monadsag/productive-mcp 1.2.48

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.
Files changed (63) hide show
  1. package/LICENSE +190 -0
  2. package/NOTICE +6 -0
  3. package/README.md +353 -0
  4. package/build/api/bookings-client.js +249 -0
  5. package/build/api/capacity.js +279 -0
  6. package/build/api/client.js +1296 -0
  7. package/build/api/errors.js +50 -0
  8. package/build/api/invoice-time-entries.js +256 -0
  9. package/build/api/pages-tree.js +106 -0
  10. package/build/api/time-entry-notes.js +75 -0
  11. package/build/api/types.js +1 -0
  12. package/build/auth/logo.js +21 -0
  13. package/build/auth/self-resolver.js +61 -0
  14. package/build/config/index.js +24 -0
  15. package/build/index.js +15 -0
  16. package/build/prompts/timesheet.js +285 -0
  17. package/build/server.js +55 -0
  18. package/build/tools/absences.js +502 -0
  19. package/build/tools/activities.js +140 -0
  20. package/build/tools/bookings.js +531 -0
  21. package/build/tools/budget-services.js +168 -0
  22. package/build/tools/budgets.js +276 -0
  23. package/build/tools/capacity.js +281 -0
  24. package/build/tools/changeset.js +41 -0
  25. package/build/tools/comments.js +469 -0
  26. package/build/tools/companies.js +73 -0
  27. package/build/tools/custom-field-resolver.js +92 -0
  28. package/build/tools/custom-fields.js +155 -0
  29. package/build/tools/folders.js +516 -0
  30. package/build/tools/include-resolver.js +45 -0
  31. package/build/tools/invoice-actions.js +476 -0
  32. package/build/tools/invoice-defaults.js +65 -0
  33. package/build/tools/invoice-time-entries.js +320 -0
  34. package/build/tools/invoices.js +657 -0
  35. package/build/tools/my-tasks.js +100 -0
  36. package/build/tools/page-children.js +129 -0
  37. package/build/tools/pages.js +466 -0
  38. package/build/tools/people.js +147 -0
  39. package/build/tools/projects.js +77 -0
  40. package/build/tools/recent-updates.js +112 -0
  41. package/build/tools/registry.js +409 -0
  42. package/build/tools/subtasks.js +245 -0
  43. package/build/tools/task-backlog.js +106 -0
  44. package/build/tools/task-dependencies.js +244 -0
  45. package/build/tools/task-list-move.js +65 -0
  46. package/build/tools/task-lists.js +535 -0
  47. package/build/tools/task-reposition.js +199 -0
  48. package/build/tools/task-status.js +178 -0
  49. package/build/tools/tasks.js +738 -0
  50. package/build/tools/time-entries.js +736 -0
  51. package/build/tools/time-entry-approval.js +103 -0
  52. package/build/tools/time-entry-delete.js +72 -0
  53. package/build/tools/time-entry-update.js +126 -0
  54. package/build/tools/timers.js +195 -0
  55. package/build/tools/todos.js +342 -0
  56. package/build/tools/tool-helpers.js +114 -0
  57. package/build/tools/toolsets.js +153 -0
  58. package/build/tools/whoami.js +64 -0
  59. package/build/tools/workflow-statuses.js +81 -0
  60. package/build/utils/errors.js +67 -0
  61. package/build/utils/mentions.js +98 -0
  62. package/npm-shrinkwrap.json +1159 -0
  63. package/package.json +79 -0
@@ -0,0 +1,106 @@
1
+ import { z } from 'zod';
2
+ import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js';
3
+ import { toMcpError } from '../utils/errors.js';
4
+ const addToBacklogSchema = z.object({
5
+ task_id: z.string().describe('ID of the task to add to backlog'),
6
+ project_id: z.string().describe('ID of the project containing the task'),
7
+ });
8
+ export async function addToBacklog(client, args) {
9
+ try {
10
+ const { task_id, project_id } = addToBacklogSchema.parse(args);
11
+ // First, find all boards in the project
12
+ const boardsResponse = await client.listBoards({ project_id });
13
+ if (boardsResponse.data.length === 0) {
14
+ throw new McpError(ErrorCode.InvalidParams, `No boards found in project ${project_id}. Cannot create backlog.`);
15
+ }
16
+ // Look for a Backlog task list in each board
17
+ let backlogListId = null;
18
+ let boardId = null;
19
+ for (const board of boardsResponse.data) {
20
+ const taskListsResponse = await client.listTaskLists({ board_id: board.id });
21
+ const backlogList = taskListsResponse.data.find((list) => list.attributes.name.toLowerCase() === 'backlog');
22
+ if (backlogList) {
23
+ backlogListId = backlogList.id;
24
+ boardId = board.id;
25
+ break;
26
+ }
27
+ }
28
+ // If no backlog list found, create one in the first board
29
+ if (!backlogListId) {
30
+ boardId = boardsResponse.data[0].id;
31
+ const createResponse = await client.createTaskList({
32
+ data: {
33
+ type: 'task_lists',
34
+ attributes: {
35
+ name: 'Backlog',
36
+ description: 'Product backlog for unscheduled tasks',
37
+ project_id: project_id,
38
+ },
39
+ relationships: {
40
+ board: {
41
+ data: {
42
+ id: boardId,
43
+ type: 'boards',
44
+ },
45
+ },
46
+ },
47
+ },
48
+ });
49
+ backlogListId = createResponse.data.id;
50
+ }
51
+ // Move the task to the backlog
52
+ await client.updateTask(task_id, {
53
+ data: {
54
+ type: 'tasks',
55
+ id: task_id,
56
+ relationships: {
57
+ task_list: {
58
+ data: {
59
+ type: 'task_lists',
60
+ id: backlogListId,
61
+ },
62
+ },
63
+ },
64
+ },
65
+ });
66
+ return {
67
+ content: [
68
+ {
69
+ type: 'text',
70
+ text: `✅ Moved task ${task_id} to Backlog (list ID: ${backlogListId})`,
71
+ },
72
+ ],
73
+ };
74
+ }
75
+ catch (error) {
76
+ throw toMcpError(error);
77
+ }
78
+ }
79
+ export const addToBacklogTool = {
80
+ name: 'add_to_backlog',
81
+ description: "Move a task into its project's 'Backlog' task list, scanning every board in the project for a list named " +
82
+ "'Backlog' (case-insensitive) and creating one in the first board if none exists. " +
83
+ 'Use this to park or deprioritize a task when you do not know a target list ID; use move_task_to_list when you ' +
84
+ 'already have the destination task_list_id, or reposition_task to reorder a task within its current list.',
85
+ inputSchema: {
86
+ type: 'object',
87
+ properties: {
88
+ task_id: {
89
+ type: 'string',
90
+ description: 'ID of the task to add to backlog',
91
+ },
92
+ project_id: {
93
+ type: 'string',
94
+ description: 'ID of the project containing the task',
95
+ },
96
+ },
97
+ required: ['task_id', 'project_id'],
98
+ },
99
+ annotations: {
100
+ title: 'Add to backlog',
101
+ readOnlyHint: false,
102
+ destructiveHint: false,
103
+ idempotentHint: true,
104
+ openWorldHint: true,
105
+ },
106
+ };
@@ -0,0 +1,244 @@
1
+ import { z } from 'zod';
2
+ import { toMcpError } from '../utils/errors.js';
3
+ function resolveTaskTitle(taskId, included) {
4
+ if (!taskId || !included)
5
+ return undefined;
6
+ const task = included.find((item) => item.type === 'tasks' && item.id === taskId);
7
+ return task?.attributes?.title;
8
+ }
9
+ function dependencyTypeLabel(typeId) {
10
+ switch (typeId) {
11
+ case 1:
12
+ return 'blocks (finish to start)';
13
+ case 2:
14
+ return 'is blocked by';
15
+ case 3:
16
+ return 'related to';
17
+ default:
18
+ return `type ${typeId}`;
19
+ }
20
+ }
21
+ // ---- Schemas ----
22
+ const listTaskDependenciesSchema = z.object({
23
+ task_id: z.string().optional().describe('Filter by source task ID (the blocker)'),
24
+ dependent_task_id: z
25
+ .string()
26
+ .optional()
27
+ .describe('Filter by dependent task ID (the blocked task)'),
28
+ limit: z.coerce.number().min(1).max(200).default(50).optional(),
29
+ });
30
+ const getTaskDependencySchema = z.object({
31
+ dependency_id: z.string().min(1, 'Dependency ID is required'),
32
+ });
33
+ const createTaskDependencySchema = z.object({
34
+ task_id: z.string().min(1, 'Task ID is required (the blocker)'),
35
+ dependent_task_id: z.string().min(1, 'Dependent task ID is required (the blocked task)'),
36
+ type_id: z
37
+ .number()
38
+ .min(1)
39
+ .max(3)
40
+ .default(1)
41
+ .describe('1 = blocks (finish to start), 2 = is blocked by, 3 = related to'),
42
+ });
43
+ const deleteTaskDependencySchema = z.object({
44
+ dependency_id: z.string().min(1, 'Dependency ID is required'),
45
+ });
46
+ // ---- Handlers ----
47
+ export async function listTaskDependenciesTool(client, args) {
48
+ try {
49
+ const params = listTaskDependenciesSchema.parse(args || {});
50
+ const response = await client.listTaskDependencies({
51
+ task_id: params.task_id,
52
+ dependent_task_id: params.dependent_task_id,
53
+ limit: params.limit,
54
+ });
55
+ if (!response.data || response.data.length === 0) {
56
+ return {
57
+ content: [
58
+ {
59
+ type: 'text',
60
+ text: 'No task dependencies found.',
61
+ },
62
+ ],
63
+ };
64
+ }
65
+ const depsText = response.data
66
+ .map((dep) => {
67
+ const taskId = dep.relationships?.task?.data?.id;
68
+ const depTaskId = dep.relationships?.dependent_task?.data?.id;
69
+ const taskTitle = resolveTaskTitle(taskId, response.included);
70
+ const depTaskTitle = resolveTaskTitle(depTaskId, response.included);
71
+ const typeLabel = dependencyTypeLabel(dep.attributes.type_id);
72
+ const taskDisplay = taskTitle ? `${taskTitle} (ID: ${taskId})` : `Task ${taskId}`;
73
+ const depDisplay = depTaskTitle
74
+ ? `${depTaskTitle} (ID: ${depTaskId})`
75
+ : `Task ${depTaskId}`;
76
+ return `- Dependency ID: ${dep.id}\n ${taskDisplay} → ${typeLabel} → ${depDisplay}\n Type ID: ${dep.attributes.type_id}`;
77
+ })
78
+ .join('\n\n');
79
+ return {
80
+ content: [
81
+ {
82
+ type: 'text',
83
+ text: `Found ${response.data.length} dependency(ies):\n\n${depsText}`,
84
+ },
85
+ ],
86
+ };
87
+ }
88
+ catch (error) {
89
+ throw toMcpError(error);
90
+ }
91
+ }
92
+ export async function getTaskDependencyTool(client, args) {
93
+ try {
94
+ const params = getTaskDependencySchema.parse(args);
95
+ const response = await client.getTaskDependency(params.dependency_id);
96
+ const dep = response.data;
97
+ const taskId = dep.relationships?.task?.data?.id;
98
+ const depTaskId = dep.relationships?.dependent_task?.data?.id;
99
+ const taskTitle = resolveTaskTitle(taskId, response.included);
100
+ const depTaskTitle = resolveTaskTitle(depTaskId, response.included);
101
+ const typeLabel = dependencyTypeLabel(dep.attributes.type_id);
102
+ let text = `Dependency ID: ${dep.id}\n`;
103
+ text += `Type: ${typeLabel} (type_id: ${dep.attributes.type_id})\n`;
104
+ text += `Task: ${taskTitle || 'Unknown'} (ID: ${taskId})\n`;
105
+ text += `Dependent task: ${depTaskTitle || 'Unknown'} (ID: ${depTaskId})\n`;
106
+ if (dep.attributes.created_at)
107
+ text += `Created at: ${dep.attributes.created_at}`;
108
+ return { content: [{ type: 'text', text }] };
109
+ }
110
+ catch (error) {
111
+ throw toMcpError(error);
112
+ }
113
+ }
114
+ export async function createTaskDependencyTool(client, args) {
115
+ try {
116
+ const params = createTaskDependencySchema.parse(args);
117
+ const response = await client.createTaskDependency({
118
+ data: {
119
+ type: 'task_dependencies',
120
+ attributes: {
121
+ task_id: params.task_id,
122
+ dependent_task_id: params.dependent_task_id,
123
+ type_id: params.type_id.toString(),
124
+ },
125
+ },
126
+ });
127
+ const dep = response.data;
128
+ const typeLabel = dependencyTypeLabel(dep.attributes.type_id);
129
+ let text = `Task dependency created successfully!\n`;
130
+ text += `Dependency ID: ${dep.id}\n`;
131
+ text += `Type: ${typeLabel}\n`;
132
+ text += `Task ${params.task_id} → ${typeLabel} → Task ${params.dependent_task_id}`;
133
+ return { content: [{ type: 'text', text }] };
134
+ }
135
+ catch (error) {
136
+ throw toMcpError(error);
137
+ }
138
+ }
139
+ export async function deleteTaskDependencyTool(client, args) {
140
+ try {
141
+ const params = deleteTaskDependencySchema.parse(args);
142
+ await client.deleteTaskDependency(params.dependency_id);
143
+ return {
144
+ content: [
145
+ {
146
+ type: 'text',
147
+ text: `Task dependency ${params.dependency_id} deleted successfully.`,
148
+ },
149
+ ],
150
+ };
151
+ }
152
+ catch (error) {
153
+ throw toMcpError(error);
154
+ }
155
+ }
156
+ // ---- Definitions ----
157
+ export const listTaskDependenciesDefinition = {
158
+ name: 'list_task_dependencies',
159
+ description: 'List task dependencies (blockers/related tasks). Filter by task_id to see what a task blocks, or dependent_task_id to see what blocks a task.',
160
+ inputSchema: {
161
+ type: 'object',
162
+ properties: {
163
+ task_id: {
164
+ type: 'string',
165
+ description: 'Filter by source task ID — shows tasks that this task blocks',
166
+ },
167
+ dependent_task_id: {
168
+ type: 'string',
169
+ description: 'Filter by dependent task ID — shows tasks that block this task',
170
+ },
171
+ limit: {
172
+ type: 'number',
173
+ description: 'Number of results to return (1-200, default: 50)',
174
+ },
175
+ },
176
+ },
177
+ annotations: { title: 'List task dependencies', readOnlyHint: true, openWorldHint: true },
178
+ };
179
+ export const getTaskDependencyDefinition = {
180
+ name: 'get_task_dependency',
181
+ description: 'Get details of a specific task dependency by ID.',
182
+ inputSchema: {
183
+ type: 'object',
184
+ properties: {
185
+ dependency_id: {
186
+ type: 'string',
187
+ description: 'ID of the task dependency to retrieve (required)',
188
+ },
189
+ },
190
+ required: ['dependency_id'],
191
+ },
192
+ annotations: { title: 'Get task dependency', readOnlyHint: true, openWorldHint: true },
193
+ };
194
+ export const createTaskDependencyDefinition = {
195
+ name: 'create_task_dependency',
196
+ description: 'Create a dependency between two tasks. Use type_id 1 for "blocks" (task must finish before dependent_task can start), 2 for "is blocked by", 3 for "related to".',
197
+ inputSchema: {
198
+ type: 'object',
199
+ properties: {
200
+ task_id: {
201
+ type: 'string',
202
+ description: 'ID of the source task (the blocker) — required',
203
+ },
204
+ dependent_task_id: {
205
+ type: 'string',
206
+ description: 'ID of the dependent task (the blocked task) — required',
207
+ },
208
+ type_id: {
209
+ type: 'number',
210
+ description: 'Dependency type: 1 = blocks (finish to start), 2 = is blocked by, 3 = related to. Default: 1',
211
+ default: 1,
212
+ },
213
+ },
214
+ required: ['task_id', 'dependent_task_id'],
215
+ },
216
+ annotations: {
217
+ title: 'Create task dependency',
218
+ readOnlyHint: false,
219
+ destructiveHint: false,
220
+ idempotentHint: false,
221
+ openWorldHint: true,
222
+ },
223
+ };
224
+ export const deleteTaskDependencyDefinition = {
225
+ name: 'delete_task_dependency',
226
+ description: 'Delete a task dependency by ID.',
227
+ inputSchema: {
228
+ type: 'object',
229
+ properties: {
230
+ dependency_id: {
231
+ type: 'string',
232
+ description: 'ID of the task dependency to delete (required)',
233
+ },
234
+ },
235
+ required: ['dependency_id'],
236
+ },
237
+ annotations: {
238
+ title: 'Delete task dependency',
239
+ readOnlyHint: false,
240
+ destructiveHint: true,
241
+ idempotentHint: true,
242
+ openWorldHint: true,
243
+ },
244
+ };
@@ -0,0 +1,65 @@
1
+ import { z } from 'zod';
2
+ import { toMcpError } from '../utils/errors.js';
3
+ const moveTaskToListSchema = z.object({
4
+ task_id: z.string().describe('ID of the task to move'),
5
+ task_list_id: z.string().describe('ID of the task list to move the task to'),
6
+ });
7
+ export async function moveTaskToList(client, args) {
8
+ try {
9
+ const { task_id, task_list_id } = moveTaskToListSchema.parse(args);
10
+ // Update the task's task_list relationship
11
+ const response = await client.updateTask(task_id, {
12
+ data: {
13
+ type: 'tasks',
14
+ id: task_id,
15
+ relationships: {
16
+ task_list: {
17
+ data: {
18
+ type: 'task_lists',
19
+ id: task_list_id,
20
+ },
21
+ },
22
+ },
23
+ },
24
+ });
25
+ return {
26
+ content: [
27
+ {
28
+ type: 'text',
29
+ text: `✅ Moved task ${task_id} to task list ${task_list_id}`,
30
+ },
31
+ ],
32
+ };
33
+ }
34
+ catch (error) {
35
+ throw toMcpError(error);
36
+ }
37
+ }
38
+ export const moveTaskToListTool = {
39
+ name: 'move_task_to_list',
40
+ description: 'Move a task into a specific task list by ID, changing which list it belongs to (e.g. from "To Do" to "In Review"). ' +
41
+ "Use this when you already know the destination task_list_id; use add_to_backlog to park a task in the project's " +
42
+ 'Backlog without knowing its list ID, or reposition_task to reorder a task within its current list. ' +
43
+ "Does not change the task's assignee or status.",
44
+ inputSchema: {
45
+ type: 'object',
46
+ properties: {
47
+ task_id: {
48
+ type: 'string',
49
+ description: 'ID of the task to move',
50
+ },
51
+ task_list_id: {
52
+ type: 'string',
53
+ description: 'ID of the destination task list (must belong to the same project as the task)',
54
+ },
55
+ },
56
+ required: ['task_id', 'task_list_id'],
57
+ },
58
+ annotations: {
59
+ title: 'Move task to list',
60
+ readOnlyHint: false,
61
+ destructiveHint: false,
62
+ idempotentHint: true,
63
+ openWorldHint: true,
64
+ },
65
+ };