cyberdyne-mcp 0.6.0 → 0.6.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.
package/README.md CHANGED
@@ -31,7 +31,8 @@ wallet is then used automatically for pool-budget signing — zero env vars.
31
31
  An agent already running inside an LLM with this MCP connected can **self-onboard
32
32
  with zero web interaction** by calling the `onboard` tool — it's the one tool that
33
33
  works without an existing key and bootstraps everything else. After that it can
34
- fund (`get_deposit_address` → send USDC on Base → `deposit`) and `post_task`.
34
+ fund (`get_deposit_address` → send USDC on Base → `deposit`) and `post_task` — and
35
+ `withdraw_treasury` to recover unspent treasury to your wallet.
35
36
 
36
37
  > Mirrors the Bankr CLI UX (`bankr login` → wallet + API key in one shot). The
37
38
  > human **submit-proof** step is intentionally still in the app (human-only); every
@@ -101,6 +102,7 @@ post_task (quantity > 1) → { task, authIntent, depl
101
102
  | `fund_treasury` | `POST /api/treasury/fund` | **Testnet/demo** top-up (disabled on the live rail). |
102
103
  | `get_deposit_address` | `GET /api/treasury/deposit` | Where to send real USDC to fund the treasury (live rail). |
103
104
  | `deposit` | `POST /api/treasury/deposit` | Credit the treasury from a real on-chain USDC deposit (tx hash). |
105
+ | `withdraw_treasury` | `POST /api/treasury/withdraw` | Recover unspent treasury to your wallet — pull USDC back to your own verified deposit wallet on Base (live rail; no destination param, so funds can only go to you). |
104
106
  | `post_task` | `POST /api/tasks` | Open a task. `reward_usd` is the budget; not charged until authorize. Pool/FCFS response also carries `authIntent` + `deployFee`. |
105
107
  | `assign_task` | `POST /api/tasks/[id]/assign` | Direct hire: assign to a human; returns `{ task, authIntent }` (authIntent is `null` on the custodial/manual rail). |
106
108
  | `authorize_task` | `POST /api/tasks/[id]/authorize` | Open the escrow hold. Custodial/manual: just `task_id`. On-chain direct hire: `auth_intent`/`signed_payment`. Pool/FCFS: also `deploy_fee`/`fee_tx_hash`. |
package/dist/server.js CHANGED
@@ -12,6 +12,7 @@
12
12
  * fund_treasury — POST /api/treasury/fund → demo top-up (testnet only)
13
13
  * get_deposit_address — GET /api/treasury/deposit → where to send real USDC (live)
14
14
  * deposit — POST /api/treasury/deposit → credit treasury from a real USDC tx
15
+ * withdraw_treasury — POST /api/treasury/withdraw → pull unspent treasury back to your wallet (live)
15
16
  * post_task — POST /api/tasks → open a task
16
17
  * assign_task — POST /api/tasks/[id]/assign → pick a human (→ authIntent)
17
18
  * authorize_task — POST /api/tasks/[id]/authorize → open the escrow hold
@@ -136,7 +137,7 @@ async function guard(fn) {
136
137
  }
137
138
  }
138
139
  // ---- Server ---------------------------------------------------------------
139
- const server = new McpServer({ name: "cyberdyne", version: "0.6.0" });
140
+ const server = new McpServer({ name: "cyberdyne", version: "0.6.1" });
140
141
  server.tool("list_categories", "List the kinds of real-world work CYBERDYNE humans can do. Static (no network). Use this to learn the valid `category` values before posting a task.", {}, async () => json(Object.entries(CATEGORIES).map(([id, blurb]) => ({ id, blurb }))));
141
142
  server.tool("onboard", "BOOTSTRAP (works WITHOUT an existing key — the one tool that self-onboards). Zero-browser: generates a fresh wallet if you don't have one, signs in to CYBERDYNE with it (SIWE), mints your `cyb_` agent API key, and saves both to ~/.cyberdyne/config.json (0600) so every other tool here authenticates automatically. No web dashboard, no env vars. Returns your wallet address, the cyb_ key (shown once), and the next steps (fund via get_deposit_address+deposit → post_task → assign → authorize → release). The same generated wallet auto-signs pool budgets. Idempotent-ish: re-running with a saved wallet reuses it and mints a fresh key.", {}, async () => guard(async () => {
142
143
  const r = await onboard();
@@ -170,6 +171,7 @@ server.tool("deposit", "Credit your treasury from a REAL on-chain USDC deposit (
170
171
  .regex(/^0x[0-9a-fA-F]{64}$/)
171
172
  .describe("The Base tx hash of your USDC transfer to the deposit address."),
172
173
  }, async ({ tx_hash }) => guard(() => client.rest("POST", "/api/treasury/deposit", { body: { tx_hash } })));
174
+ server.tool("withdraw_treasury", "Recover UNSPENT treasury to your wallet (live rail): pull USDC out of your treasury back to your own VERIFIED deposit wallet on Base — no browser. Available balance is your treasury balance net of any open escrow holds. Funds can ONLY go to your verified wallet (no destination param), so a leaked key can't redirect them. Returns { ok, tx_hash, amount_usd, to }. 400 insufficient_treasury if the balance can't cover it; 403 withdraws_disabled on the demo rail.", { amount_usd: z.number().positive().describe("USD to withdraw from your treasury to your verified wallet.") }, async ({ amount_usd }) => guard(() => client.rest("POST", "/api/treasury/withdraw", { body: { amount_usd } })));
173
175
  server.tool("post_task", "Open a task on the marketplace. Funds are NOT charged at post — the escrow hold opens later at authorize_task. `reward_usd` is the total budget; with quantity>1 each unit holds reward_usd/quantity (each unit must be >= $0.01). Returns the created task (with its id). DIRECT-HIRE / custodial rail (the path live today): the platform checks the prefunded treasury can cover the budget (402 insufficient_treasury otherwise); response is { task }. POOL/FCFS rail (only when the server enables it): response also includes `authIntent` (the budget authorization to sign) and `deployFee` { usd, bps, recipient, token } (a SEPARATE non-refundable fee tx) — pass both to authorize_task.", {
174
176
  title: z.string().min(2).max(160).describe("Short task title."),
175
177
  category: z.enum(TASK_CATEGORIES),
@@ -311,4 +313,4 @@ const transport = new StdioServerTransport();
311
313
  await server.connect(transport);
312
314
  console.error(`CYBERDYNE MCP server running on stdio → ${config.apiUrl}` +
313
315
  (config.token ? "" : " (no key — run `npx cyberdyne-mcp onboard` to self-generate a wallet + key, or `login cyb_…`, or set CYBERDYNE_IDENTITY_TOKEN; networked tools error until then)") +
314
- ". Tools (14): onboard, list_categories, search_humans, get_treasury, fund_treasury, get_deposit_address, deposit, post_task, assign_task, authorize_task, get_task, release_payment, review_submission, close_task.");
316
+ ". Tools (15): onboard, list_categories, search_humans, get_treasury, fund_treasury, get_deposit_address, deposit, withdraw_treasury, post_task, assign_task, authorize_task, get_task, release_payment, review_submission, close_task.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cyberdyne-mcp",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/server.ts CHANGED
@@ -12,6 +12,7 @@
12
12
  * fund_treasury — POST /api/treasury/fund → demo top-up (testnet only)
13
13
  * get_deposit_address — GET /api/treasury/deposit → where to send real USDC (live)
14
14
  * deposit — POST /api/treasury/deposit → credit treasury from a real USDC tx
15
+ * withdraw_treasury — POST /api/treasury/withdraw → pull unspent treasury back to your wallet (live)
15
16
  * post_task — POST /api/tasks → open a task
16
17
  * assign_task — POST /api/tasks/[id]/assign → pick a human (→ authIntent)
17
18
  * authorize_task — POST /api/tasks/[id]/authorize → open the escrow hold
@@ -147,7 +148,7 @@ async function guard<T>(fn: () => Promise<T>) {
147
148
 
148
149
  // ---- Server ---------------------------------------------------------------
149
150
 
150
- const server = new McpServer({ name: "cyberdyne", version: "0.6.0" });
151
+ const server = new McpServer({ name: "cyberdyne", version: "0.6.1" });
151
152
 
152
153
  server.tool(
153
154
  "list_categories",
@@ -230,6 +231,14 @@ server.tool(
230
231
  guard(() => client.rest("POST", "/api/treasury/deposit", { body: { tx_hash } })),
231
232
  );
232
233
 
234
+ server.tool(
235
+ "withdraw_treasury",
236
+ "Recover UNSPENT treasury to your wallet (live rail): pull USDC out of your treasury back to your own VERIFIED deposit wallet on Base — no browser. Available balance is your treasury balance net of any open escrow holds. Funds can ONLY go to your verified wallet (no destination param), so a leaked key can't redirect them. Returns { ok, tx_hash, amount_usd, to }. 400 insufficient_treasury if the balance can't cover it; 403 withdraws_disabled on the demo rail.",
237
+ { amount_usd: z.number().positive().describe("USD to withdraw from your treasury to your verified wallet.") },
238
+ async ({ amount_usd }) =>
239
+ guard(() => client.rest("POST", "/api/treasury/withdraw", { body: { amount_usd } })),
240
+ );
241
+
233
242
  server.tool(
234
243
  "post_task",
235
244
  "Open a task on the marketplace. Funds are NOT charged at post — the escrow hold opens later at authorize_task. `reward_usd` is the total budget; with quantity>1 each unit holds reward_usd/quantity (each unit must be >= $0.01). Returns the created task (with its id). DIRECT-HIRE / custodial rail (the path live today): the platform checks the prefunded treasury can cover the budget (402 insufficient_treasury otherwise); response is { task }. POOL/FCFS rail (only when the server enables it): response also includes `authIntent` (the budget authorization to sign) and `deployFee` { usd, bps, recipient, token } (a SEPARATE non-refundable fee tx) — pass both to authorize_task.",
@@ -433,5 +442,5 @@ await server.connect(transport);
433
442
  console.error(
434
443
  `CYBERDYNE MCP server running on stdio → ${config.apiUrl}` +
435
444
  (config.token ? "" : " (no key — run `npx cyberdyne-mcp onboard` to self-generate a wallet + key, or `login cyb_…`, or set CYBERDYNE_IDENTITY_TOKEN; networked tools error until then)") +
436
- ". Tools (14): onboard, list_categories, search_humans, get_treasury, fund_treasury, get_deposit_address, deposit, post_task, assign_task, authorize_task, get_task, release_payment, review_submission, close_task.",
445
+ ". Tools (15): onboard, list_categories, search_humans, get_treasury, fund_treasury, get_deposit_address, deposit, withdraw_treasury, post_task, assign_task, authorize_task, get_task, release_payment, review_submission, close_task.",
437
446
  );