@mtaap/mcp 0.2.12 → 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
@@ -30,7 +30,7 @@ var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
30
30
  // package.json
31
31
  var package_default = {
32
32
  name: "@mtaap/mcp",
33
- version: "0.2.11",
33
+ version: "0.2.12",
34
34
  description: "Model Context Protocol (MCP) server for AI agents to interact with Collab - the multi-tenant collaborative agent development platform",
35
35
  mcpName: "collab",
36
36
  scripts: {
@@ -39,7 +39,8 @@ var package_default = {
39
39
  main: "./dist/index.js",
40
40
  types: "./dist/index.d.ts",
41
41
  bin: {
42
- "collab-mcp": "./dist/cli.js"
42
+ "collab-mcp": "./dist/cli.js",
43
+ "collab-mcp-server": "./dist/server.js"
43
44
  },
44
45
  publishConfig: {
45
46
  access: "public"
@@ -70,11 +71,13 @@ var package_default = {
70
71
  },
71
72
  dependencies: {
72
73
  "@modelcontextprotocol/sdk": "^1.0.0",
74
+ express: "^5.0.1",
73
75
  zod: "^4.3.5"
74
76
  },
75
77
  devDependencies: {
76
78
  "@mtaap/config-typescript": "workspace:*",
77
79
  "@mtaap/core": "workspace:*",
80
+ "@types/express": "^5.0.0",
78
81
  "@types/node": "^22.0.0",
79
82
  tsup: "^8.5.1",
80
83
  typescript: "^5.4.0"
@@ -1366,14 +1369,16 @@ Task Creation & Verification:
1366
1369
 
1367
1370
  Standard Task Workflow:
1368
1371
  list_projects -> get_project_context -> list_tasks(state=TODO) -> get_task -> get_task_prompt (TODO)
1369
- -> assign_task (returns suggested branch name)
1370
- -> git checkout -b <branchName> (local git command)
1371
- -> git push -u origin <branchName> (local git command)
1372
- -> 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>
1373
1375
  -> [update_progress...]
1376
+ -> git push -u origin <branchName>
1377
+ -> report_branch (tell server about the branch)
1374
1378
  -> complete_task (returns PR suggestions)
1375
1379
  -> gh pr create (local gh command)
1376
1380
  -> report_pr (tell server about the PR)
1381
+ -> git worktree remove <worktreePath>
1377
1382
 
1378
1383
  Resume Workflow:
1379
1384
  check_active_task -> (if active) get_task -> get_task_prompt (IN_PROGRESS) -> update_progress -> complete_task
@@ -1389,10 +1394,14 @@ Error Recovery:
1389
1394
  (abandon_task returns IN_PROGRESS tasks to TODO state)
1390
1395
 
1391
1396
  GIT OPERATIONS NOTE:
1392
- The agent handles all git operations locally. After assign_task returns a suggested branch name,
1393
- the agent creates the branch with git, pushes it, and reports it via report_branch.
1394
- After complete_task returns PR suggestions, the agent creates the PR with gh, and reports it via report_pr.
1395
- 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.
1396
1405
 
1397
1406
  TASK STATE FLOW:
1398
1407
  DRAFT -> TODO -> IN_PROGRESS -> REVIEW -> DONE
@@ -1412,7 +1421,7 @@ CONSTRAINTS:
1412
1421
  - Always check_active_task before starting new work
1413
1422
  - Call update_progress frequently to checkpoint
1414
1423
  - Agent must have git/gh CLI configured for local git operations`;
1415
- async function createMCPServer() {
1424
+ function initializeMCPServer(apiClient, authContext) {
1416
1425
  const server = new import_mcp.McpServer(
1417
1426
  {
1418
1427
  name: "collab",
@@ -1422,16 +1431,6 @@ async function createMCPServer() {
1422
1431
  instructions: COLLAB_SERVER_INSTRUCTIONS
1423
1432
  }
1424
1433
  );
1425
- const apiClient = createApiClientFromEnv();
1426
- let authContext;
1427
- try {
1428
- authContext = await apiClient.authenticate();
1429
- } catch (error) {
1430
- if (error instanceof ApiError) {
1431
- throw new Error(`Authentication failed: ${error.message}`);
1432
- }
1433
- throw error;
1434
- }
1435
1434
  const mockApiKey = {
1436
1435
  permissions: authContext.permissions.includes("ADMIN") ? ApiKeyPermission.ADMIN : authContext.permissions.includes("WRITE") ? ApiKeyPermission.WRITE : ApiKeyPermission.READ
1437
1436
  };
@@ -1528,7 +1527,7 @@ async function createMCPServer() {
1528
1527
  server.registerTool(
1529
1528
  "assign_task",
1530
1529
  {
1531
- 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.",
1532
1531
  inputSchema: {
1533
1532
  projectId: import_zod3.z.string().describe("The project ID"),
1534
1533
  taskId: import_zod3.z.string().describe("The task ID to assign"),
@@ -2227,9 +2226,26 @@ async function createMCPServer() {
2227
2226
  };
2228
2227
  }
2229
2228
  );
2230
- const transport = new import_stdio.StdioServerTransport();
2229
+ return server;
2230
+ }
2231
+ async function connectMCPServer(server, transport) {
2231
2232
  await server.connect(transport);
2232
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
+ }
2233
2249
  function handleApiError(error) {
2234
2250
  if (error instanceof ApiError) {
2235
2251
  return {
@@ -2266,6 +2282,7 @@ var ActiveTaskSchema = import_zod3.z.object({
2266
2282
  taskId: import_zod3.z.string().min(1),
2267
2283
  projectId: import_zod3.z.string().min(1),
2268
2284
  branchName: import_zod3.z.string().optional(),
2285
+ worktreePath: import_zod3.z.string().optional(),
2269
2286
  startedAt: import_zod3.z.string().optional()
2270
2287
  });
2271
2288
  async function checkActiveTask() {
@@ -2419,15 +2436,17 @@ function validateEnvironment() {
2419
2436
  async function checkConnectivity() {
2420
2437
  const baseUrl = process.env.COLLAB_BASE_URL;
2421
2438
  console.error(`[collab-mcp] Checking connectivity to ${baseUrl}...`);
2439
+ const controller = new AbortController();
2440
+ const timeoutId = setTimeout(() => controller.abort(), 1e4);
2422
2441
  try {
2423
2442
  const response = await fetch(`${baseUrl}/api/mcp/auth`, {
2424
2443
  method: "GET",
2425
2444
  headers: {
2426
2445
  "X-API-Key": process.env.COLLAB_API_KEY
2427
2446
  },
2428
- signal: AbortSignal.timeout(1e4)
2429
- // 10 second timeout
2447
+ signal: controller.signal
2430
2448
  });
2449
+ clearTimeout(timeoutId);
2431
2450
  if (!response.ok) {
2432
2451
  const data = await response.json().catch(() => ({}));
2433
2452
  if (response.status === 401) {
@@ -2439,7 +2458,8 @@ async function checkConnectivity() {
2439
2458
  }
2440
2459
  console.error("[collab-mcp] Connected successfully");
2441
2460
  } catch (error) {
2442
- if (error instanceof Error && error.name === "TimeoutError") {
2461
+ clearTimeout(timeoutId);
2462
+ if (error instanceof Error && error.name === "AbortError") {
2443
2463
  console.error(`[collab-mcp] Error: Connection timed out to ${baseUrl}`);
2444
2464
  } else {
2445
2465
  console.error(`[collab-mcp] Error: Could not connect to ${baseUrl}`);