@vibescope/mcp-server 0.2.1 → 0.2.2

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 (93) hide show
  1. package/README.md +60 -7
  2. package/dist/api-client.d.ts +187 -0
  3. package/dist/api-client.js +48 -0
  4. package/dist/handlers/blockers.js +9 -8
  5. package/dist/handlers/bodies-of-work.js +14 -14
  6. package/dist/handlers/connectors.d.ts +45 -0
  7. package/dist/handlers/connectors.js +183 -0
  8. package/dist/handlers/cost.d.ts +10 -0
  9. package/dist/handlers/cost.js +54 -0
  10. package/dist/handlers/decisions.js +3 -3
  11. package/dist/handlers/deployment.js +35 -19
  12. package/dist/handlers/discovery.d.ts +7 -0
  13. package/dist/handlers/discovery.js +61 -2
  14. package/dist/handlers/fallback.js +5 -4
  15. package/dist/handlers/file-checkouts.d.ts +2 -0
  16. package/dist/handlers/file-checkouts.js +38 -6
  17. package/dist/handlers/findings.js +13 -12
  18. package/dist/handlers/git-issues.js +4 -4
  19. package/dist/handlers/ideas.js +5 -5
  20. package/dist/handlers/index.d.ts +1 -0
  21. package/dist/handlers/index.js +3 -0
  22. package/dist/handlers/milestones.js +5 -5
  23. package/dist/handlers/organizations.js +13 -13
  24. package/dist/handlers/progress.js +2 -2
  25. package/dist/handlers/project.js +6 -6
  26. package/dist/handlers/requests.js +3 -3
  27. package/dist/handlers/session.js +28 -9
  28. package/dist/handlers/sprints.js +17 -17
  29. package/dist/handlers/tasks.d.ts +2 -0
  30. package/dist/handlers/tasks.js +78 -20
  31. package/dist/handlers/types.d.ts +64 -2
  32. package/dist/handlers/types.js +48 -1
  33. package/dist/handlers/validation.js +3 -3
  34. package/dist/index.js +7 -2716
  35. package/dist/token-tracking.d.ts +74 -0
  36. package/dist/token-tracking.js +122 -0
  37. package/dist/tools.js +298 -9
  38. package/dist/utils.d.ts +5 -0
  39. package/dist/utils.js +17 -0
  40. package/docs/TOOLS.md +2053 -0
  41. package/package.json +4 -1
  42. package/scripts/generate-docs.ts +212 -0
  43. package/src/api-client.test.ts +718 -0
  44. package/src/api-client.ts +231 -0
  45. package/src/handlers/__test-setup__.ts +9 -0
  46. package/src/handlers/blockers.test.ts +31 -19
  47. package/src/handlers/blockers.ts +9 -8
  48. package/src/handlers/bodies-of-work.test.ts +55 -32
  49. package/src/handlers/bodies-of-work.ts +14 -14
  50. package/src/handlers/connectors.test.ts +834 -0
  51. package/src/handlers/connectors.ts +229 -0
  52. package/src/handlers/cost.ts +66 -0
  53. package/src/handlers/decisions.test.ts +34 -25
  54. package/src/handlers/decisions.ts +3 -3
  55. package/src/handlers/deployment.ts +39 -19
  56. package/src/handlers/discovery.ts +61 -2
  57. package/src/handlers/fallback.test.ts +26 -22
  58. package/src/handlers/fallback.ts +5 -4
  59. package/src/handlers/file-checkouts.test.ts +242 -49
  60. package/src/handlers/file-checkouts.ts +44 -6
  61. package/src/handlers/findings.test.ts +38 -24
  62. package/src/handlers/findings.ts +13 -12
  63. package/src/handlers/git-issues.test.ts +51 -43
  64. package/src/handlers/git-issues.ts +4 -4
  65. package/src/handlers/ideas.test.ts +28 -23
  66. package/src/handlers/ideas.ts +5 -5
  67. package/src/handlers/index.ts +3 -0
  68. package/src/handlers/milestones.test.ts +33 -28
  69. package/src/handlers/milestones.ts +5 -5
  70. package/src/handlers/organizations.test.ts +104 -83
  71. package/src/handlers/organizations.ts +13 -13
  72. package/src/handlers/progress.test.ts +20 -14
  73. package/src/handlers/progress.ts +2 -2
  74. package/src/handlers/project.test.ts +34 -27
  75. package/src/handlers/project.ts +6 -6
  76. package/src/handlers/requests.test.ts +27 -18
  77. package/src/handlers/requests.ts +3 -3
  78. package/src/handlers/session.test.ts +47 -0
  79. package/src/handlers/session.ts +32 -9
  80. package/src/handlers/sprints.test.ts +71 -50
  81. package/src/handlers/sprints.ts +17 -17
  82. package/src/handlers/tasks.test.ts +77 -15
  83. package/src/handlers/tasks.ts +90 -21
  84. package/src/handlers/tool-categories.test.ts +66 -0
  85. package/src/handlers/types.ts +81 -2
  86. package/src/handlers/validation.test.ts +78 -45
  87. package/src/handlers/validation.ts +3 -3
  88. package/src/index.ts +12 -2732
  89. package/src/token-tracking.test.ts +453 -0
  90. package/src/token-tracking.ts +164 -0
  91. package/src/tools.ts +298 -9
  92. package/src/utils.test.ts +2 -2
  93. package/src/utils.ts +17 -0
package/src/tools.ts CHANGED
@@ -8,7 +8,9 @@ export const tools: Tool[] = [
8
8
  {
9
9
  name: 'start_work_session',
10
10
  description: `CALL THIS FIRST when beginning work on a project.
11
- Returns session info, persona, role, and next task. Use mode:'full' for complete context.`,
11
+ Returns session info, persona, role, and next_task. Start the next_task IMMEDIATELY without asking the user.
12
+
13
+ Use mode:'full' for complete context, mode:'lite' (default) for minimal tokens.`,
12
14
  inputSchema: {
13
15
  type: 'object',
14
16
  properties: {
@@ -190,6 +192,40 @@ Returns session info, persona, role, and next task. Use mode:'full' for complete
190
192
  required: ['project_id'],
191
193
  },
192
194
  },
195
+ {
196
+ name: 'get_body_of_work_costs',
197
+ description: 'Get cost breakdown by body of work with phase-level details. Returns costs for pre/core/post phases and model breakdown.',
198
+ inputSchema: {
199
+ type: 'object',
200
+ properties: {
201
+ body_of_work_id: {
202
+ type: 'string',
203
+ description: 'Body of work UUID (optional if project_id provided)',
204
+ },
205
+ project_id: {
206
+ type: 'string',
207
+ description: 'Project UUID to get all body of work costs (optional if body_of_work_id provided)',
208
+ },
209
+ },
210
+ },
211
+ },
212
+ {
213
+ name: 'get_sprint_costs',
214
+ description: 'Get cost breakdown by sprint with velocity metrics. Returns cost per story point and phase breakdown.',
215
+ inputSchema: {
216
+ type: 'object',
217
+ properties: {
218
+ sprint_id: {
219
+ type: 'string',
220
+ description: 'Sprint UUID (optional if project_id provided)',
221
+ },
222
+ project_id: {
223
+ type: 'string',
224
+ description: 'Project UUID to get all sprint costs (optional if sprint_id provided)',
225
+ },
226
+ },
227
+ },
228
+ },
193
229
  // Knowledge Base Query Tool
194
230
  {
195
231
  name: 'query_knowledge_base',
@@ -234,7 +270,7 @@ Returns session info, persona, role, and next task. Use mode:'full' for complete
234
270
  properties: {
235
271
  category: {
236
272
  type: 'string',
237
- enum: ['session', 'project', 'tasks', 'milestones', 'progress', 'blockers', 'decisions', 'ideas', 'findings', 'validation', 'deployment', 'fallback', 'requests', 'organizations', 'cost', 'knowledge'],
273
+ enum: ['session', 'project', 'tasks', 'milestones', 'progress', 'blockers', 'decisions', 'ideas', 'findings', 'validation', 'deployment', 'fallback', 'bodies_of_work', 'sprints', 'requests', 'organizations', 'cost', 'git_issues', 'knowledge', 'discovery', 'subtasks', 'worktrees', 'roles', 'file_locks'],
238
274
  description: 'Category to list (omit for all categories)',
239
275
  },
240
276
  },
@@ -430,7 +466,9 @@ Returns session info, persona, role, and next task. Use mode:'full' for complete
430
466
  },
431
467
  {
432
468
  name: 'get_next_task',
433
- description: 'Get highest priority pending task. Skips claimed tasks. Check deployment_blocks_tasks first.',
469
+ description: `Get highest priority pending task. Start it IMMEDIATELY by calling update_task(task_id, status: "in_progress").
470
+
471
+ Do NOT ask the user for permission. Follow the directive in the response.`,
434
472
  inputSchema: {
435
473
  type: 'object',
436
474
  properties: {
@@ -486,7 +524,13 @@ Returns session info, persona, role, and next task. Use mode:'full' for complete
486
524
  },
487
525
  {
488
526
  name: 'update_task',
489
- description: 'Update task status, progress, or details. Include progress_note with progress_percentage.',
527
+ description: `Update task status, progress, or details. Include progress_note with progress_percentage.
528
+
529
+ IMPORTANT: When setting status to "in_progress", you MUST provide git_branch AND worktree_path to enable cleanup tracking.
530
+ Create worktree first: git worktree add ../PROJECT-task-TASKID -b feature/TASKID-description BASE_BRANCH
531
+ Then call: update_task(task_id, status: "in_progress", git_branch: "feature/TASKID-description", worktree_path: "../PROJECT-task-TASKID")
532
+
533
+ For projects without git branching (trunk-based or none), use skip_worktree_requirement: true.`,
490
534
  inputSchema: {
491
535
  type: 'object',
492
536
  properties: {
@@ -522,20 +566,35 @@ Returns session info, persona, role, and next task. Use mode:'full' for complete
522
566
  },
523
567
  git_branch: {
524
568
  type: 'string',
525
- description: 'Git branch associated with this task',
569
+ description: 'Git branch associated with this task. REQUIRED when status is "in_progress" (unless skip_worktree_requirement is true)',
570
+ },
571
+ worktree_path: {
572
+ type: 'string',
573
+ description: 'Git worktree path for this task (e.g., "../project-task-abc123"). Store this for cleanup tracking across sessions.',
526
574
  },
527
575
  model_capability: {
528
576
  type: 'string',
529
577
  enum: ['haiku', 'sonnet', 'opus'],
530
578
  description: 'Recommended model capability: haiku (simple tasks), sonnet (standard), opus (complex reasoning)',
531
579
  },
580
+ skip_worktree_requirement: {
581
+ type: 'boolean',
582
+ description: 'Skip git_branch requirement for projects without branching workflows (trunk-based or none). Default: false',
583
+ },
532
584
  },
533
585
  required: ['task_id'],
534
586
  },
535
587
  },
536
588
  {
537
589
  name: 'complete_task',
538
- description: 'Mark task done. Returns next_task and context counts (validation, blockers, deployment).',
590
+ description: `Mark task done. Returns next_task which you MUST start immediately without asking the user.
591
+
592
+ CRITICAL: After calling this tool, you must:
593
+ 1. If next_task is returned → Start it immediately by calling update_task(task_id, status: "in_progress")
594
+ 2. If no next_task → Call get_next_task() or start a fallback_activity
595
+ 3. NEVER ask the user "What should I do next?" or "Should I continue?"
596
+
597
+ The auto_continue: true flag in the response means you are expected to continue working autonomously.`,
539
598
  inputSchema: {
540
599
  type: 'object',
541
600
  properties: {
@@ -1107,6 +1166,46 @@ Returns subtasks with aggregate completion stats.`,
1107
1166
  required: ['parent_task_id'],
1108
1167
  },
1109
1168
  },
1169
+ {
1170
+ name: 'get_stale_worktrees',
1171
+ description: `Get worktrees that need cleanup.
1172
+
1173
+ Returns tasks with worktree_path set where:
1174
+ - Task is completed or cancelled (worktree should have been cleaned up)
1175
+ - Task has been abandoned (no activity for 24+ hours while in_progress)
1176
+
1177
+ IMPORTANT: Call this on session start to clean up orphaned worktrees from previous sessions.
1178
+ For each stale worktree:
1179
+ 1. Run: git worktree remove <worktree_path>
1180
+ 2. Call: clear_worktree_path(task_id)`,
1181
+ inputSchema: {
1182
+ type: 'object',
1183
+ properties: {
1184
+ project_id: {
1185
+ type: 'string',
1186
+ description: 'Project UUID',
1187
+ },
1188
+ },
1189
+ required: ['project_id'],
1190
+ },
1191
+ },
1192
+ {
1193
+ name: 'clear_worktree_path',
1194
+ description: `Clear the worktree_path from a task after cleanup.
1195
+
1196
+ Call this AFTER removing the worktree with git worktree remove.
1197
+ This marks the task as cleaned up so it won't appear in get_stale_worktrees.`,
1198
+ inputSchema: {
1199
+ type: 'object',
1200
+ properties: {
1201
+ task_id: {
1202
+ type: 'string',
1203
+ description: 'Task UUID',
1204
+ },
1205
+ },
1206
+ required: ['task_id'],
1207
+ },
1208
+ },
1110
1209
  {
1111
1210
  name: 'heartbeat',
1112
1211
  description: `Send heartbeat to maintain 'active' status. Call every 30-60 seconds.`,
@@ -1435,8 +1534,14 @@ Returns subtasks with aggregate completion stats.`,
1435
1534
  },
1436
1535
  schedule_type: {
1437
1536
  type: 'string',
1438
- description: 'Schedule type: once (one-time), daily, weekly, or monthly',
1439
- enum: ['once', 'daily', 'weekly', 'monthly'],
1537
+ description: 'Schedule type: once (one-time), hourly, daily, weekly, or monthly',
1538
+ enum: ['once', 'hourly', 'daily', 'weekly', 'monthly'],
1539
+ },
1540
+ hours_interval: {
1541
+ type: 'number',
1542
+ description: 'For hourly schedules, the number of hours between runs (1-24, default: 1)',
1543
+ minimum: 1,
1544
+ maximum: 24,
1440
1545
  },
1441
1546
  auto_trigger: {
1442
1547
  type: 'boolean',
@@ -1499,7 +1604,13 @@ Returns subtasks with aggregate completion stats.`,
1499
1604
  schedule_type: {
1500
1605
  type: 'string',
1501
1606
  description: 'New schedule type',
1502
- enum: ['once', 'daily', 'weekly', 'monthly'],
1607
+ enum: ['once', 'hourly', 'daily', 'weekly', 'monthly'],
1608
+ },
1609
+ hours_interval: {
1610
+ type: 'number',
1611
+ description: 'For hourly schedules, the number of hours between runs (1-24)',
1612
+ minimum: 1,
1613
+ maximum: 24,
1503
1614
  },
1504
1615
  auto_trigger: {
1505
1616
  type: 'boolean',
@@ -1597,6 +1708,7 @@ Returns subtasks with aggregate completion stats.`,
1597
1708
  'documentation_review',
1598
1709
  'dependency_audit',
1599
1710
  'validate_completed_tasks',
1711
+ 'worktree_cleanup',
1600
1712
  ],
1601
1713
  },
1602
1714
  },
@@ -2915,5 +3027,182 @@ Returns committed vs completed points and average velocity.`,
2915
3027
  required: ['git_issue_id'],
2916
3028
  },
2917
3029
  },
3030
+ // ============================================================================
3031
+ // Connector Tools (External Integrations)
3032
+ // ============================================================================
3033
+ {
3034
+ name: 'get_connectors',
3035
+ description: `List connectors for a project. Connectors enable sending events to external services (Slack, Discord, webhooks, etc.).`,
3036
+ inputSchema: {
3037
+ type: 'object',
3038
+ properties: {
3039
+ project_id: {
3040
+ type: 'string',
3041
+ description: 'Project UUID',
3042
+ },
3043
+ type: {
3044
+ type: 'string',
3045
+ enum: ['webhook', 'slack', 'discord', 'github', 'custom'],
3046
+ description: 'Filter by connector type (optional)',
3047
+ },
3048
+ status: {
3049
+ type: 'string',
3050
+ enum: ['active', 'disabled'],
3051
+ description: 'Filter by status (optional)',
3052
+ },
3053
+ limit: {
3054
+ type: 'number',
3055
+ description: 'Max connectors to return (default: 50)',
3056
+ },
3057
+ offset: {
3058
+ type: 'number',
3059
+ description: 'Pagination offset (default: 0)',
3060
+ },
3061
+ },
3062
+ required: ['project_id'],
3063
+ },
3064
+ },
3065
+ {
3066
+ name: 'get_connector',
3067
+ description: `Get a single connector with full details including configuration (sensitive fields are masked).`,
3068
+ inputSchema: {
3069
+ type: 'object',
3070
+ properties: {
3071
+ connector_id: {
3072
+ type: 'string',
3073
+ description: 'Connector UUID',
3074
+ },
3075
+ },
3076
+ required: ['connector_id'],
3077
+ },
3078
+ },
3079
+ {
3080
+ name: 'add_connector',
3081
+ description: `Add a new connector for external integrations. Supports webhook, Slack, Discord, GitHub, and custom connectors.`,
3082
+ inputSchema: {
3083
+ type: 'object',
3084
+ properties: {
3085
+ project_id: {
3086
+ type: 'string',
3087
+ description: 'Project UUID',
3088
+ },
3089
+ name: {
3090
+ type: 'string',
3091
+ description: 'Connector name (e.g., "Slack Notifications")',
3092
+ },
3093
+ type: {
3094
+ type: 'string',
3095
+ enum: ['webhook', 'slack', 'discord', 'github', 'custom'],
3096
+ description: 'Connector type',
3097
+ },
3098
+ description: {
3099
+ type: 'string',
3100
+ description: 'Optional description',
3101
+ },
3102
+ config: {
3103
+ type: 'object',
3104
+ description: 'Type-specific configuration (e.g., { webhook_url: "..." } for Slack)',
3105
+ },
3106
+ events: {
3107
+ type: 'object',
3108
+ description: 'Event subscriptions (e.g., { task_completed: true, blocker_added: true })',
3109
+ },
3110
+ },
3111
+ required: ['project_id', 'name', 'type'],
3112
+ },
3113
+ },
3114
+ {
3115
+ name: 'update_connector',
3116
+ description: `Update a connector's configuration, events, or status.`,
3117
+ inputSchema: {
3118
+ type: 'object',
3119
+ properties: {
3120
+ connector_id: {
3121
+ type: 'string',
3122
+ description: 'Connector UUID',
3123
+ },
3124
+ name: {
3125
+ type: 'string',
3126
+ description: 'Updated name',
3127
+ },
3128
+ description: {
3129
+ type: 'string',
3130
+ description: 'Updated description',
3131
+ },
3132
+ config: {
3133
+ type: 'object',
3134
+ description: 'Updated configuration (merged with existing)',
3135
+ },
3136
+ events: {
3137
+ type: 'object',
3138
+ description: 'Updated event subscriptions',
3139
+ },
3140
+ status: {
3141
+ type: 'string',
3142
+ enum: ['active', 'disabled'],
3143
+ description: 'Enable or disable the connector',
3144
+ },
3145
+ },
3146
+ required: ['connector_id'],
3147
+ },
3148
+ },
3149
+ {
3150
+ name: 'delete_connector',
3151
+ description: `Delete a connector.`,
3152
+ inputSchema: {
3153
+ type: 'object',
3154
+ properties: {
3155
+ connector_id: {
3156
+ type: 'string',
3157
+ description: 'Connector UUID',
3158
+ },
3159
+ },
3160
+ required: ['connector_id'],
3161
+ },
3162
+ },
3163
+ {
3164
+ name: 'test_connector',
3165
+ description: `Test a connector by sending a test event. Returns success/failure status.`,
3166
+ inputSchema: {
3167
+ type: 'object',
3168
+ properties: {
3169
+ connector_id: {
3170
+ type: 'string',
3171
+ description: 'Connector UUID to test',
3172
+ },
3173
+ },
3174
+ required: ['connector_id'],
3175
+ },
3176
+ },
3177
+ {
3178
+ name: 'get_connector_events',
3179
+ description: `Get event history for a connector or project. Shows delivery status and errors.`,
3180
+ inputSchema: {
3181
+ type: 'object',
3182
+ properties: {
3183
+ connector_id: {
3184
+ type: 'string',
3185
+ description: 'Connector UUID (optional if project_id provided)',
3186
+ },
3187
+ project_id: {
3188
+ type: 'string',
3189
+ description: 'Project UUID (optional if connector_id provided)',
3190
+ },
3191
+ status: {
3192
+ type: 'string',
3193
+ enum: ['pending', 'sent', 'failed', 'retrying'],
3194
+ description: 'Filter by delivery status (optional)',
3195
+ },
3196
+ limit: {
3197
+ type: 'number',
3198
+ description: 'Max events to return (default: 50)',
3199
+ },
3200
+ offset: {
3201
+ type: 'number',
3202
+ description: 'Pagination offset (default: 0)',
3203
+ },
3204
+ },
3205
+ },
3206
+ },
2918
3207
  ];
2919
3208
 
package/src/utils.test.ts CHANGED
@@ -43,8 +43,8 @@ describe('AGENT_PERSONAS', () => {
43
43
  // ============================================================================
44
44
 
45
45
  describe('FALLBACK_ACTIVITIES', () => {
46
- it('should have 11 activities', () => {
47
- expect(FALLBACK_ACTIVITIES).toHaveLength(11);
46
+ it('should have 12 activities', () => {
47
+ expect(FALLBACK_ACTIVITIES).toHaveLength(12);
48
48
  });
49
49
 
50
50
  it('should have required fields on each activity', () => {
package/src/utils.ts CHANGED
@@ -133,6 +133,23 @@ export const FALLBACK_ACTIVITIES = [
133
133
  description: 'Review tasks completed by other agents to ensure quality.',
134
134
  prompt: 'Call get_tasks_awaiting_validation to find completed tasks that need review. Validate each one by checking the implementation and running tests if applicable.',
135
135
  },
136
+ {
137
+ activity: 'worktree_cleanup',
138
+ title: 'Clean up stale worktrees',
139
+ description: 'Find and remove git worktrees from completed or abandoned tasks.',
140
+ prompt: `Clean up stale git worktrees to reclaim disk space and prevent confusion:
141
+
142
+ 1. Call get_stale_worktrees(project_id) to find worktrees needing cleanup
143
+ 2. For each stale worktree returned:
144
+ a. Check if the worktree directory exists: ls -la <worktree_path>
145
+ b. If it exists, remove it: git worktree remove <worktree_path>
146
+ c. If removal fails (untracked files), use: git worktree remove --force <worktree_path>
147
+ d. Call clear_worktree_path(task_id) to mark it as cleaned up
148
+ 3. Run 'git worktree list' to verify cleanup
149
+ 4. Log any issues encountered with add_blocker if worktrees cannot be removed
150
+
151
+ This prevents disk bloat from accumulated worktrees and keeps the workspace clean.`,
152
+ },
136
153
  ] as const;
137
154
 
138
155
  export type FallbackActivity = typeof FALLBACK_ACTIVITIES[number];