@dod/planax-mcp 0.1.5 → 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.
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { successResponse, errorResponse } from './types.js';
3
+ import { TaskPrioritySchema, TaskStatusSchema } from './shared.js';
3
4
  /**
4
5
  * Task Tools Module
5
6
  *
@@ -15,8 +16,9 @@ export function register({ server, apiClient }) {
15
16
 
16
17
  **When to use:**
17
18
  - View all tasks in a project
18
- - Filter tasks by status (TODO, IN_PROGRESS, COMPLETED, etc.)
19
+ - Filter tasks by status (TODO, IN_PROGRESS, BLOCKED, DONE, CLOSED)
19
20
  - Find tasks assigned to a specific user
21
+ - Find tasks due by a date, or with risk/order issues
20
22
  - Search tasks by title or description
21
23
 
22
24
  **Examples:**
@@ -32,21 +34,26 @@ export function register({ server, apiClient }) {
32
34
  4. Search tasks:
33
35
  { projectId: "...", search: "review" }
34
36
 
35
- 5. With pagination:
37
+ 5. Due by the end of January:
38
+ { projectId: "...", dueDateBefore: "2027-01-31" }
39
+
40
+ 6. With pagination:
36
41
  { projectId: "...", page: 1, limit: 20 }
37
42
 
38
- **Returns:** Paginated list of tasks with metadata (total, page, totalPages)`,
43
+ **Returns:** Paginated list of top-level tasks (total, page, totalPages count top-level tasks only).
44
+ Subtasks are inside each task's \`subTasks\`. Tasks completed a while ago are hidden here; see task_list_hidden_completed.`,
39
45
  inputSchema: {
40
46
  projectId: z.string().uuid().describe('Project ID (UUID) - required'),
41
- status: z
42
- .enum(['TODO', 'IN_PROGRESS', 'BLOCKED', 'DONE', 'CLOSED'])
47
+ status: TaskStatusSchema
43
48
  .optional()
44
49
  .describe('Filter by task status'),
45
50
  assigneeId: z.string().uuid().optional().describe('Filter by assignee user ID'),
46
- priority: z
47
- .enum(['LOW', 'MEDIUM', 'HIGH', 'URGENT'])
51
+ priority: TaskPrioritySchema
48
52
  .optional()
49
53
  .describe('Filter by priority'),
54
+ dueDateBefore: z.string().optional().describe('Due date on or before this date (YYYY-MM-DD)'),
55
+ riskyIssueOnly: z.boolean().optional().describe('Only tasks with guideline (risk) issues'),
56
+ orderIssueOnly: z.boolean().optional().describe('Only tasks with order issues'),
50
57
  search: z.string().optional().describe('Search in title and description'),
51
58
  sortBy: z
52
59
  .enum(['createdAt', 'dueDate', 'priority', 'title'])
@@ -56,7 +63,7 @@ export function register({ server, apiClient }) {
56
63
  page: z.number().int().min(1).optional().describe('Page number (default: 1)'),
57
64
  limit: z.number().int().min(1).max(100).optional().describe('Items per page (default: 20, max: 100)'),
58
65
  },
59
- }, async ({ projectId, status, assigneeId, priority, search, sortBy, sortOrder, page, limit }) => {
66
+ }, async ({ projectId, status, assigneeId, priority, dueDateBefore, riskyIssueOnly, orderIssueOnly, search, sortBy, sortOrder, page, limit }) => {
60
67
  try {
61
68
  const params = new URLSearchParams({ projectId });
62
69
  if (status)
@@ -65,6 +72,12 @@ export function register({ server, apiClient }) {
65
72
  params.append('assigneeId', assigneeId);
66
73
  if (priority)
67
74
  params.append('priority', priority);
75
+ if (dueDateBefore)
76
+ params.append('dueDateBefore', dueDateBefore);
77
+ if (riskyIssueOnly)
78
+ params.append('riskyIssueOnly', 'true');
79
+ if (orderIssueOnly)
80
+ params.append('orderIssueOnly', 'true');
68
81
  if (search)
69
82
  params.append('search', search);
70
83
  if (sortBy)
@@ -93,14 +106,15 @@ export function register({ server, apiClient }) {
93
106
 
94
107
  **Examples:**
95
108
  1. Get task details:
96
- { taskId: "task-uuid" }
97
-
98
- **Returns:** Task object with all fields including:
99
- - id, title, description, status, priority
100
- - assignee, creator (user info)
101
- - startDate, dueDate
102
- - tags
103
- - parentTask, subTasks (if any)`,
109
+ { projectId: "...", taskId: "..." }
110
+
111
+ **Returns:** Task object:
112
+ - id, title, description, status, priority, tags
113
+ - assigneeId, assigneeName, createdBy, creatorName
114
+ - startDate, dueDate, completedDate
115
+ - parentTaskId, subTaskCount, subTasks
116
+ - phaseId, phasePath, riskAlerts, createdAt, updatedAt
117
+ A deleted task returns 404.`,
104
118
  inputSchema: {
105
119
  projectId: z.string().uuid().describe('Project ID (UUID)'),
106
120
  taskId: z.string().uuid().describe('Task ID (UUID)'),
@@ -123,7 +137,11 @@ export function register({ server, apiClient }) {
123
137
  - Create a task with full details (assignee, due date, priority)
124
138
  - Create sub-tasks under a parent task
125
139
 
126
- **Note:** For creating tasks within a Plan structure, use \`plan_create_task\` instead.
140
+ **Note:**
141
+ - For creating tasks within a Plan structure, use \`plan_create_task\` instead.
142
+ - Subtasks go one level deep only (a subtask cannot have subtasks).
143
+ - The assignee must be a project member (find ids with project_list_members).
144
+ - Dates are YYYY-MM-DD; a wrong format fails with 400.
127
145
 
128
146
  **Examples:**
129
147
  1. Simple task:
@@ -153,10 +171,9 @@ export function register({ server, apiClient }) {
153
171
  title: z.string().min(1).max(255).describe('Task title (required, 1-255 chars)'),
154
172
  description: z.string().max(5000).optional().describe('Task description (max 5000 chars)'),
155
173
  assigneeId: z.string().uuid().optional().describe('Assignee user ID (must be project member)'),
156
- startDate: z.string().optional().describe('Start date (ISO 8601 format, e.g., 2024-01-15)'),
157
- dueDate: z.string().optional().describe('Due date (ISO 8601 format)'),
158
- priority: z
159
- .enum(['LOW', 'MEDIUM', 'HIGH', 'URGENT'])
174
+ startDate: z.string().optional().describe('Start date (YYYY-MM-DD)'),
175
+ dueDate: z.string().optional().describe('Due date (YYYY-MM-DD)'),
176
+ priority: TaskPrioritySchema
160
177
  .optional()
161
178
  .describe('Task priority (default: MEDIUM)'),
162
179
  tags: z.array(z.string()).optional().describe('Tags for categorization'),
@@ -188,31 +205,37 @@ export function register({ server, apiClient }) {
188
205
  **When to use:**
189
206
  - Change task title or description
190
207
  - Update task status (TODO -> IN_PROGRESS -> DONE)
191
- - Reassign task to different user
192
- - Update due date or priority
208
+ - Reassign or unassign
209
+ - Update dates or priority, move under another parent task
193
210
  - Add or modify tags
194
211
 
212
+ **Note:**
213
+ - Setting status to DONE or CLOSED records completedDate automatically; moving back clears it.
214
+ - Send null for assigneeId, startDate, dueDate or completedDate to clear it. Dates are YYYY-MM-DD.
215
+ - A blank title is rejected.
216
+
195
217
  **Examples:**
196
218
  1. Update status:
197
- { taskId: "...", status: "IN_PROGRESS" }
219
+ { projectId: "...", taskId: "...", status: "IN_PROGRESS" }
198
220
 
199
221
  2. Reassign task:
200
- { taskId: "...", assigneeId: "new-user-uuid" }
222
+ { projectId: "...", taskId: "...", assigneeId: "new-user-uuid" }
201
223
 
202
224
  3. Update multiple fields:
203
225
  {
226
+ projectId: "...",
204
227
  taskId: "...",
205
228
  title: "Updated title",
206
229
  description: "New description",
207
- priority: "URGENT",
230
+ priority: "HIGH",
208
231
  dueDate: "2024-02-28"
209
232
  }
210
233
 
211
234
  4. Complete a task:
212
- { taskId: "...", status: "DONE" }
235
+ { projectId: "...", taskId: "...", status: "DONE" }
213
236
 
214
- 5. Update tags:
215
- { taskId: "...", tags: ["review", "approved"] }
237
+ 5. Clear the due date:
238
+ { projectId: "...", taskId: "...", dueDate: null }
216
239
 
217
240
  **Returns:** Updated task object`,
218
241
  inputSchema: {
@@ -220,35 +243,21 @@ export function register({ server, apiClient }) {
220
243
  taskId: z.string().uuid().describe('Task ID (UUID) - required'),
221
244
  title: z.string().min(1).max(255).optional().describe('New task title'),
222
245
  description: z.string().max(5000).optional().describe('New task description'),
223
- status: z
224
- .enum(['TODO', 'IN_PROGRESS', 'BLOCKED', 'DONE', 'CLOSED'])
246
+ status: TaskStatusSchema
225
247
  .optional()
226
248
  .describe('New task status'),
227
249
  assigneeId: z.string().uuid().nullable().optional().describe('New assignee ID (null to unassign)'),
228
- startDate: z.string().nullable().optional().describe('Start date (ISO 8601 format, null to clear)'),
229
- dueDate: z.string().nullable().optional().describe('Due date (ISO 8601 format, null to clear)'),
230
- priority: z.enum(['LOW', 'MEDIUM', 'HIGH', 'URGENT']).optional().describe('New priority'),
250
+ startDate: z.string().nullable().optional().describe('Start date (YYYY-MM-DD), null to clear'),
251
+ dueDate: z.string().nullable().optional().describe('Due date (YYYY-MM-DD), null to clear'),
252
+ completedDate: z.string().nullable().optional().describe('Completed date (YYYY-MM-DD), null to clear'),
253
+ priority: TaskPrioritySchema.optional().describe('New priority (HIGH, MEDIUM, LOW)'),
254
+ parentTaskId: z.string().uuid().optional().describe('Move under this parent task'),
231
255
  tags: z.array(z.string()).optional().describe('New tags (replaces existing)'),
232
256
  },
233
- }, async ({ projectId, taskId, title, description, status, assigneeId, startDate, dueDate, priority, tags }) => {
257
+ }, async ({ projectId, taskId, ...fields }) => {
234
258
  try {
235
- const updateData = {};
236
- if (title !== undefined)
237
- updateData.title = title;
238
- if (description !== undefined)
239
- updateData.description = description;
240
- if (status !== undefined)
241
- updateData.status = status;
242
- if (assigneeId !== undefined)
243
- updateData.assigneeId = assigneeId;
244
- if (startDate !== undefined)
245
- updateData.startDate = startDate;
246
- if (dueDate !== undefined)
247
- updateData.dueDate = dueDate;
248
- if (priority !== undefined)
249
- updateData.priority = priority;
250
- if (tags !== undefined)
251
- updateData.tags = tags;
259
+ // undefined 만 빼고 보낸다. null 은 지우기라 그대로 보낸다
260
+ const updateData = Object.fromEntries(Object.entries(fields).filter(([, v]) => v !== undefined));
252
261
  const result = await apiClient.patch(`/projects/${projectId}/tasks/${taskId}`, updateData);
253
262
  return successResponse(result, 'Task updated successfully');
254
263
  }
@@ -262,14 +271,15 @@ export function register({ server, apiClient }) {
262
271
 
263
272
  **When to use:**
264
273
  - Remove a task that is no longer needed
265
- - Archive completed tasks
266
- - Clean up cancelled tasks
267
274
 
268
- **Note:** This is a soft delete - the task can be restored later using \`task_restore\`.
275
+ **Note:**
276
+ - The task moves to the trash; restore it with task_restore using the same taskId.
277
+ - Only the creator or a project manager can delete. A task that has subtasks cannot be deleted (400).
278
+ - Resource links pointing to the task are cleaned up.
269
279
 
270
280
  **Examples:**
271
281
  1. Delete a task:
272
- { taskId: "task-uuid" }
282
+ { projectId: "...", taskId: "..." }
273
283
 
274
284
  **Returns:** Success confirmation`,
275
285
  inputSchema: {
@@ -290,12 +300,16 @@ export function register({ server, apiClient }) {
290
300
  description: `Restore a deleted task.
291
301
 
292
302
  **When to use:**
293
- - Recover a task that was accidentally deleted
294
- - Unarchive a task that needs to be worked on again
303
+ - Recover a task that was deleted by mistake
304
+
305
+ **Note:**
306
+ - Use the same taskId that was deleted (there is no list of deleted tasks).
307
+ - Only the creator or a project manager can restore.
308
+ - A subtask whose parent is still deleted cannot be restored; restore the parent first.
295
309
 
296
310
  **Examples:**
297
311
  1. Restore a task:
298
- { taskId: "task-uuid" }
312
+ { projectId: "...", taskId: "..." }
299
313
 
300
314
  **Returns:** Restored task object`,
301
315
  inputSchema: {
@@ -368,10 +382,10 @@ export function register({ server, apiClient }) {
368
382
 
369
383
  **Examples:**
370
384
  1. Assign task:
371
- { taskId: "...", assigneeId: "user-uuid" }
385
+ { projectId: "...", taskId: "...", assigneeId: "user-uuid" }
372
386
 
373
387
  2. Unassign task:
374
- { taskId: "...", assigneeId: null }
388
+ { projectId: "...", taskId: "...", assigneeId: null }
375
389
 
376
390
  **Returns:** Updated task with new assignee`,
377
391
  inputSchema: {
@@ -381,9 +395,11 @@ export function register({ server, apiClient }) {
381
395
  },
382
396
  }, async ({ projectId, taskId, assigneeId }) => {
383
397
  try {
384
- const result = await apiClient.patch(`/projects/${projectId}/tasks/${taskId}/assign`, { assigneeId });
385
- const action = assigneeId ? 'assigned' : 'unassigned';
386
- return successResponse(result, `Task ${action} successfully`);
398
+ // /assign 은 null 을 받지 않는다 (AssignTaskRequest.assigneeId non-null). 해제는 업무 수정 API 에 null 을 보낸다
399
+ const result = assigneeId
400
+ ? await apiClient.patch(`/projects/${projectId}/tasks/${taskId}/assign`, { assigneeId })
401
+ : await apiClient.patch(`/projects/${projectId}/tasks/${taskId}`, { assigneeId: null });
402
+ return successResponse(result, `Task ${assigneeId ? 'assigned' : 'unassigned'} successfully`);
387
403
  }
388
404
  catch (error) {
389
405
  return errorResponse(error);
@@ -34,4 +34,63 @@ export function register({ server, apiClient }) {
34
34
  return errorResponse(error);
35
35
  }
36
36
  });
37
+ server.registerTool('workspace_list_members', {
38
+ description: `List members of a workspace.
39
+
40
+ **When to use:**
41
+ - Find a user id across the workspace (project_list_members is narrower and is what assignee/mention need)
42
+
43
+ **Returns:** Array of members: { id (membership id), userId, user { id, name, email, ... }, role, joinedAt }.`,
44
+ inputSchema: {
45
+ workspaceId: z.string().uuid().describe('Workspace ID (UUID)'),
46
+ },
47
+ }, async ({ workspaceId }) => {
48
+ try {
49
+ const result = await apiClient.get(`/workspaces/${workspaceId}/members`);
50
+ return successResponse(result);
51
+ }
52
+ catch (error) {
53
+ return errorResponse(error);
54
+ }
55
+ });
56
+ server.registerTool('workspace_list_templates', {
57
+ description: `List plan templates of a workspace.
58
+
59
+ **When to use:**
60
+ - Find a template id to pass to plan_create (only active templates can be used; an inactive one fails with 400)
61
+
62
+ **Returns:** Array of templates { id, name, description, category, isDefault, isActive, createdAt, updatedAt }.
63
+ The template structure is left out here because it is large; use workspace_get_template to see it.`,
64
+ inputSchema: {
65
+ workspaceId: z.string().uuid().describe('Workspace ID (UUID)'),
66
+ includeInactive: z.boolean().optional().describe('Include inactive templates (default false)'),
67
+ },
68
+ }, async ({ workspaceId, includeInactive }) => {
69
+ try {
70
+ const query = includeInactive ? '?includeInactive=true' : '';
71
+ const result = await apiClient.get(`/workspaces/${workspaceId}/templates${query}`);
72
+ const list = Array.isArray(result) ? result.map(({ structure: _structure, ...rest }) => rest) : result;
73
+ return successResponse(list);
74
+ }
75
+ catch (error) {
76
+ return errorResponse(error);
77
+ }
78
+ });
79
+ server.registerTool('workspace_get_template', {
80
+ description: `Get one plan template including its structure (phases, folders, documents it creates).
81
+
82
+ **Returns:** { id, name, description, category, structure, isDefault, isActive, createdAt, updatedAt }`,
83
+ inputSchema: {
84
+ workspaceId: z.string().uuid().describe('Workspace ID (UUID)'),
85
+ templateId: z.string().min(1).max(50).describe('Template id (not always a UUID)'),
86
+ },
87
+ }, async ({ workspaceId, templateId }) => {
88
+ try {
89
+ const result = await apiClient.get(`/workspaces/${workspaceId}/templates/${encodeURIComponent(templateId)}`);
90
+ return successResponse(result);
91
+ }
92
+ catch (error) {
93
+ return errorResponse(error);
94
+ }
95
+ });
37
96
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dod/planax-mcp",
3
- "version": "0.1.5",
3
+ "version": "0.2.0",
4
4
  "description": "PlanAX MCP Server - Access projects, documents, and tasks via Model Context Protocol",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -21,7 +21,8 @@
21
21
  "start:http": "node dist/index.js --http",
22
22
  "lint": "eslint src --ext .ts",
23
23
  "typecheck": "tsc --noEmit",
24
- "prepublishOnly": "npm run typecheck && npm run build"
24
+ "test": "vitest run",
25
+ "prepublishOnly": "npm run typecheck && npm run test && npm run build"
25
26
  },
26
27
  "keywords": [
27
28
  "mcp",
@@ -41,7 +42,8 @@
41
42
  "devDependencies": {
42
43
  "@types/node": "^22.0.0",
43
44
  "tsx": "^4.19.0",
44
- "typescript": "^5.7.0"
45
+ "typescript": "^5.7.0",
46
+ "vitest": "^2.1.9"
45
47
  },
46
48
  "engines": {
47
49
  "node": ">=18.0.0"