cascrow-mcp 1.0.2 → 1.1.1

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 (2) hide show
  1. package/index.js +73 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -241,6 +241,42 @@ const TOOLS = [
241
241
  },
242
242
  },
243
243
  },
244
+ {
245
+ name: "cascrow_handoff",
246
+ description:
247
+ "Send a contract invite to a Builder agent by Agent ID. " +
248
+ "Use this after cascrow_create_contract to delegate the work to another agent. " +
249
+ "The Builder agent will automatically pick up the invite via cascrow_check_invites.",
250
+ inputSchema: {
251
+ type: "object",
252
+ required: ["inviteCode", "builderAgentId", "contractId"],
253
+ properties: {
254
+ inviteCode: { type: "string", description: "The invite code returned by cascrow_create_contract" },
255
+ builderAgentId: { type: "string", description: "The Agent ID of the Builder agent (from cascrow_get_agent_id)" },
256
+ contractId: { type: "string", description: "The contract ID returned by cascrow_create_contract" },
257
+ message: { type: "string", description: "Optional instructions for the Builder agent" },
258
+ },
259
+ },
260
+ },
261
+ {
262
+ name: "cascrow_get_agent_id",
263
+ description: "Get this agent's own Agent ID. Share this with Requester agents so they can send you work via cascrow_handoff.",
264
+ inputSchema: {
265
+ type: "object",
266
+ properties: {},
267
+ },
268
+ },
269
+ {
270
+ name: "cascrow_check_invites",
271
+ description:
272
+ "Check for pending contract invites sent to this agent. " +
273
+ "Use this as a Builder agent to discover work assigned to you. " +
274
+ "Returns unclaimed invites and marks them as claimed. Poll every few seconds until an invite appears.",
275
+ inputSchema: {
276
+ type: "object",
277
+ properties: {},
278
+ },
279
+ },
244
280
  ];
245
281
 
246
282
  // ─── Tool handlers ────────────────────────────────────────────────────────────
@@ -346,6 +382,34 @@ async function handleGetContract({ contractId }) {
346
382
  return data;
347
383
  }
348
384
 
385
+ async function handleHandoff({ inviteCode, builderAgentId, contractId, message }) {
386
+ const data = await apiPost("/api/agent/handoff", { inviteCode, builderAgentId, contractId, message });
387
+ return {
388
+ handoffId: data.handoffId,
389
+ message: `Contract handed off to Agent ${builderAgentId}. They will pick it up automatically via cascrow_check_invites.`,
390
+ };
391
+ }
392
+
393
+ async function handleGetAgentId() {
394
+ const data = await apiGet("/api/agent/me");
395
+ return {
396
+ agentId: data.agentId,
397
+ message: `Your Agent ID is: ${data.agentId}. Share this with Requester agents so they can send you work.`,
398
+ };
399
+ }
400
+
401
+ async function handleCheckInvites() {
402
+ const data = await apiGet("/api/agent/pending-invites");
403
+ const invites = data.invites ?? [];
404
+ if (invites.length === 0) {
405
+ return { invites: [], message: "No pending invites. Poll again in a few seconds." };
406
+ }
407
+ return {
408
+ invites,
409
+ message: `Found ${invites.length} invite(s). Use cascrow_join_contract with the inviteCode to accept.`,
410
+ };
411
+ }
412
+
349
413
  // ─── MCP Server ───────────────────────────────────────────────────────────────
350
414
 
351
415
  const server = new Server(
@@ -381,6 +445,15 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
381
445
  case "cascrow_get_contract":
382
446
  result = await handleGetContract(args);
383
447
  break;
448
+ case "cascrow_handoff":
449
+ result = await handleHandoff(args);
450
+ break;
451
+ case "cascrow_check_invites":
452
+ result = await handleCheckInvites();
453
+ break;
454
+ case "cascrow_get_agent_id":
455
+ result = await handleGetAgentId();
456
+ break;
384
457
  default:
385
458
  throw new Error(`Unknown tool: ${name}`);
386
459
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cascrow-mcp",
3
- "version": "1.0.2",
3
+ "version": "1.1.1",
4
4
  "description": "MCP server for Cascrow — agentic escrow and verification",
5
5
  "type": "module",
6
6
  "main": "index.js",