@mtaap/mcp 0.2.5 → 0.2.6

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/dist/cli.js CHANGED
@@ -28,7 +28,7 @@ var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
28
28
  var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
29
29
 
30
30
  // src/version.ts
31
- var VERSION = "0.2.5";
31
+ var VERSION = "0.2.6";
32
32
 
33
33
  // src/index.ts
34
34
  var import_zod3 = require("zod");
@@ -36,12 +36,20 @@ var import_zod3 = require("zod");
36
36
  // ../../packages/core/dist/constants/enums.js
37
37
  var TaskState;
38
38
  (function(TaskState2) {
39
+ TaskState2["DRAFT"] = "DRAFT";
40
+ TaskState2["TODO"] = "TODO";
39
41
  TaskState2["BACKLOG"] = "BACKLOG";
40
42
  TaskState2["READY"] = "READY";
41
43
  TaskState2["IN_PROGRESS"] = "IN_PROGRESS";
42
44
  TaskState2["REVIEW"] = "REVIEW";
43
45
  TaskState2["DONE"] = "DONE";
44
46
  })(TaskState || (TaskState = {}));
47
+ var VerificationStatus;
48
+ (function(VerificationStatus2) {
49
+ VerificationStatus2["PENDING"] = "PENDING";
50
+ VerificationStatus2["PASSED"] = "PASSED";
51
+ VerificationStatus2["NEEDS_REVISION"] = "NEEDS_REVISION";
52
+ })(VerificationStatus || (VerificationStatus = {}));
45
53
  var UserRole;
46
54
  (function(UserRole2) {
47
55
  UserRole2["ADMIN"] = "ADMIN";
@@ -106,6 +114,8 @@ var WebSocketEventType;
106
114
  WebSocketEventType2["TASK_COMPLETED"] = "task.completed";
107
115
  WebSocketEventType2["TASK_ERROR"] = "task.error";
108
116
  WebSocketEventType2["TASK_STATE_CHANGED"] = "task.state_changed";
117
+ WebSocketEventType2["TASK_UPDATED"] = "task.updated";
118
+ WebSocketEventType2["TASK_DELETED"] = "task.deleted";
109
119
  WebSocketEventType2["MEMBER_JOINED"] = "member.joined";
110
120
  })(WebSocketEventType || (WebSocketEventType = {}));
111
121
  var AuthProvider;
@@ -132,16 +142,20 @@ var EventType;
132
142
 
133
143
  // ../../packages/core/dist/constants/state-machine.js
134
144
  var VALID_TRANSITIONS = {
135
- [TaskState.BACKLOG]: [TaskState.READY],
136
- [TaskState.READY]: [TaskState.BACKLOG, TaskState.IN_PROGRESS],
145
+ [TaskState.DRAFT]: [TaskState.TODO],
146
+ [TaskState.TODO]: [TaskState.DRAFT, TaskState.IN_PROGRESS],
147
+ // Deprecated: BACKLOG transitions to DRAFT (its replacement)
148
+ [TaskState.BACKLOG]: [TaskState.DRAFT, TaskState.TODO],
149
+ // Deprecated: READY transitions to TODO (its replacement)
150
+ [TaskState.READY]: [TaskState.TODO, TaskState.IN_PROGRESS],
137
151
  [TaskState.IN_PROGRESS]: [
138
- TaskState.BACKLOG,
139
- TaskState.READY,
152
+ TaskState.DRAFT,
153
+ TaskState.TODO,
140
154
  TaskState.REVIEW
141
155
  ],
142
156
  [TaskState.REVIEW]: [
143
- TaskState.BACKLOG,
144
- TaskState.READY,
157
+ TaskState.DRAFT,
158
+ TaskState.TODO,
145
159
  TaskState.IN_PROGRESS,
146
160
  TaskState.DONE
147
161
  ],
@@ -412,7 +426,7 @@ var GetTaskInputSchema = import_zod2.z.object({
412
426
  var AssignTaskInputSchema = import_zod2.z.object({
413
427
  projectId: cuidOrPrefixedId,
414
428
  taskId: cuidOrPrefixedId,
415
- expectedState: import_zod2.z.nativeEnum(TaskState).default(TaskState.READY)
429
+ expectedState: import_zod2.z.nativeEnum(TaskState).default(TaskState.TODO)
416
430
  });
417
431
  var UpdateProgressInputSchema = import_zod2.z.object({
418
432
  taskId: cuidOrPrefixedId,
@@ -596,6 +610,27 @@ var RegisterInputSchema = import_zod2.z.object({
596
610
  name: import_zod2.z.string().min(1).max(255),
597
611
  organizationSlug: import_zod2.z.string().min(1).max(100).regex(/^[a-z0-9-]+$/).optional()
598
612
  });
613
+ var VerifyTaskInputSchema = import_zod2.z.object({
614
+ projectId: cuidOrPrefixedId,
615
+ taskId: cuidOrPrefixedId,
616
+ approved: import_zod2.z.boolean(),
617
+ feedback: import_zod2.z.string().max(5e3).optional()
618
+ });
619
+ var GetTaskPromptInputSchema = import_zod2.z.object({
620
+ projectId: cuidOrPrefixedId,
621
+ taskId: cuidOrPrefixedId
622
+ });
623
+ var UpdateTaskMCPInputSchema = import_zod2.z.object({
624
+ projectId: cuidOrPrefixedId,
625
+ taskId: cuidOrPrefixedId,
626
+ title: import_zod2.z.string().min(1).max(200).optional(),
627
+ description: import_zod2.z.string().max(5e3).optional(),
628
+ priority: import_zod2.z.nativeEnum(TaskPriority).optional(),
629
+ acceptanceCriteria: import_zod2.z.array(import_zod2.z.object({
630
+ id: import_zod2.z.string().optional(),
631
+ description: import_zod2.z.string().min(1).max(500)
632
+ })).optional()
633
+ });
599
634
 
600
635
  // ../../packages/core/dist/logging/metrics.js
601
636
  var metrics = /* @__PURE__ */ new Map();
@@ -1045,7 +1080,7 @@ var MCPApiClient = class {
1045
1080
  /**
1046
1081
  * Assign task to current user and create branch
1047
1082
  */
1048
- async assignTask(taskId, projectId, expectedState = TaskState.READY) {
1083
+ async assignTask(taskId, projectId, expectedState = TaskState.TODO) {
1049
1084
  return this.request("POST", `/api/mcp/tasks/${taskId}/assign`, {
1050
1085
  projectId,
1051
1086
  expectedState
@@ -1134,6 +1169,34 @@ var MCPApiClient = class {
1134
1169
  const path = organizationId ? `/api/mcp/github-token?organizationId=${encodeURIComponent(organizationId)}` : "/api/mcp/github-token";
1135
1170
  return this.request("GET", path);
1136
1171
  }
1172
+ /**
1173
+ * Verify a DRAFT task to move it to TODO state
1174
+ */
1175
+ async verifyTask(taskId, projectId, approved, feedback) {
1176
+ return this.request("POST", `/api/mcp/tasks/${taskId}/verify`, {
1177
+ projectId,
1178
+ approved,
1179
+ feedback
1180
+ });
1181
+ }
1182
+ /**
1183
+ * Get state-appropriate prompt for a task
1184
+ */
1185
+ async getTaskPrompt(taskId, projectId) {
1186
+ return this.request(
1187
+ "GET",
1188
+ `/api/mcp/tasks/${taskId}/prompt?projectId=${encodeURIComponent(projectId)}`
1189
+ );
1190
+ }
1191
+ /**
1192
+ * Update task details (DRAFT/TODO states only)
1193
+ */
1194
+ async updateTask(taskId, projectId, data) {
1195
+ return this.request("PATCH", `/api/mcp/tasks/${taskId}`, {
1196
+ projectId,
1197
+ ...data
1198
+ });
1199
+ }
1137
1200
  };
1138
1201
  function createApiClientFromEnv() {
1139
1202
  const baseUrl = process.env.COLLAB_BASE_URL;
@@ -1185,40 +1248,54 @@ TOOL CATEGORIES:
1185
1248
  - list_projects, get_project_context, get_version
1186
1249
 
1187
1250
  2. Task Management (READ/WRITE):
1188
- - list_tasks, get_task, create_task, archive_task, unarchive_task
1251
+ - list_tasks, get_task, create_task, update_task, archive_task, unarchive_task
1189
1252
 
1190
- 3. Task Execution (WRITE):
1253
+ 3. Task Verification (WRITE):
1254
+ - verify_task, get_task_prompt
1255
+
1256
+ 4. Task Execution (WRITE):
1191
1257
  - assign_task, update_progress, add_note, complete_task, abandon_task, report_error
1192
1258
 
1193
- 4. Code Review (WRITE):
1259
+ 5. Code Review (WRITE):
1194
1260
  - request_changes, approve_task
1195
1261
 
1196
- 5. Session Management (READ):
1262
+ 6. Session Management (READ):
1197
1263
  - check_active_task
1198
1264
 
1199
1265
  WORKFLOWS:
1200
1266
 
1267
+ Task Creation & Verification:
1268
+ create_task -> get_task_prompt (DRAFT) -> verify_task(approved=true) -> task moves to TODO
1269
+
1201
1270
  Standard Task Workflow:
1202
- list_projects -> get_project_context -> list_tasks(state=READY) -> get_task -> assign_task -> [update_progress...] -> complete_task
1271
+ list_projects -> get_project_context -> list_tasks(state=TODO) -> get_task -> get_task_prompt (TODO) -> assign_task -> [update_progress...] -> complete_task
1203
1272
 
1204
1273
  Resume Workflow:
1205
- check_active_task -> (if active) get_task -> update_progress -> complete_task
1274
+ check_active_task -> (if active) get_task -> get_task_prompt (IN_PROGRESS) -> update_progress -> complete_task
1206
1275
 
1207
1276
  Review Workflow:
1208
1277
  list_tasks(state=REVIEW) -> get_task -> approve_task OR request_changes
1209
1278
 
1279
+ Task Editing:
1280
+ update_task (DRAFT/TODO only) -> if was TODO, reverts to DRAFT -> verify_task again
1281
+
1210
1282
  Error Recovery:
1211
1283
  report_error -> abandon_task(deleteBranch=false) -> list_tasks -> assign_task (retry or pick different task)
1212
- (abandon_task returns IN_PROGRESS tasks to READY state)
1284
+ (abandon_task returns IN_PROGRESS tasks to TODO state)
1213
1285
 
1214
1286
  TASK STATE FLOW:
1215
- BACKLOG -> READY -> IN_PROGRESS -> REVIEW -> DONE
1287
+ DRAFT -> TODO -> IN_PROGRESS -> REVIEW -> DONE
1288
+ (verify_task: DRAFT -> TODO)
1289
+ (update_task on TODO: reverts to DRAFT)
1216
1290
  (request_changes: REVIEW -> IN_PROGRESS)
1217
- (abandon_task: IN_PROGRESS -> READY)
1291
+ (abandon_task: IN_PROGRESS -> TODO)
1218
1292
 
1219
1293
  CONSTRAINTS:
1294
+ - DRAFT tasks must be verified before assignment
1295
+ - verify_task requires programmatic validation (title 10+ chars, description 50+ chars, criteria 20+ chars each)
1296
+ - update_task only works on DRAFT and TODO states
1220
1297
  - assign_task is atomic - fails if already claimed
1221
- - Only READY tasks can be assigned
1298
+ - Only TODO tasks can be assigned
1222
1299
  - complete_task requires IN_PROGRESS state
1223
1300
  - request_changes/approve_task require REVIEW state
1224
1301
  - Always check_active_task before starting new work
@@ -1279,7 +1356,7 @@ async function createMCPServer() {
1279
1356
  server.registerTool(
1280
1357
  "list_tasks",
1281
1358
  {
1282
- description: "Query tasks with filters. Use state=READY for assignable tasks, state=REVIEW for pending reviews.",
1359
+ description: "Query tasks with filters. Use state=TODO for assignable tasks, state=REVIEW for pending reviews.",
1283
1360
  inputSchema: {
1284
1361
  projectId: import_zod3.z.string().optional().describe("Filter by project ID"),
1285
1362
  state: import_zod3.z.nativeEnum(TaskState).optional().describe("Filter by task state"),
@@ -1339,11 +1416,11 @@ async function createMCPServer() {
1339
1416
  server.registerTool(
1340
1417
  "assign_task",
1341
1418
  {
1342
- description: "Atomically claim a task and create git branch. Race-safe - fails if already assigned. Task must be READY.",
1419
+ description: "Atomically claim a task and create git branch. Race-safe - fails if already assigned. Task must be TODO.",
1343
1420
  inputSchema: {
1344
1421
  projectId: import_zod3.z.string().describe("The project ID"),
1345
1422
  taskId: import_zod3.z.string().describe("The task ID to assign"),
1346
- expectedState: import_zod3.z.nativeEnum(TaskState).optional().describe("Expected task state (default: READY)")
1423
+ expectedState: import_zod3.z.nativeEnum(TaskState).optional().describe("Expected task state (default: TODO)")
1347
1424
  }
1348
1425
  },
1349
1426
  async (args) => {
@@ -1570,7 +1647,7 @@ async function createMCPServer() {
1570
1647
  server.registerTool(
1571
1648
  "abandon_task",
1572
1649
  {
1573
- description: "Release task assignment and optionally clean up branch. Task returns to READY. Use after errors.",
1650
+ description: "Release task assignment and optionally clean up branch. Task returns to TODO. Use after errors.",
1574
1651
  inputSchema: {
1575
1652
  projectId: import_zod3.z.string().describe("The project ID"),
1576
1653
  taskId: import_zod3.z.string().describe("The task ID to abandon"),
@@ -1710,7 +1787,7 @@ async function createMCPServer() {
1710
1787
  server.registerTool(
1711
1788
  "create_task",
1712
1789
  {
1713
- description: "Create task with title, description, acceptance criteria. Starts in BACKLOG. Priority: LOW/MEDIUM/HIGH/CRITICAL.",
1790
+ description: "Create task with title, description, acceptance criteria. Starts in DRAFT. Priority: LOW/MEDIUM/HIGH/CRITICAL.",
1714
1791
  inputSchema: {
1715
1792
  projectId: import_zod3.z.string().describe("The project ID to create the task in"),
1716
1793
  epicId: import_zod3.z.string().nullable().optional().describe("Optional epic ID to associate the task with"),
@@ -1827,6 +1904,119 @@ async function createMCPServer() {
1827
1904
  }
1828
1905
  }
1829
1906
  );
1907
+ server.registerTool(
1908
+ "verify_task",
1909
+ {
1910
+ description: "Verify a DRAFT task and move it to TODO state. Requires task to pass programmatic validation (title 10+ chars, description 50+ chars, each criterion 20+ chars). If approved=false, stores feedback with NEEDS_REVISION status.",
1911
+ inputSchema: {
1912
+ projectId: import_zod3.z.string().describe("The project ID"),
1913
+ taskId: import_zod3.z.string().describe("The task ID to verify"),
1914
+ approved: import_zod3.z.boolean().describe("Whether to approve the task"),
1915
+ feedback: import_zod3.z.string().optional().describe("Feedback for the task (required if not approved)")
1916
+ }
1917
+ },
1918
+ async (args) => {
1919
+ assertApiKeyPermission(mockApiKey, ApiKeyPermission.WRITE, "verify_task");
1920
+ const validated = VerifyTaskInputSchema.parse(args);
1921
+ try {
1922
+ const result = await apiClient.verifyTask(
1923
+ validated.taskId,
1924
+ validated.projectId,
1925
+ validated.approved,
1926
+ validated.feedback
1927
+ );
1928
+ return {
1929
+ content: [
1930
+ {
1931
+ type: "text",
1932
+ text: JSON.stringify(result, null, 2)
1933
+ }
1934
+ ]
1935
+ };
1936
+ } catch (error) {
1937
+ return handleApiError(error);
1938
+ }
1939
+ }
1940
+ );
1941
+ server.registerTool(
1942
+ "get_task_prompt",
1943
+ {
1944
+ description: "Get state-appropriate prompt for a task. Returns verify prompt for DRAFT, assignment prompt for TODO, or continue prompt for IN_PROGRESS tasks.",
1945
+ inputSchema: {
1946
+ projectId: import_zod3.z.string().describe("The project ID"),
1947
+ taskId: import_zod3.z.string().describe("The task ID")
1948
+ }
1949
+ },
1950
+ async (args) => {
1951
+ assertApiKeyPermission(
1952
+ mockApiKey,
1953
+ ApiKeyPermission.READ,
1954
+ "get_task_prompt"
1955
+ );
1956
+ const validated = GetTaskPromptInputSchema.parse(args);
1957
+ try {
1958
+ const result = await apiClient.getTaskPrompt(
1959
+ validated.taskId,
1960
+ validated.projectId
1961
+ );
1962
+ return {
1963
+ content: [
1964
+ {
1965
+ type: "text",
1966
+ text: JSON.stringify(result, null, 2)
1967
+ }
1968
+ ]
1969
+ };
1970
+ } catch (error) {
1971
+ return handleApiError(error);
1972
+ }
1973
+ }
1974
+ );
1975
+ server.registerTool(
1976
+ "update_task",
1977
+ {
1978
+ description: "Update task details (title, description, priority, acceptanceCriteria). Only works for DRAFT and TODO states. If task is in TODO state, it reverts to DRAFT and requires re-verification.",
1979
+ inputSchema: {
1980
+ projectId: import_zod3.z.string().describe("The project ID"),
1981
+ taskId: import_zod3.z.string().describe("The task ID to update"),
1982
+ title: import_zod3.z.string().optional().describe("New task title"),
1983
+ description: import_zod3.z.string().optional().describe("New task description"),
1984
+ priority: import_zod3.z.nativeEnum(TaskPriority).optional().describe("New task priority"),
1985
+ acceptanceCriteria: import_zod3.z.array(
1986
+ import_zod3.z.object({
1987
+ id: import_zod3.z.string().optional().describe("Existing criterion ID (for updates)"),
1988
+ description: import_zod3.z.string().describe("Criterion description")
1989
+ })
1990
+ ).optional().describe("New acceptance criteria (replaces existing)")
1991
+ }
1992
+ },
1993
+ async (args) => {
1994
+ assertApiKeyPermission(mockApiKey, ApiKeyPermission.WRITE, "update_task");
1995
+ const validated = UpdateTaskMCPInputSchema.parse(args);
1996
+ try {
1997
+ const result = await apiClient.updateTask(
1998
+ validated.taskId,
1999
+ validated.projectId,
2000
+ {
2001
+ title: validated.title,
2002
+ description: validated.description,
2003
+ priority: validated.priority,
2004
+ acceptanceCriteria: validated.acceptanceCriteria
2005
+ }
2006
+ );
2007
+ return {
2008
+ content: [
2009
+ {
2010
+ type: "text",
2011
+ text: JSON.stringify(result, null, 2)
2012
+ }
2013
+ ]
2014
+ };
2015
+ } catch (error) {
2016
+ return handleApiError(error);
2017
+ }
2018
+ }
2019
+ );
1830
2020
  server.registerTool(
1831
2021
  "get_version",
1832
2022
  {