@priors/mcp 0.12.0 → 0.12.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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @priors/mcp changelog
2
2
 
3
+ ## 0.12.1 (2026-10-27)
4
+
5
+ On @priors/x402 0.8.3 (GHSA-xccq-5ghg-w7mq and GHSA-qcrq-x8xg-25vg, reported by hey-research-lab):
6
+
7
+ - **`borrow` for more than 10 days on a line SeatVaultV5 backs is refused before anything is sent.** It sent V5's
8
+ refresh (or this key's `noteDelegate`) first, then the borrow reverted; the refusal names the limit. `pay_url`,
9
+ `pay_gateway` and `fund_base`'s loan borrow for 7 days, within it.
10
+ - **The agent's key borrows on a V5 line only 24 hours after V5 recorded it, whatever the line's room:** `borrow`
11
+ records the key (`noteDelegate`) and answers `V5_DELEGATE_WAIT` with when it can borrow, instead of trying a borrow
12
+ that could only revert.
13
+ - **`credit_status` and `stock_position` say 0 can be drawn, and why, when every loan would be refused:** a default
14
+ marked on the owner's account (any line), or a stock line whose agent changed hands since its position opened,
15
+ defaulted or is frozen. They showed the stock vault's `borrowRoom`, or the pool's figure.
16
+
3
17
  ## 0.12.0 (2026-10-26)
4
18
 
5
19
  - **A borrow the node took is always counted** (GHSA-rh27-m4c4-p2c7, reported by kevin9327). ethers' default
package/README.md CHANGED
@@ -30,10 +30,10 @@ repaying.
30
30
  |---|---|---|
31
31
  | `pay_url(url, method?, body?, max_price_usd?, max_borrow_usd?, use_savings?)` | fetch an https URL, pay its x402 402 in USDG if the price is ≤ `max_price_usd` (default **$0.10**); once the 402 names the price, if the wallet is short it first takes the difference out of savings (unless `use_savings: false`), and borrows the gap only if `max_borrow_usd` is given. Refuses private and local addresses, never follows a redirect, answers within 45 s, and never signs a second payment for a purchase (the same method, URL and body) that is still pending, until its validBefore plus 60 s (a new call resends the same one, also after a restart, in a new session or from another session of the same wallet: see `PRIORS_STATE_DIR`) | yes |
32
32
  | `wallet_balance(address?)` | USDG and gas ETH of the wallet (or any address) | no (with `address`) |
33
- | `credit_status(agent_id?)` | line, drawn, available, backer, record, score, open loans and due dates; on a stock line, the stock tokens behind it, and `available` capped by what the stock vault lets it draw | no (with `agent_id`) |
33
+ | `credit_status(agent_id?)` | line, drawn, available, backer, record, score, open loans and due dates; on a stock line, the stock tokens behind it, and `available` capped by what the stock vault lets it draw. (0.12.1) `available`, and a stock line's "can be drawn now", are 0 with the reason when every loan would be refused: a default marked on the owner's account (any line), or a stock line whose agent changed hands, defaulted or is frozen | no (with `agent_id`) |
34
34
  | `stock_assets(symbol?)` | the stock tokens the Priors stock vault accepts: live Chainlink price, whether it lends against each now (or why not: a sharp price move, a multiplier change, a paused or blocked token), loan-to-value | no |
35
35
  | `stock_position(agent_id?)` | the stock tokens behind an agent's stock line: amount, what the vault values them at, loan-to-value, what the line can draw now, any lending hold | no (with `agent_id`) |
36
- | `borrow(amount_usd, days, dry_run?)` | borrow USDG from the line into the wallet; both amounts required; `dry_run` quotes the fee. (0.10.2) Needs the wallet to be the agent's owner or its declared ERC-8004 wallet, the same rule as `repay`. A borrow sent whose answer is lost is counted and said to be possibly open (check `credit_status`); (0.12.0) so is one the node refused for "insufficient funds" while it holds the signed borrow (a copy sent again after an HTTP 429) | yes |
36
+ | `borrow(amount_usd, days, dry_run?)` | borrow USDG from the line into the wallet; both amounts required; `dry_run` quotes the fee. (0.10.2) Needs the wallet to be the agent's owner or its declared ERC-8004 wallet, the same rule as `repay`. A borrow sent whose answer is lost is counted and said to be possibly open (check `credit_status`); (0.12.0) so is one the node refused for "insufficient funds" while it holds the signed borrow (a copy sent again after an HTTP 429). (0.12.1) On a line SeatVaultV5 backs, a term over 10 days is refused before anything is sent | yes |
37
37
  | `repay(loan_id? \| all, use_savings?)` | repay one of the agent's own loans, or all of them earliest due first; another agent's loan is refused, and (0.8.1) so is a loan opened while someone else held the agent; (0.10.2) a wallet that is neither the agent's owner nor its declared ERC-8004 wallet (a pool delegate the owner named) repays nothing — and, symmetrically, borrows nothing, so no loan is drawn that this server would then refuse to repay: the owner declares the agent's key with `priors-mcp link-wallet`. If the wallet is short of what is due, it first takes the difference out of savings (unless `use_savings: false`). From 0.8.0 its answer ends with share facts for each loan repaid (amount, on time or late, the record's page; also as structured content); the server never posts | yes |
38
38
  | `savings(address?)` | what the wallet (or any address) has saved in the savings vault, how much can come out right now, and the USDG in the wallet | no (with `address`) |
39
39
  | `save(amount_usd)` | move spare USDG from the wallet into the savings vault, where it earns the vault's rate (at most `PRIORS_MAX_SAVE_USD` per call, `PRIORS_MAX_SAVE_TOTAL_USD` per run); needs ETH for gas | yes |
@@ -179,7 +179,7 @@ may spend. Rows marked (0.8.0) take effect from that version; 0.7.x ignores them
179
179
  | `PRIORS_MAX_SAVE_USD` | `50` | most one `save` call may move into the vault |
180
180
  | `PRIORS_MAX_SAVE_TOTAL_USD` | `200` | most `save` may move in total while the server runs |
181
181
  | `PRIORS_AUTOREPAY` | the bundled deployments file's `autoRepay` (AutoRepay v2, `0x72B510AF4e66e5960aB9b975e0BdCf80239e83A0`, deployed 2026-10-20; versions published before then bundle none) | AutoRepay v2's address, for `autopay_on`, `autopay_off` and the Autopay lines of `credit_status`; AutoRepay v1 (retired before use) is refused |
182
- | `PRIORS_V5`, `PRIORS_V5_ROOT` | the bundled deployments file's `seatVaultV5` and `seatVaultV5AgentId` (none until V5 is deployed) | SeatVaultV5 and its root's agent id: a borrow on a V5 line (the `borrow` tool, `pay_url`) refreshes it first. The agent's key may do so 24 hours after V5 recorded it (`noteDelegate`, sent for it when needed); until then a borrow goes ahead only within the line's room, and the tool says when the key can borrow more |
182
+ | `PRIORS_V5`, `PRIORS_V5_ROOT` | the bundled deployments file's `seatVaultV5` and `seatVaultV5AgentId` (none until V5 is deployed) | SeatVaultV5 and its root's agent id: a borrow on a V5 line (the `borrow` tool, `pay_url`) refreshes it first, for a term of at most 10 days (a longer one is refused before anything is sent). The agent's key may refresh and borrow 24 hours after V5 recorded it (`noteDelegate`, sent for it when needed); until then V5 lends it nothing, whatever the line's room, and the tool says when the key can borrow |
183
183
  | `PRIORS_MAX_AUTOPAY_USD` | `25` | the most `autopay_on` enrolls per loan (stage 0) |
184
184
  | `PRIORS_AUTOPAY_RESERVE` | on | with Autopay on, `pay_url` keeps back what loans whose window opens in the next 24 h will pull, and says so when a payment would cut into it; `off` turns that off |
185
185
  | `PRIORS_PT` | on | `off` (or `false`, `0`, `no`) removes the PT-USDG tools |
@@ -213,7 +213,7 @@ Settings → Developer → Edit Config (`claude_desktop_config.json`), then rest
213
213
  "mcpServers": {
214
214
  "priors": {
215
215
  "command": "npx",
216
- "args": ["-y", "@priors/mcp@0.12.0"],
216
+ "args": ["-y", "@priors/mcp@0.12.1"],
217
217
  "env": {
218
218
  "PRIORS_KEY": "0xYOUR_AGENT_WALLET_KEY",
219
219
  "PRIORS_AGENT_ID": "1234"
@@ -235,7 +235,7 @@ A project `.mcp.json` that reads the key from your shell's environment, so the f
235
235
  "mcpServers": {
236
236
  "priors": {
237
237
  "command": "npx",
238
- "args": ["-y", "@priors/mcp@0.12.0"],
238
+ "args": ["-y", "@priors/mcp@0.12.1"],
239
239
  "env": {
240
240
  "PRIORS_KEY": "${PRIORS_KEY}",
241
241
  "PRIORS_AGENT_ID": "${PRIORS_AGENT_ID:-}"
@@ -248,7 +248,7 @@ A project `.mcp.json` that reads the key from your shell's environment, so the f
248
248
  or, for your user only, from a macOS or Linux terminal:
249
249
 
250
250
  ```sh
251
- (read -rs PRIORS_KEY && umask 077 && mkdir -p ~/.config/priors && rm -f ~/.config/priors/agent.key && printf '%s\n' "$PRIORS_KEY" > ~/.config/priors/agent.key) && claude mcp add priors --scope user -- sh -c 'read -r PRIORS_KEY < "$1" && export PRIORS_KEY && exec npx -y @priors/mcp@0.12.0' priors-mcp ~/.config/priors/agent.key
251
+ (read -rs PRIORS_KEY && umask 077 && mkdir -p ~/.config/priors && rm -f ~/.config/priors/agent.key && printf '%s\n' "$PRIORS_KEY" > ~/.config/priors/agent.key) && claude mcp add priors --scope user -- sh -c 'read -r PRIORS_KEY < "$1" && export PRIORS_KEY && exec npx -y @priors/mcp@0.12.1' priors-mcp ~/.config/priors/agent.key
252
252
  ```
253
253
 
254
254
  It waits for the key without showing it (paste it, then Enter), saves it in a file only you can read, and gives Claude
@@ -304,7 +304,7 @@ to approve a borrow; this package, with the key, pays for APIs. With borrowing o
304
304
  approves each loan in Priors' Go mode. ElizaOS (`@elizaos/plugin-mcp`):
305
305
 
306
306
  ```ts
307
- "priors-wallet": { type: "stdio", command: "npx", args: ["-y", "@priors/mcp@0.12.0"],
307
+ "priors-wallet": { type: "stdio", command: "npx", args: ["-y", "@priors/mcp@0.12.1"],
308
308
  env: { PRIORS_KEY_FILE: "/home/agent/.config/priors/agent-7311.key", PRIORS_AGENT_ID: "7311",
309
309
  PRIORS_MAX_BORROW_USD: "0", PRIORS_MAX_BORROW_DAY_USD: "0", PRIORS_MAX_SPEND_DAY_USD: "1", PRIORS_MAX_PRICE_USD: "0.10",
310
310
  PRIORS_PAY_HOSTS: "api.example.com" } }
@@ -316,7 +316,7 @@ OpenClaw (`mcp.servers`, JSON5) takes the same `command`, `args` and `env`; Herm
316
316
  mcp_servers:
317
317
  priors-wallet:
318
318
  command: npx
319
- args: ["-y", "@priors/mcp@0.12.0"]
319
+ args: ["-y", "@priors/mcp@0.12.1"]
320
320
  env:
321
321
  PRIORS_KEY_FILE: /home/agent/.config/priors/agent-7311.key
322
322
  PRIORS_AGENT_ID: "7311"
@@ -343,7 +343,7 @@ key proves it is there: it signs the ERC-8004 identity registry's `AgentWalletSe
343
343
  agent's).
344
344
 
345
345
  ```sh
346
- PRIORS_KEY_FILE=~/.config/priors/agent-7311.key npx -y @priors/mcp@0.12.0 link-wallet --agent 7311
346
+ PRIORS_KEY_FILE=~/.config/priors/agent-7311.key npx -y @priors/mcp@0.12.1 link-wallet --agent 7311
347
347
  ```
348
348
 
349
349
  It reads the registry's EIP-712 domain and refuses to sign for any other, takes the owner from the chain (`--owner`
@@ -354,7 +354,7 @@ model can call.
354
354
  ## Try it
355
355
 
356
356
  "What's the Priors score of agent 6228?" · "How much USDG does my wallet hold?" · "Find services that sell token
357
- prices" · "Pay https://api.example.com/report, up to 5 cents" · "Borrow $5 for 14 days, show me the fee first".
357
+ prices" · "Pay https://api.example.com/report, up to 5 cents" · "Borrow $5 for 10 days, show me the fee first".
358
358
 
359
359
  ## Tests
360
360
 
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.12.0",
4
+ "version": "0.12.1",
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_FILE (a file only you can read) or PRIORS_KEY, never the command line.",
7
7
  "type": "module",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@modelcontextprotocol/sdk": "^1.30.1",
48
- "@priors/x402": "0.8.2",
48
+ "@priors/x402": "0.8.3",
49
49
  "ethers": "^6.13.4",
50
50
  "undici": "6.29.1",
51
51
  "viem": "^2.56.9",
package/src/server.mjs CHANGED
@@ -258,8 +258,9 @@ export function collateralText(c, symbol = c.symbol, decimals = c.decimals) {
258
258
  const what = c.payout !== undefined && c.payout !== null
259
259
  ? `${symbol ? `${tokens(c.payout, decimals)} ${symbol}` : `${c.payout} base units of ${c.token}`}, of ${symbol ? tokens(c.amount, decimals) : c.amount} deposited: an issuer burn left the vault short,`
260
260
  : held;
261
+ // `refused`: why no loan can be drawn whatever the vault's borrowRoom (@priors/x402 0.8.3, GHSA-qcrq-x8xg-25vg)
261
262
  return `Backed by ${what}${c.value !== null ? ` worth ${usd(c.value)} to the vault` : " (not priced for new loans right now)"}, at ${Number(c.ltvBps) / 100}% loan-to-value: ${usd(c.borrowRoom)} can be drawn now.`
262
- + (c.hold ? ` New loans wait: ${c.holdReason || "a lending hold"}.` : "") + (c.closing ? " Closing: no new loans." : "");
263
+ + (c.refused ? ` No new loans: ${c.refused}.` : "") + (c.hold ? ` New loans wait: ${c.holdReason || "a lending hold"}.` : "") + (c.closing ? " Closing: no new loans." : "");
263
264
  }
264
265
  const short = (s, n) => (s.length > n ? `${s.slice(0, n)}… (${s.length - n} more characters cut)` : s);
265
266
  const clean = (s, n) => short(String(s ?? "").replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g, ""), n);
@@ -1278,7 +1279,7 @@ export async function createPriorsMcpServer({ env = process.env, fetchImpl = glo
1278
1279
  const lines = [
1279
1280
  `Agent #${id}${s.owner ? ` (owner ${s.owner})` : ""}${s.defaulted ? " — DEFAULTED" : ""}${s.frozen ? " — frozen" : ""}${s.isRoot ? " — a backer (root)" : ""}`,
1280
1281
  s.sponsor === 0n ? "Backed by: nobody yet, so no line." : `Backed by: root #${s.sponsor}${s.premiumBps > 0n ? `, premium ${Number(s.premiumBps) / 100}%` : ""}.`,
1281
- `Line ${usd(s.line)}: drawn ${usd(s.drawn)}, available ${usd(s.available)}.`,
1282
+ `Line ${usd(s.line)}: drawn ${usd(s.drawn)}, available ${usd(s.available)}.${s.refused && !s.collateral && !s.defaulted && !s.frozen ? ` No new loans: ${s.refused}.` : ""}`,
1282
1283
  ...(s.collateral ? [collateralText(s.collateral)] : []),
1283
1284
  `Record: ${s.loansRepaid} loans repaid (${s.qualifiedRepaid} qualified), ${usd(s.volumeRepaid)} repaid in total, ${usd(s.feesPaid)} in fees.${s.score !== null ? ` Score ${s.score}/1000.` : ""}`,
1284
1285
  ];
@@ -1441,7 +1442,7 @@ export async function createPriorsMcpServer({ env = process.env, fetchImpl = glo
1441
1442
  throw e;
1442
1443
  }
1443
1444
  add("borrowed", r.principal);
1444
- const v5Note = r.v5Refreshed ? " Its SeatVaultV5 line was refreshed first." : r.v5Noted ? ` SeatVaultV5 recorded this key now (tx ${r.v5Noted}): it can raise the line itself 24 hours from now.` : "";
1445
+ const v5Note = r.v5Refreshed ? " Its SeatVaultV5 line was refreshed first." : "";
1445
1446
  return `Borrowed ${usd(r.principal)} for agent #${id}${r.loanId !== null ? ` as loan #${r.loanId}` : ""}: fee ${usd(r.fee)}, so ${usd(r.principal + r.fee)} is due${r.dueAt ? ` by ${when(r.dueAt)}` : ""}. The USDG is in ${wallet.address}. Tx ${r.hash}.${v5Note}`;
1446
1447
  }));
1447
1448