@mtaap/mcp 0.2.11 → 0.2.13
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/README.md +27 -0
- package/dist/cli.js +99 -25
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +392 -1
- package/dist/index.js +105 -24
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +1 -0
- package/dist/server.js +2656 -0
- package/dist/server.js.map +1 -0
- package/package.json +5 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,400 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
|
|
3
|
+
import { TaskState, ErrorType } from '@mtaap/core';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* MCP API Client
|
|
7
|
+
*
|
|
8
|
+
* HTTP client for communicating with the Collab webapp REST API.
|
|
9
|
+
* Replaces direct database access for a lighter, more secure MCP package.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* API Client Configuration
|
|
14
|
+
*/
|
|
15
|
+
interface ApiClientConfig {
|
|
16
|
+
baseUrl: string;
|
|
17
|
+
apiKey: string;
|
|
18
|
+
timeout?: number;
|
|
19
|
+
debug?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Authentication context returned from the API
|
|
23
|
+
*/
|
|
24
|
+
interface AuthContext {
|
|
25
|
+
userId: string;
|
|
26
|
+
organizationId: string | undefined;
|
|
27
|
+
permissions: string[];
|
|
28
|
+
userName: string;
|
|
29
|
+
userEmail: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Project from API
|
|
33
|
+
*/
|
|
34
|
+
interface Project {
|
|
35
|
+
id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
description: string | null;
|
|
38
|
+
type: string;
|
|
39
|
+
origin: string;
|
|
40
|
+
repositoryUrl: string;
|
|
41
|
+
baseBranch: string;
|
|
42
|
+
tags: string[];
|
|
43
|
+
createdAt: string;
|
|
44
|
+
updatedAt: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Task from API
|
|
48
|
+
*/
|
|
49
|
+
interface Task {
|
|
50
|
+
id: string;
|
|
51
|
+
projectId: string;
|
|
52
|
+
projectName: string;
|
|
53
|
+
epicId: string | null;
|
|
54
|
+
epicName: string | null;
|
|
55
|
+
title: string;
|
|
56
|
+
description: string | null;
|
|
57
|
+
state: TaskState;
|
|
58
|
+
priority: string;
|
|
59
|
+
assigneeId: string | null;
|
|
60
|
+
assigneeName: string | null;
|
|
61
|
+
assigneeEmail: string | null;
|
|
62
|
+
createdBy: string;
|
|
63
|
+
createdByName: string | null;
|
|
64
|
+
assignedAt: string | null;
|
|
65
|
+
startedAt: string | null;
|
|
66
|
+
completedAt: string | null;
|
|
67
|
+
branchName: string | null;
|
|
68
|
+
pullRequestUrl: string | null;
|
|
69
|
+
pullRequestNumber: number | null;
|
|
70
|
+
errorType: string | null;
|
|
71
|
+
errorMessage: string | null;
|
|
72
|
+
verificationStatus: string | null;
|
|
73
|
+
verificationFeedback: string | null;
|
|
74
|
+
verifiedAt: string | null;
|
|
75
|
+
acceptanceCriteria: Array<{
|
|
76
|
+
id: string;
|
|
77
|
+
description: string;
|
|
78
|
+
completed: boolean;
|
|
79
|
+
completedAt: string | null;
|
|
80
|
+
order: number;
|
|
81
|
+
}>;
|
|
82
|
+
progressUpdates?: Array<{
|
|
83
|
+
id: string;
|
|
84
|
+
message: string;
|
|
85
|
+
checkpoints: string[];
|
|
86
|
+
userId: string;
|
|
87
|
+
createdAt: string;
|
|
88
|
+
}>;
|
|
89
|
+
notes?: Array<{
|
|
90
|
+
id: string;
|
|
91
|
+
content: string;
|
|
92
|
+
userId: string;
|
|
93
|
+
userName: string | null;
|
|
94
|
+
createdAt: string;
|
|
95
|
+
}>;
|
|
96
|
+
createdAt: string;
|
|
97
|
+
updatedAt: string;
|
|
98
|
+
archivedAt: string | null;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Project context from API
|
|
102
|
+
*/
|
|
103
|
+
interface ProjectContext {
|
|
104
|
+
readme: string;
|
|
105
|
+
stack: string[];
|
|
106
|
+
recentCompleted: Array<{
|
|
107
|
+
id: string;
|
|
108
|
+
title: string;
|
|
109
|
+
completedAt: string | null;
|
|
110
|
+
}>;
|
|
111
|
+
conventions: {
|
|
112
|
+
branchPrefix: string;
|
|
113
|
+
commitFormat: string;
|
|
114
|
+
testCommand: string;
|
|
115
|
+
baseBranch: string;
|
|
116
|
+
notes: string;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* API Error
|
|
121
|
+
*/
|
|
122
|
+
declare class ApiError extends Error {
|
|
123
|
+
code: string;
|
|
124
|
+
status: number;
|
|
125
|
+
details?: Record<string, unknown> | undefined;
|
|
126
|
+
constructor(message: string, code: string, status: number, details?: Record<string, unknown> | undefined);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* MCP API Client
|
|
130
|
+
*/
|
|
131
|
+
declare class MCPApiClient {
|
|
132
|
+
private baseUrl;
|
|
133
|
+
private apiKey;
|
|
134
|
+
private timeout;
|
|
135
|
+
private debug;
|
|
136
|
+
private authContext;
|
|
137
|
+
constructor(config: ApiClientConfig);
|
|
138
|
+
/**
|
|
139
|
+
* Make an HTTP request to the API
|
|
140
|
+
*/
|
|
141
|
+
private request;
|
|
142
|
+
/**
|
|
143
|
+
* Authenticate and get user context
|
|
144
|
+
*/
|
|
145
|
+
authenticate(): Promise<AuthContext>;
|
|
146
|
+
/**
|
|
147
|
+
* Get cached auth context or authenticate
|
|
148
|
+
*/
|
|
149
|
+
getAuthContext(): Promise<AuthContext>;
|
|
150
|
+
/**
|
|
151
|
+
* List accessible projects
|
|
152
|
+
*/
|
|
153
|
+
listProjects(workspaceType?: string): Promise<Project[]>;
|
|
154
|
+
/**
|
|
155
|
+
* Get single project details
|
|
156
|
+
*/
|
|
157
|
+
getProject(projectId: string): Promise<Project>;
|
|
158
|
+
/**
|
|
159
|
+
* Get project context (README, stack, conventions)
|
|
160
|
+
*/
|
|
161
|
+
getProjectContext(projectId: string): Promise<ProjectContext>;
|
|
162
|
+
/**
|
|
163
|
+
* Create a personal project
|
|
164
|
+
*/
|
|
165
|
+
createPersonalProject(name: string, description: string | undefined, repositoryUrl: string): Promise<{
|
|
166
|
+
success: boolean;
|
|
167
|
+
projectId: string;
|
|
168
|
+
}>;
|
|
169
|
+
/**
|
|
170
|
+
* Create a task in a project
|
|
171
|
+
*/
|
|
172
|
+
createTask(input: {
|
|
173
|
+
projectId: string;
|
|
174
|
+
epicId?: string | null;
|
|
175
|
+
title: string;
|
|
176
|
+
description: string;
|
|
177
|
+
priority?: string;
|
|
178
|
+
acceptanceCriteria: Array<{
|
|
179
|
+
description: string;
|
|
180
|
+
}>;
|
|
181
|
+
}): Promise<{
|
|
182
|
+
success: boolean;
|
|
183
|
+
taskId: string;
|
|
184
|
+
task: Task;
|
|
185
|
+
}>;
|
|
186
|
+
/**
|
|
187
|
+
* List tasks with optional filters
|
|
188
|
+
*/
|
|
189
|
+
listTasks(filters?: {
|
|
190
|
+
projectId?: string;
|
|
191
|
+
state?: TaskState;
|
|
192
|
+
assigneeId?: string;
|
|
193
|
+
includeArchived?: boolean;
|
|
194
|
+
}): Promise<Task[]>;
|
|
195
|
+
/**
|
|
196
|
+
* Get full task details
|
|
197
|
+
*/
|
|
198
|
+
getTask(taskId: string): Promise<Task>;
|
|
199
|
+
/**
|
|
200
|
+
* Assign task to current user and create branch
|
|
201
|
+
*/
|
|
202
|
+
assignTask(taskId: string, projectId: string, expectedState?: TaskState): Promise<{
|
|
203
|
+
success: boolean;
|
|
204
|
+
taskId: string;
|
|
205
|
+
suggestedBranchName?: string;
|
|
206
|
+
baseBranch?: string;
|
|
207
|
+
repositoryUrl?: string;
|
|
208
|
+
currentState?: string;
|
|
209
|
+
message?: string;
|
|
210
|
+
note?: string;
|
|
211
|
+
}>;
|
|
212
|
+
/**
|
|
213
|
+
* Update task progress
|
|
214
|
+
*/
|
|
215
|
+
updateProgress(taskId: string, data: {
|
|
216
|
+
statusMessage?: string;
|
|
217
|
+
completedCheckpointIds?: string[];
|
|
218
|
+
currentCheckpointIndex?: number;
|
|
219
|
+
}): Promise<{
|
|
220
|
+
success: boolean;
|
|
221
|
+
taskId: string;
|
|
222
|
+
}>;
|
|
223
|
+
/**
|
|
224
|
+
* Complete task and prepare for PR creation.
|
|
225
|
+
* Returns PR suggestions for the agent to use when creating the PR locally.
|
|
226
|
+
*/
|
|
227
|
+
completeTask(taskId: string, projectId: string, pullRequestTitle?: string, pullRequestBody?: string): Promise<{
|
|
228
|
+
success: boolean;
|
|
229
|
+
taskId: string;
|
|
230
|
+
suggestedPRTitle?: string;
|
|
231
|
+
suggestedPRBody?: string;
|
|
232
|
+
branchName?: string;
|
|
233
|
+
baseBranch?: string;
|
|
234
|
+
note?: string;
|
|
235
|
+
}>;
|
|
236
|
+
/**
|
|
237
|
+
* Abandon task and optionally delete branch
|
|
238
|
+
*/
|
|
239
|
+
abandonTask(taskId: string, projectId: string, deleteBranch?: boolean): Promise<{
|
|
240
|
+
success: boolean;
|
|
241
|
+
taskId: string;
|
|
242
|
+
state: string;
|
|
243
|
+
branchDeleted: boolean;
|
|
244
|
+
}>;
|
|
245
|
+
/**
|
|
246
|
+
* Archive a task (soft delete)
|
|
247
|
+
*/
|
|
248
|
+
archiveTask(taskId: string, projectId: string): Promise<{
|
|
249
|
+
success: boolean;
|
|
250
|
+
taskId: string;
|
|
251
|
+
archivedAt: string;
|
|
252
|
+
}>;
|
|
253
|
+
/**
|
|
254
|
+
* Unarchive a task (restore)
|
|
255
|
+
*/
|
|
256
|
+
unarchiveTask(taskId: string, projectId: string): Promise<{
|
|
257
|
+
success: boolean;
|
|
258
|
+
taskId: string;
|
|
259
|
+
}>;
|
|
260
|
+
/**
|
|
261
|
+
* Report task error
|
|
262
|
+
*/
|
|
263
|
+
reportError(taskId: string, errorType: ErrorType, errorMessage: string, context?: string): Promise<{
|
|
264
|
+
success: boolean;
|
|
265
|
+
taskId: string;
|
|
266
|
+
}>;
|
|
267
|
+
/**
|
|
268
|
+
* Add note to task
|
|
269
|
+
*/
|
|
270
|
+
addNote(taskId: string, content: string): Promise<{
|
|
271
|
+
success: boolean;
|
|
272
|
+
noteId: string;
|
|
273
|
+
}>;
|
|
274
|
+
/**
|
|
275
|
+
* Request changes on a task in review
|
|
276
|
+
*/
|
|
277
|
+
requestChanges(taskId: string, projectId: string, reviewComments: string, requestedChanges?: string[]): Promise<{
|
|
278
|
+
success: boolean;
|
|
279
|
+
taskId: string;
|
|
280
|
+
noteId: string;
|
|
281
|
+
message: string;
|
|
282
|
+
}>;
|
|
283
|
+
/**
|
|
284
|
+
* Approve a task in review and mark as DONE
|
|
285
|
+
*/
|
|
286
|
+
approveTask(taskId: string, projectId: string, reviewComments?: string): Promise<{
|
|
287
|
+
success: boolean;
|
|
288
|
+
taskId: string;
|
|
289
|
+
message: string;
|
|
290
|
+
}>;
|
|
291
|
+
/**
|
|
292
|
+
* Report branch created by agent
|
|
293
|
+
*/
|
|
294
|
+
reportBranch(taskId: string, projectId: string, branchName: string): Promise<{
|
|
295
|
+
success: boolean;
|
|
296
|
+
taskId: string;
|
|
297
|
+
branchName: string;
|
|
298
|
+
}>;
|
|
299
|
+
/**
|
|
300
|
+
* Report PR created by agent
|
|
301
|
+
*/
|
|
302
|
+
reportPR(taskId: string, projectId: string, pullRequestUrl: string, pullRequestNumber: number): Promise<{
|
|
303
|
+
success: boolean;
|
|
304
|
+
taskId: string;
|
|
305
|
+
pullRequestUrl: string;
|
|
306
|
+
pullRequestNumber: number;
|
|
307
|
+
state: string;
|
|
308
|
+
}>;
|
|
309
|
+
/**
|
|
310
|
+
* Verify a DRAFT task to move it to TODO state
|
|
311
|
+
*/
|
|
312
|
+
verifyTask(taskId: string, projectId: string, approved: boolean, feedback?: string): Promise<{
|
|
313
|
+
success: boolean;
|
|
314
|
+
taskId: string;
|
|
315
|
+
previousState: string;
|
|
316
|
+
newState: string;
|
|
317
|
+
verificationStatus: string;
|
|
318
|
+
message: string;
|
|
319
|
+
feedback?: string;
|
|
320
|
+
}>;
|
|
321
|
+
/**
|
|
322
|
+
* Get state-appropriate prompt for a task
|
|
323
|
+
*/
|
|
324
|
+
getTaskPrompt(taskId: string, projectId: string): Promise<{
|
|
325
|
+
success: boolean;
|
|
326
|
+
taskId: string;
|
|
327
|
+
state: string;
|
|
328
|
+
promptType: string;
|
|
329
|
+
promptDescription: string;
|
|
330
|
+
prompt: string;
|
|
331
|
+
}>;
|
|
332
|
+
/**
|
|
333
|
+
* Update task details (DRAFT/TODO states only)
|
|
334
|
+
*/
|
|
335
|
+
updateTask(taskId: string, projectId: string, data: {
|
|
336
|
+
title?: string;
|
|
337
|
+
description?: string;
|
|
338
|
+
priority?: string;
|
|
339
|
+
acceptanceCriteria?: Array<{
|
|
340
|
+
id?: string;
|
|
341
|
+
description: string;
|
|
342
|
+
}>;
|
|
343
|
+
}): Promise<{
|
|
344
|
+
success: boolean;
|
|
345
|
+
taskId: string;
|
|
346
|
+
previousState: string;
|
|
347
|
+
newState: string;
|
|
348
|
+
revertedToDraft: boolean;
|
|
349
|
+
message: string;
|
|
350
|
+
task: {
|
|
351
|
+
id: string;
|
|
352
|
+
title: string;
|
|
353
|
+
description: string;
|
|
354
|
+
priority: string;
|
|
355
|
+
state: string;
|
|
356
|
+
verificationStatus: string;
|
|
357
|
+
acceptanceCriteria: Array<{
|
|
358
|
+
id: string;
|
|
359
|
+
description: string;
|
|
360
|
+
order: number;
|
|
361
|
+
}>;
|
|
362
|
+
};
|
|
363
|
+
}>;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
declare const VERSION: string;
|
|
367
|
+
|
|
1
368
|
/**
|
|
2
369
|
* Collab MCP Server
|
|
3
370
|
*
|
|
4
371
|
* Model Context Protocol server for AI agent integration.
|
|
5
372
|
* Uses REST API to communicate with the Collab webapp.
|
|
6
373
|
*/
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Initialize an MCP server with all tools registered.
|
|
377
|
+
* This is the core setup used by both stdio and HTTP transports.
|
|
378
|
+
*
|
|
379
|
+
* @param apiClient - The API client for communicating with the Collab webapp
|
|
380
|
+
* @param authContext - The authenticated user context
|
|
381
|
+
* @returns The configured McpServer instance (not yet connected to a transport)
|
|
382
|
+
*/
|
|
383
|
+
declare function initializeMCPServer(apiClient: MCPApiClient, authContext: AuthContext): McpServer;
|
|
384
|
+
/**
|
|
385
|
+
* Connect an MCP server to a transport.
|
|
386
|
+
*
|
|
387
|
+
* @param server - The MCP server instance
|
|
388
|
+
* @param transport - The transport to connect to
|
|
389
|
+
*/
|
|
390
|
+
declare function connectMCPServer(server: McpServer, transport: Transport): Promise<void>;
|
|
391
|
+
/**
|
|
392
|
+
* Create and start an MCP server with stdio transport.
|
|
393
|
+
* This is the main entry point for CLI usage (collab-mcp command).
|
|
394
|
+
*
|
|
395
|
+
* Creates the API client, authenticates, initializes the server with all tools,
|
|
396
|
+
* and connects to stdio transport for communication with Claude Code.
|
|
397
|
+
*/
|
|
7
398
|
declare function createMCPServer(): Promise<void>;
|
|
8
399
|
|
|
9
|
-
export { createMCPServer };
|
|
400
|
+
export { ApiError, type AuthContext, MCPApiClient, VERSION, connectMCPServer, createMCPServer, initializeMCPServer };
|
package/dist/index.js
CHANGED
|
@@ -30,14 +30,76 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
|
-
|
|
33
|
+
ApiError: () => ApiError,
|
|
34
|
+
MCPApiClient: () => MCPApiClient,
|
|
35
|
+
VERSION: () => VERSION,
|
|
36
|
+
connectMCPServer: () => connectMCPServer,
|
|
37
|
+
createMCPServer: () => createMCPServer,
|
|
38
|
+
initializeMCPServer: () => initializeMCPServer
|
|
34
39
|
});
|
|
35
40
|
module.exports = __toCommonJS(src_exports);
|
|
36
41
|
var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
37
42
|
var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
38
43
|
|
|
44
|
+
// package.json
|
|
45
|
+
var package_default = {
|
|
46
|
+
name: "@mtaap/mcp",
|
|
47
|
+
version: "0.2.12",
|
|
48
|
+
description: "Model Context Protocol (MCP) server for AI agents to interact with Collab - the multi-tenant collaborative agent development platform",
|
|
49
|
+
mcpName: "collab",
|
|
50
|
+
scripts: {
|
|
51
|
+
build: "tsup"
|
|
52
|
+
},
|
|
53
|
+
main: "./dist/index.js",
|
|
54
|
+
types: "./dist/index.d.ts",
|
|
55
|
+
bin: {
|
|
56
|
+
"collab-mcp": "./dist/cli.js",
|
|
57
|
+
"collab-mcp-server": "./dist/server.js"
|
|
58
|
+
},
|
|
59
|
+
publishConfig: {
|
|
60
|
+
access: "public"
|
|
61
|
+
},
|
|
62
|
+
exports: {
|
|
63
|
+
".": {
|
|
64
|
+
types: "./dist/index.d.ts",
|
|
65
|
+
require: "./dist/index.js"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
files: [
|
|
69
|
+
"dist"
|
|
70
|
+
],
|
|
71
|
+
keywords: [
|
|
72
|
+
"mcp",
|
|
73
|
+
"model-context-protocol",
|
|
74
|
+
"ai",
|
|
75
|
+
"agent",
|
|
76
|
+
"collaboration",
|
|
77
|
+
"task-management",
|
|
78
|
+
"claude",
|
|
79
|
+
"anthropic"
|
|
80
|
+
],
|
|
81
|
+
license: "Proprietary",
|
|
82
|
+
author: "MTAAP Contributors",
|
|
83
|
+
engines: {
|
|
84
|
+
node: ">=18.18.0"
|
|
85
|
+
},
|
|
86
|
+
dependencies: {
|
|
87
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
88
|
+
express: "^5.0.1",
|
|
89
|
+
zod: "^4.3.5"
|
|
90
|
+
},
|
|
91
|
+
devDependencies: {
|
|
92
|
+
"@mtaap/config-typescript": "workspace:*",
|
|
93
|
+
"@mtaap/core": "workspace:*",
|
|
94
|
+
"@types/express": "^5.0.0",
|
|
95
|
+
"@types/node": "^22.0.0",
|
|
96
|
+
tsup: "^8.5.1",
|
|
97
|
+
typescript: "^5.4.0"
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
39
101
|
// src/version.ts
|
|
40
|
-
var VERSION =
|
|
102
|
+
var VERSION = package_default.version;
|
|
41
103
|
|
|
42
104
|
// src/index.ts
|
|
43
105
|
var import_zod3 = require("zod");
|
|
@@ -1321,14 +1383,16 @@ Task Creation & Verification:
|
|
|
1321
1383
|
|
|
1322
1384
|
Standard Task Workflow:
|
|
1323
1385
|
list_projects -> get_project_context -> list_tasks(state=TODO) -> get_task -> get_task_prompt (TODO)
|
|
1324
|
-
-> assign_task (returns suggested branch name)
|
|
1325
|
-
-> git
|
|
1326
|
-
->
|
|
1327
|
-
-> report_branch (tell server about the branch)
|
|
1386
|
+
-> assign_task (returns suggested branch name and worktree path)
|
|
1387
|
+
-> git worktree add <worktreePath> -b <branchName> <baseBranch>
|
|
1388
|
+
-> cd <worktreePath>
|
|
1328
1389
|
-> [update_progress...]
|
|
1390
|
+
-> git push -u origin <branchName>
|
|
1391
|
+
-> report_branch (tell server about the branch)
|
|
1329
1392
|
-> complete_task (returns PR suggestions)
|
|
1330
1393
|
-> gh pr create (local gh command)
|
|
1331
1394
|
-> report_pr (tell server about the PR)
|
|
1395
|
+
-> git worktree remove <worktreePath>
|
|
1332
1396
|
|
|
1333
1397
|
Resume Workflow:
|
|
1334
1398
|
check_active_task -> (if active) get_task -> get_task_prompt (IN_PROGRESS) -> update_progress -> complete_task
|
|
@@ -1344,10 +1408,14 @@ Error Recovery:
|
|
|
1344
1408
|
(abandon_task returns IN_PROGRESS tasks to TODO state)
|
|
1345
1409
|
|
|
1346
1410
|
GIT OPERATIONS NOTE:
|
|
1347
|
-
The agent handles all git operations locally
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1411
|
+
The agent handles all git operations locally using git worktrees for isolation.
|
|
1412
|
+
After assign_task returns a suggested branch name and worktree path:
|
|
1413
|
+
1. Create worktree: git worktree add <worktreePath> -b <branchName> <baseBranch>
|
|
1414
|
+
2. Work in worktree directory: cd <worktreePath>
|
|
1415
|
+
3. After completing work, push and call report_branch
|
|
1416
|
+
4. After complete_task, create PR with gh and call report_pr
|
|
1417
|
+
5. Clean up worktree: git worktree remove <worktreePath>
|
|
1418
|
+
Worktrees enable parallel task execution without git conflicts.
|
|
1351
1419
|
|
|
1352
1420
|
TASK STATE FLOW:
|
|
1353
1421
|
DRAFT -> TODO -> IN_PROGRESS -> REVIEW -> DONE
|
|
@@ -1367,7 +1435,7 @@ CONSTRAINTS:
|
|
|
1367
1435
|
- Always check_active_task before starting new work
|
|
1368
1436
|
- Call update_progress frequently to checkpoint
|
|
1369
1437
|
- Agent must have git/gh CLI configured for local git operations`;
|
|
1370
|
-
|
|
1438
|
+
function initializeMCPServer(apiClient, authContext) {
|
|
1371
1439
|
const server = new import_mcp.McpServer(
|
|
1372
1440
|
{
|
|
1373
1441
|
name: "collab",
|
|
@@ -1377,16 +1445,6 @@ async function createMCPServer() {
|
|
|
1377
1445
|
instructions: COLLAB_SERVER_INSTRUCTIONS
|
|
1378
1446
|
}
|
|
1379
1447
|
);
|
|
1380
|
-
const apiClient = createApiClientFromEnv();
|
|
1381
|
-
let authContext;
|
|
1382
|
-
try {
|
|
1383
|
-
authContext = await apiClient.authenticate();
|
|
1384
|
-
} catch (error) {
|
|
1385
|
-
if (error instanceof ApiError) {
|
|
1386
|
-
throw new Error(`Authentication failed: ${error.message}`);
|
|
1387
|
-
}
|
|
1388
|
-
throw error;
|
|
1389
|
-
}
|
|
1390
1448
|
const mockApiKey = {
|
|
1391
1449
|
permissions: authContext.permissions.includes("ADMIN") ? ApiKeyPermission.ADMIN : authContext.permissions.includes("WRITE") ? ApiKeyPermission.WRITE : ApiKeyPermission.READ
|
|
1392
1450
|
};
|
|
@@ -1483,7 +1541,7 @@ async function createMCPServer() {
|
|
|
1483
1541
|
server.registerTool(
|
|
1484
1542
|
"assign_task",
|
|
1485
1543
|
{
|
|
1486
|
-
description: "Atomically claim a task
|
|
1544
|
+
description: "Atomically claim a task. Race-safe - fails if already assigned. Task must be TODO. Returns suggested branch name and worktree path for isolated parallel development.",
|
|
1487
1545
|
inputSchema: {
|
|
1488
1546
|
projectId: import_zod3.z.string().describe("The project ID"),
|
|
1489
1547
|
taskId: import_zod3.z.string().describe("The task ID to assign"),
|
|
@@ -2182,9 +2240,26 @@ async function createMCPServer() {
|
|
|
2182
2240
|
};
|
|
2183
2241
|
}
|
|
2184
2242
|
);
|
|
2185
|
-
|
|
2243
|
+
return server;
|
|
2244
|
+
}
|
|
2245
|
+
async function connectMCPServer(server, transport) {
|
|
2186
2246
|
await server.connect(transport);
|
|
2187
2247
|
}
|
|
2248
|
+
async function createMCPServer() {
|
|
2249
|
+
const apiClient = createApiClientFromEnv();
|
|
2250
|
+
let authContext;
|
|
2251
|
+
try {
|
|
2252
|
+
authContext = await apiClient.authenticate();
|
|
2253
|
+
} catch (error) {
|
|
2254
|
+
if (error instanceof ApiError) {
|
|
2255
|
+
throw new Error(`Authentication failed: ${error.message}`);
|
|
2256
|
+
}
|
|
2257
|
+
throw error;
|
|
2258
|
+
}
|
|
2259
|
+
const server = initializeMCPServer(apiClient, authContext);
|
|
2260
|
+
const transport = new import_stdio.StdioServerTransport();
|
|
2261
|
+
await connectMCPServer(server, transport);
|
|
2262
|
+
}
|
|
2188
2263
|
function handleApiError(error) {
|
|
2189
2264
|
if (error instanceof ApiError) {
|
|
2190
2265
|
return {
|
|
@@ -2221,6 +2296,7 @@ var ActiveTaskSchema = import_zod3.z.object({
|
|
|
2221
2296
|
taskId: import_zod3.z.string().min(1),
|
|
2222
2297
|
projectId: import_zod3.z.string().min(1),
|
|
2223
2298
|
branchName: import_zod3.z.string().optional(),
|
|
2299
|
+
worktreePath: import_zod3.z.string().optional(),
|
|
2224
2300
|
startedAt: import_zod3.z.string().optional()
|
|
2225
2301
|
});
|
|
2226
2302
|
async function checkActiveTask() {
|
|
@@ -2292,6 +2368,11 @@ async function checkActiveTask() {
|
|
|
2292
2368
|
}
|
|
2293
2369
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2294
2370
|
0 && (module.exports = {
|
|
2295
|
-
|
|
2371
|
+
ApiError,
|
|
2372
|
+
MCPApiClient,
|
|
2373
|
+
VERSION,
|
|
2374
|
+
connectMCPServer,
|
|
2375
|
+
createMCPServer,
|
|
2376
|
+
initializeMCPServer
|
|
2296
2377
|
});
|
|
2297
2378
|
//# sourceMappingURL=index.js.map
|