@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 CHANGED
@@ -498,6 +498,12 @@ report_error -> abandon_task -> list_tasks -> assign_task (retry or pick differe
498
498
 
499
499
  ## Usage
500
500
 
501
+ There are two ways to use the Collab MCP server:
502
+
503
+ ### Option 1: Local Installation (Recommended for Claude Desktop)
504
+
505
+ Install and run locally using stdio transport:
506
+
501
507
  1. Configure your environment variables
502
508
  2. Add to your MCP client configuration (Claude Desktop, OpenCode, etc.):
503
509
 
@@ -518,6 +524,27 @@ report_error -> abandon_task -> list_tasks -> assign_task (retry or pick differe
518
524
 
519
525
  3. Use the tools from your AI agent
520
526
 
527
+ ### Option 2: Remote HTTP Server
528
+
529
+ Connect to the Collab MCP server using the Streamable HTTP transport. This is useful for:
530
+ - Claude.ai and Claude Mobile (which don't support local MCP servers)
531
+ - Environments where you can't install npm packages
532
+
533
+ Configure your MCP client to connect to the remote server:
534
+
535
+ ```json
536
+ {
537
+ "mcpServers": {
538
+ "collab": {
539
+ "url": "https://collab.mtaap.de/mcp",
540
+ "headers": {
541
+ "X-API-Key": "your-api-key"
542
+ }
543
+ }
544
+ }
545
+ }
546
+ ```
547
+
521
548
  ## Troubleshooting
522
549
 
523
550
  ### "COLLAB_API_KEY is required"
package/dist/cli.js CHANGED
@@ -27,8 +27,65 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
28
28
  var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
29
29
 
30
+ // package.json
31
+ var package_default = {
32
+ name: "@mtaap/mcp",
33
+ version: "0.2.12",
34
+ description: "Model Context Protocol (MCP) server for AI agents to interact with Collab - the multi-tenant collaborative agent development platform",
35
+ mcpName: "collab",
36
+ scripts: {
37
+ build: "tsup"
38
+ },
39
+ main: "./dist/index.js",
40
+ types: "./dist/index.d.ts",
41
+ bin: {
42
+ "collab-mcp": "./dist/cli.js",
43
+ "collab-mcp-server": "./dist/server.js"
44
+ },
45
+ publishConfig: {
46
+ access: "public"
47
+ },
48
+ exports: {
49
+ ".": {
50
+ types: "./dist/index.d.ts",
51
+ require: "./dist/index.js"
52
+ }
53
+ },
54
+ files: [
55
+ "dist"
56
+ ],
57
+ keywords: [
58
+ "mcp",
59
+ "model-context-protocol",
60
+ "ai",
61
+ "agent",
62
+ "collaboration",
63
+ "task-management",
64
+ "claude",
65
+ "anthropic"
66
+ ],
67
+ license: "Proprietary",
68
+ author: "MTAAP Contributors",
69
+ engines: {
70
+ node: ">=18.18.0"
71
+ },
72
+ dependencies: {
73
+ "@modelcontextprotocol/sdk": "^1.0.0",
74
+ express: "^5.0.1",
75
+ zod: "^4.3.5"
76
+ },
77
+ devDependencies: {
78
+ "@mtaap/config-typescript": "workspace:*",
79
+ "@mtaap/core": "workspace:*",
80
+ "@types/express": "^5.0.0",
81
+ "@types/node": "^22.0.0",
82
+ tsup: "^8.5.1",
83
+ typescript: "^5.4.0"
84
+ }
85
+ };
86
+
30
87
  // src/version.ts
31
- var VERSION = "0.2.7";
88
+ var VERSION = package_default.version;
32
89
 
33
90
  // src/index.ts
34
91
  var import_zod3 = require("zod");
@@ -1312,14 +1369,16 @@ Task Creation & Verification:
1312
1369
 
1313
1370
  Standard Task Workflow:
1314
1371
  list_projects -> get_project_context -> list_tasks(state=TODO) -> get_task -> get_task_prompt (TODO)
1315
- -> assign_task (returns suggested branch name)
1316
- -> git checkout -b <branchName> (local git command)
1317
- -> git push -u origin <branchName> (local git command)
1318
- -> report_branch (tell server about the branch)
1372
+ -> assign_task (returns suggested branch name and worktree path)
1373
+ -> git worktree add <worktreePath> -b <branchName> <baseBranch>
1374
+ -> cd <worktreePath>
1319
1375
  -> [update_progress...]
1376
+ -> git push -u origin <branchName>
1377
+ -> report_branch (tell server about the branch)
1320
1378
  -> complete_task (returns PR suggestions)
1321
1379
  -> gh pr create (local gh command)
1322
1380
  -> report_pr (tell server about the PR)
1381
+ -> git worktree remove <worktreePath>
1323
1382
 
1324
1383
  Resume Workflow:
1325
1384
  check_active_task -> (if active) get_task -> get_task_prompt (IN_PROGRESS) -> update_progress -> complete_task
@@ -1335,10 +1394,14 @@ Error Recovery:
1335
1394
  (abandon_task returns IN_PROGRESS tasks to TODO state)
1336
1395
 
1337
1396
  GIT OPERATIONS NOTE:
1338
- The agent handles all git operations locally. After assign_task returns a suggested branch name,
1339
- the agent creates the branch with git, pushes it, and reports it via report_branch.
1340
- After complete_task returns PR suggestions, the agent creates the PR with gh, and reports it via report_pr.
1341
- This eliminates the need for GitHub tokens on the server.
1397
+ The agent handles all git operations locally using git worktrees for isolation.
1398
+ After assign_task returns a suggested branch name and worktree path:
1399
+ 1. Create worktree: git worktree add <worktreePath> -b <branchName> <baseBranch>
1400
+ 2. Work in worktree directory: cd <worktreePath>
1401
+ 3. After completing work, push and call report_branch
1402
+ 4. After complete_task, create PR with gh and call report_pr
1403
+ 5. Clean up worktree: git worktree remove <worktreePath>
1404
+ Worktrees enable parallel task execution without git conflicts.
1342
1405
 
1343
1406
  TASK STATE FLOW:
1344
1407
  DRAFT -> TODO -> IN_PROGRESS -> REVIEW -> DONE
@@ -1358,7 +1421,7 @@ CONSTRAINTS:
1358
1421
  - Always check_active_task before starting new work
1359
1422
  - Call update_progress frequently to checkpoint
1360
1423
  - Agent must have git/gh CLI configured for local git operations`;
1361
- async function createMCPServer() {
1424
+ function initializeMCPServer(apiClient, authContext) {
1362
1425
  const server = new import_mcp.McpServer(
1363
1426
  {
1364
1427
  name: "collab",
@@ -1368,16 +1431,6 @@ async function createMCPServer() {
1368
1431
  instructions: COLLAB_SERVER_INSTRUCTIONS
1369
1432
  }
1370
1433
  );
1371
- const apiClient = createApiClientFromEnv();
1372
- let authContext;
1373
- try {
1374
- authContext = await apiClient.authenticate();
1375
- } catch (error) {
1376
- if (error instanceof ApiError) {
1377
- throw new Error(`Authentication failed: ${error.message}`);
1378
- }
1379
- throw error;
1380
- }
1381
1434
  const mockApiKey = {
1382
1435
  permissions: authContext.permissions.includes("ADMIN") ? ApiKeyPermission.ADMIN : authContext.permissions.includes("WRITE") ? ApiKeyPermission.WRITE : ApiKeyPermission.READ
1383
1436
  };
@@ -1474,7 +1527,7 @@ async function createMCPServer() {
1474
1527
  server.registerTool(
1475
1528
  "assign_task",
1476
1529
  {
1477
- description: "Atomically claim a task and create git branch. Race-safe - fails if already assigned. Task must be TODO.",
1530
+ 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.",
1478
1531
  inputSchema: {
1479
1532
  projectId: import_zod3.z.string().describe("The project ID"),
1480
1533
  taskId: import_zod3.z.string().describe("The task ID to assign"),
@@ -2173,9 +2226,26 @@ async function createMCPServer() {
2173
2226
  };
2174
2227
  }
2175
2228
  );
2176
- const transport = new import_stdio.StdioServerTransport();
2229
+ return server;
2230
+ }
2231
+ async function connectMCPServer(server, transport) {
2177
2232
  await server.connect(transport);
2178
2233
  }
2234
+ async function createMCPServer() {
2235
+ const apiClient = createApiClientFromEnv();
2236
+ let authContext;
2237
+ try {
2238
+ authContext = await apiClient.authenticate();
2239
+ } catch (error) {
2240
+ if (error instanceof ApiError) {
2241
+ throw new Error(`Authentication failed: ${error.message}`);
2242
+ }
2243
+ throw error;
2244
+ }
2245
+ const server = initializeMCPServer(apiClient, authContext);
2246
+ const transport = new import_stdio.StdioServerTransport();
2247
+ await connectMCPServer(server, transport);
2248
+ }
2179
2249
  function handleApiError(error) {
2180
2250
  if (error instanceof ApiError) {
2181
2251
  return {
@@ -2212,6 +2282,7 @@ var ActiveTaskSchema = import_zod3.z.object({
2212
2282
  taskId: import_zod3.z.string().min(1),
2213
2283
  projectId: import_zod3.z.string().min(1),
2214
2284
  branchName: import_zod3.z.string().optional(),
2285
+ worktreePath: import_zod3.z.string().optional(),
2215
2286
  startedAt: import_zod3.z.string().optional()
2216
2287
  });
2217
2288
  async function checkActiveTask() {
@@ -2365,15 +2436,17 @@ function validateEnvironment() {
2365
2436
  async function checkConnectivity() {
2366
2437
  const baseUrl = process.env.COLLAB_BASE_URL;
2367
2438
  console.error(`[collab-mcp] Checking connectivity to ${baseUrl}...`);
2439
+ const controller = new AbortController();
2440
+ const timeoutId = setTimeout(() => controller.abort(), 1e4);
2368
2441
  try {
2369
2442
  const response = await fetch(`${baseUrl}/api/mcp/auth`, {
2370
2443
  method: "GET",
2371
2444
  headers: {
2372
2445
  "X-API-Key": process.env.COLLAB_API_KEY
2373
2446
  },
2374
- signal: AbortSignal.timeout(1e4)
2375
- // 10 second timeout
2447
+ signal: controller.signal
2376
2448
  });
2449
+ clearTimeout(timeoutId);
2377
2450
  if (!response.ok) {
2378
2451
  const data = await response.json().catch(() => ({}));
2379
2452
  if (response.status === 401) {
@@ -2385,7 +2458,8 @@ async function checkConnectivity() {
2385
2458
  }
2386
2459
  console.error("[collab-mcp] Connected successfully");
2387
2460
  } catch (error) {
2388
- if (error instanceof Error && error.name === "TimeoutError") {
2461
+ clearTimeout(timeoutId);
2462
+ if (error instanceof Error && error.name === "AbortError") {
2389
2463
  console.error(`[collab-mcp] Error: Connection timed out to ${baseUrl}`);
2390
2464
  } else {
2391
2465
  console.error(`[collab-mcp] Error: Could not connect to ${baseUrl}`);