@priors/mcp 0.6.1 → 0.6.2

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
@@ -42,7 +42,9 @@ repaying.
42
42
  | `pt_redeem(amount_pt \| "all", slippage_bps?, dry_run?)` | redeem the wallet's PT-USDG for USDG 1:1, from maturity (2027-03-25) on; needs ETH for gas | yes |
43
43
 
44
44
  Tools that move money state the amounts in their answer, are marked destructive for MCP clients, and their
45
- descriptions tell the assistant to confirm with you first. Merchant text (response bodies, listings, redirect targets)
45
+ descriptions tell the assistant to confirm with you first. They run one at a time and each answers within 45 s, under an
46
+ MCP client's usual 60 s timeout: one whose transactions have not confirmed by then says so and goes on, and a money
47
+ call made meanwhile does nothing and says so. Merchant text (response bodies, listings, redirect targets)
46
48
  comes back between random `<<merchant-data …>>` markers, as data. They act on Robinhood Chain mainnet.
47
49
 
48
50
  ## Savings
@@ -132,7 +134,7 @@ Settings → Developer → Edit Config (`claude_desktop_config.json`), then rest
132
134
  "mcpServers": {
133
135
  "priors": {
134
136
  "command": "npx",
135
- "args": ["-y", "@priors/mcp@0.6.1"],
137
+ "args": ["-y", "@priors/mcp@0.6.2"],
136
138
  "env": {
137
139
  "PRIORS_KEY": "0xYOUR_AGENT_WALLET_KEY",
138
140
  "PRIORS_AGENT_ID": "1234"
@@ -154,7 +156,7 @@ A project `.mcp.json` that reads the key from your shell's environment, so the f
154
156
  "mcpServers": {
155
157
  "priors": {
156
158
  "command": "npx",
157
- "args": ["-y", "@priors/mcp@0.6.1"],
159
+ "args": ["-y", "@priors/mcp@0.6.2"],
158
160
  "env": {
159
161
  "PRIORS_KEY": "${PRIORS_KEY}",
160
162
  "PRIORS_AGENT_ID": "${PRIORS_AGENT_ID:-}"
@@ -164,7 +166,7 @@ A project `.mcp.json` that reads the key from your shell's environment, so the f
164
166
  }
165
167
  ```
166
168
 
167
- or, for your user only: `claude mcp add priors --scope user -e PRIORS_KEY="$PRIORS_KEY" -- npx -y @priors/mcp@0.6.1`
169
+ or, for your user only: `claude mcp add priors --scope user -e PRIORS_KEY="$PRIORS_KEY" -- npx -y @priors/mcp@0.6.2`
168
170
  (the key is expanded by your shell from the environment; do not paste it on the command line).
169
171
 
170
172
  ## Try it
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@priors/mcp",
3
3
  "mcpName": "io.github.priors-agents/priors",
4
- "version": "0.6.1",
4
+ "version": "0.6.2",
5
5
  "private": false,
6
6
  "description": "MCP server for Priors on Robinhood Chain: pay x402 URLs in USDG, read balances, credit lines and scores, borrow and repay, and buy, sell and redeem PT-USDG. Key from PRIORS_KEY only.",
7
7
  "type": "module",
package/src/server.mjs CHANGED
@@ -246,10 +246,26 @@ export async function createPriorsMcpServer({ env = process.env, fetchImpl = glo
246
246
  if (hold) {
247
247
  const h = hold;
248
248
  await Promise.race([h, new Promise((ok) => setTimeout(ok, Math.max(0, deadline - margin - Date.now())).unref?.())]);
249
- if (hold === h) throw new ToolError("a savings withdrawal from an earlier call is still in flight. Nothing was done: check the savings tool and try again in a minute.");
249
+ if (hold === h) throw new ToolError(h.busy || "a savings withdrawal from an earlier call is still in flight. Nothing was done: check the savings tool and try again in a minute.");
250
+ // a call queued behind one that ran out of time (most likely its retry) never goes ahead on its own (GHSA-rg79)
251
+ if (h.busy) throw new ToolError(h.busy);
250
252
  }
251
253
  if (Date.now() >= deadline - margin) throw new ToolError("another payment call was still running and this one ran out of time before it could start. Nothing was signed or paid: try again.");
252
- return fn(args, deadline);
254
+ // Every money call answers by its deadline, whatever it waits for (GHSA-rg79: pt_buy waited for its receipts past the
255
+ // client's timeout, the model saw nothing, and its retry bought again). One still running then goes on, and holds
256
+ // every later money call, as a savings withdrawal in flight does: what it sent may still land.
257
+ const p = fn(args, deadline);
258
+ let timer;
259
+ const late = new Promise((_, no) => {
260
+ timer = setTimeout(() => {
261
+ const h = Object.assign(Promise.race([p.then(() => {}, () => {}), new Promise((ok) => setTimeout(ok, HOLD_MAX_MS).unref?.())]).then(() => { if (hold === h) hold = null; }),
262
+ { busy: "Nothing was done by this call: an earlier money call ran out of time while still running, and what it sent may still land. Check the wallet (wallet_balance, credit_status, savings or pt_position) before calling again." });
263
+ hold = h;
264
+ no(new ToolError(`this call did not finish within ${Math.round(callBudgetMs / 1000)} s and is still running: a transaction it sent may still land, and it may still send the rest of what it was asked to do. Do NOT call it again for the same thing; check the wallet (wallet_balance, credit_status, savings or pt_position) in a minute. Money calls made meanwhile do nothing.`));
265
+ }, Math.max(0, deadline + margin - Date.now()));
266
+ timer.unref?.();
267
+ });
268
+ try { return await Promise.race([p, late]); } finally { clearTimeout(timer); }
253
269
  });
254
270
  moneyQueue = run.catch(() => {});
255
271
  return run;