@priors/mcp 0.20.0 → 0.20.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,16 @@
1
1
  # @priors/mcp changelog
2
2
 
3
+ ## 0.20.1 (2026-11-18)
4
+
5
+ A security fix; the advisory ids are added here when the advisories are published. Run with `PRIORS_LINE_BOARD=on`,
6
+ upgrade from 0.20.0; off (the default), 0.20.1 answers as 0.20.0 does.
7
+
8
+ - **`line_send` sends only an offer this wallet signed.** It recovers the LineOffer signature of the offer in the line
9
+ board's acceptance and, unless it recovers to this wallet, refuses before any simulation and sends nothing; the
10
+ call the board prints is then checked as before. The taken offers named when a session starts are, on the same rule,
11
+ only offers this wallet signed. An offer signed by `line_offer`, or by the same key elsewhere, is sent as before; one
12
+ validated through this wallet's EIP-7702 delegate (ERC-1271) in place of the key's own signature is refused.
13
+
3
14
  ## 0.20.0 (2026-11-11)
4
15
 
5
16
  - **The backing side of the line board, signed and sent here** (only with `PRIORS_LINE_BOARD=on`, off by default; off,
package/README.md CHANGED
@@ -164,12 +164,12 @@ lines on the line board and send them from that wallet:
164
164
  | Tool | What it does |
165
165
  |---|---|
166
166
  | `line_offer(request_id, root_id, amount_usd, premium_bps?, days?, dry_run?)` | checks an offer from the root on an open request as the hosted `line_offer` does, and against the root's offers standing on the board; says what the offer can become under the pool's rules and what Score v2 would say of a line from that root, then signs the LineOffer and posts it |
167
- | `line_send(request_id, dry_run?)` | sends the line of an offer of the root that the agent's owner took: the pool's `vouchWithConsent` exactly as the board's acceptance prints it, checked byte for byte, simulated, then sent from this wallet |
167
+ | `line_send(request_id, dry_run?)` | sends the line of an offer of the root that the agent's owner took, only when the offer is one this wallet signed (its LineOffer signature recovered here): the pool's `vouchWithConsent` exactly as the board's acceptance prints it, checked byte for byte, simulated, then sent from this wallet |
168
168
  | `line_back_own(root_id, agent_id, amount_usd, premium_bps?, dry_run?)` | backs an agent this wallet owns from a root it owns, the agent's consent signed here |
169
169
 
170
170
  With `dry_run`, each checks and says what it would do, and nothing is posted or sent. A refusal says why and sends
171
171
  nothing: the hosted tool's reason, the pool's own (a loan open on the agent's line from another root, an ended consent,
172
- too little free backing), or a call that differs from the board's acceptance.
172
+ too little free backing), an offer this wallet did not sign, or a call that differs from the board's acceptance.
173
173
 
174
174
  Score v2 counts nothing on a line its own owner backs: `line_back_own`'s answer says so first. Such a line opens credit
175
175
  for the agent and builds it no record.
@@ -476,7 +476,7 @@ Settings → Developer → Edit Config (`claude_desktop_config.json`), then rest
476
476
  "mcpServers": {
477
477
  "priors": {
478
478
  "command": "npx",
479
- "args": ["-y", "@priors/mcp@0.20.0"],
479
+ "args": ["-y", "@priors/mcp@0.20.1"],
480
480
  "env": {
481
481
  "PRIORS_KEY": "0xYOUR_AGENT_WALLET_KEY",
482
482
  "PRIORS_AGENT_ID": "1234"
@@ -498,7 +498,7 @@ A project `.mcp.json` that reads the key from your shell's environment, so the f
498
498
  "mcpServers": {
499
499
  "priors": {
500
500
  "command": "npx",
501
- "args": ["-y", "@priors/mcp@0.20.0"],
501
+ "args": ["-y", "@priors/mcp@0.20.1"],
502
502
  "env": {
503
503
  "PRIORS_KEY": "${PRIORS_KEY}",
504
504
  "PRIORS_AGENT_ID": "${PRIORS_AGENT_ID:-}"
@@ -511,7 +511,7 @@ A project `.mcp.json` that reads the key from your shell's environment, so the f
511
511
  or, for your user only, from a macOS or Linux terminal:
512
512
 
513
513
  ```sh
514
- (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.20.0' priors-mcp ~/.config/priors/agent.key
514
+ (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.20.1' priors-mcp ~/.config/priors/agent.key
515
515
  ```
516
516
 
517
517
  It waits for the key without showing it (paste it, then Enter), saves it in a file only you can read, and gives Claude
@@ -592,7 +592,7 @@ to approve a borrow; this package, with the key, pays for APIs. With borrowing o
592
592
  approves each loan in Priors' Go mode. ElizaOS (`@elizaos/plugin-mcp`):
593
593
 
594
594
  ```ts
595
- "priors-wallet": { type: "stdio", command: "npx", args: ["-y", "@priors/mcp@0.20.0"],
595
+ "priors-wallet": { type: "stdio", command: "npx", args: ["-y", "@priors/mcp@0.20.1"],
596
596
  env: { PRIORS_KEY_FILE: "/home/agent/.config/priors/agent-7311.key", PRIORS_AGENT_ID: "7311",
597
597
  PRIORS_MAX_BORROW_USD: "0", PRIORS_MAX_BORROW_DAY_USD: "0", PRIORS_MAX_SPEND_DAY_USD: "1", PRIORS_MAX_PRICE_USD: "0.10",
598
598
  PRIORS_PAY_HOSTS: "api.example.com" } }
@@ -604,7 +604,7 @@ OpenClaw (`mcp.servers`, JSON5) takes the same `command`, `args` and `env`; Herm
604
604
  mcp_servers:
605
605
  priors-wallet:
606
606
  command: npx
607
- args: ["-y", "@priors/mcp@0.20.0"]
607
+ args: ["-y", "@priors/mcp@0.20.1"]
608
608
  env:
609
609
  PRIORS_KEY_FILE: /home/agent/.config/priors/agent-7311.key
610
610
  PRIORS_AGENT_ID: "7311"
@@ -631,7 +631,7 @@ key proves it is there: it signs the ERC-8004 identity registry's `AgentWalletSe
631
631
  agent's).
632
632
 
633
633
  ```sh
634
- PRIORS_KEY_FILE=~/.config/priors/agent-7311.key npx -y @priors/mcp@0.20.0 link-wallet --agent 7311
634
+ PRIORS_KEY_FILE=~/.config/priors/agent-7311.key npx -y @priors/mcp@0.20.1 link-wallet --agent 7311
635
635
  ```
636
636
 
637
637
  It reads the registry's EIP-712 domain and refuses to sign for any other, takes the owner from the chain (`--owner`
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.20.0",
4
+ "version": "0.20.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",
package/src/server.mjs CHANGED
@@ -1407,6 +1407,11 @@ export async function createPriorsMcpServer({ env = process.env, fetchImpl = glo
1407
1407
  let f, c, q;
1408
1408
  try { f = LMS.offerOf(x.offer); c = LMS.consentOf(acc.consent); q = LMS.requestOf(x.request.request); } catch (_) { continue; }
1409
1409
  if (f.sponsorId !== root || c.sponsorId !== root || c.agentId !== q.agentId || LMS.offerId(f) !== x.id.toLowerCase() || Number(c.deadline) <= nowS) continue;
1410
+ // named only when the offer is this wallet's own LineOffer signature, as line_send sends only that: the board's
1411
+ // word alone names no amount
1412
+ let sig;
1413
+ try { sig = LMS.bytesOf(x.signature); } catch (_) { continue; }
1414
+ if (String(LMS.ecdsa(LMS.MARKET_DOMAIN, LMS.OFFER_TYPES, f, sig).signer || "").toLowerCase() !== me) continue;
1410
1415
  out.push({ requestId: String(x.request.id).toLowerCase(), agent: q.agentId, root, amount: f.amount, deadline: Number(c.deadline), nonce: c.nonce });
1411
1416
  }
1412
1417
  }
@@ -3833,7 +3838,8 @@ export async function createPriorsMcpServer({ env = process.env, fetchImpl = glo
3833
3838
  // acceptance itself (the request, the offer, the agent owner's consent and its signature: sdk/line-market.mjs
3834
3839
  // vouchCall) and checked as Go mode checks it (web/line-answer.js callCheck: from this wallet, for the request's
3835
3840
  // agent, to this package's own pool, on chain 4663, its calldata the pool's own encoding of its arguments), refused
3836
- // one byte off; the consent's end against this clock; PRIORS_MAX_BACK_DAY_USD; then simulated from this wallet,
3841
+ // one byte off, and refused unless the offer's LineOffer signature recovers to this wallet; the consent's end
3842
+ // against this clock; PRIORS_MAX_BACK_DAY_USD; then simulated from this wallet,
3837
3843
  // the pool's own reason for a refusal (LoanOpen, ConsentExpired, InsufficientBacking...), and sent (dry_run:
3838
3844
  // listed, nothing sent).
3839
3845
  // line_back_own: Builder mode's one-owner path (web/wallet.js doVouch) from a runtime: a root and an agent this
@@ -4038,7 +4044,7 @@ export async function createPriorsMcpServer({ env = process.env, fetchImpl = glo
4038
4044
 
4039
4045
  tool("line_send", {
4040
4046
  title: "Send the line of a taken offer",
4041
- description: `Send the line of an offer of this wallet's root that the agent's owner took on Priors' line board: give the request's id. It reads the board's acceptance (the offer, the agent owner's consent and its signature), rebuilds the pool's vouchWithConsent call from it and checks the call the board prints against it as Go mode does (from this wallet, the root's owner in the ERC-8004 registry, for the request's agent, to the pool, on chain 4663, the pool's own encoding byte for byte), checks the consent has not ended${backDayCap === null ? "" : ` and the day's cap (at most ${amount(backDayCap)} USDG of line a UTC day from this wallet, PRIORS_MAX_BACK_DAY_USD)`}, simulates it from this wallet, then sends it: one transaction, its gas paid in this wallet's ETH. A refusal gives the pool's own reason (a loan open, an ended consent, too little free backing) or the check's, and sends nothing. The line moves the root's free backing into the agent's line: a default on it is paid from the root's stake. Call it with dry_run: true first (checked, simulated and listed, nothing sent), state its answer to the user and get their go-ahead.`,
4047
+ description: `Send the line of an offer of this wallet's root that the agent's owner took on Priors' line board: give the request's id. It reads the board's acceptance (the offer, the agent owner's consent and its signature), refuses an offer this wallet did not sign (its LineOffer signature, recovered here), rebuilds the pool's vouchWithConsent call from it and checks the call the board prints against it as Go mode does (from this wallet, the root's owner in the ERC-8004 registry, for the request's agent, to the pool, on chain 4663, the pool's own encoding byte for byte), checks the consent has not ended${backDayCap === null ? "" : ` and the day's cap (at most ${amount(backDayCap)} USDG of line a UTC day from this wallet, PRIORS_MAX_BACK_DAY_USD)`}, simulates it from this wallet, then sends it: one transaction, its gas paid in this wallet's ETH. A refusal gives the pool's own reason (a loan open, an ended consent, too little free backing) or the check's, and sends nothing. The line moves the root's free backing into the agent's line: a default on it is paid from the root's stake. Call it with dry_run: true first (checked, simulated and listed, nothing sent), state its answer to the user and get their go-ahead.`,
4042
4048
  inputSchema: {
4043
4049
  request_id: z.string().regex(/^0x[0-9a-fA-F]{64}$/).describe("The request's id (its EIP-712 hash): 0x and 64 hex characters, as the session's start or the board names it."),
4044
4050
  dry_run: z.boolean().optional().describe("true: check, simulate and list the call, send nothing."),
@@ -4070,6 +4076,17 @@ export async function createPriorsMcpServer({ env = process.env, fetchImpl = glo
4070
4076
  const rebuilt = LM.vouchCall({ request: { request: q }, offer: { offer: f, signer: offerSigner }, consent: c, signature: sig, pool: addresses.pool, chainId: 4663 });
4071
4077
  const call = acc.call && typeof acc.call === "object" ? acc.call : {};
4072
4078
  if (!same(call.from, me.address) || !same(offerSigner, me.address)) throw new ToolError(`Not sent: the line board's call for this offer is not this wallet's to send (it names ${oneLine(String(call.from ?? "no sender"), 60)}). ${SENT_NOTHING}`);
4079
+ // the offer itself: this wallet's own LineOffer signature, recovered here. The call above is rebuilt from the board's
4080
+ // record, and the pool's Consent names no amount, so this signature alone says the root's owner offered this amount
4081
+ // at this premium on this request
4082
+ // SHORTCUT: the key's own ECDSA signature only, as line_offer signs here; an offer this wallet's EIP-7702 delegate
4083
+ // validated instead (ERC-1271, line-market.mjs rootSigner's contract path) is refused. Add that path if a root
4084
+ // running this server needs to send offers it signed through its delegate.
4085
+ let offerSig = null;
4086
+ try { offerSig = LM.bytesOf(acc.offer.signature); } catch (_) { offerSig = null; }
4087
+ if (!offerSig || !same(LM.ecdsa(LM.MARKET_DOMAIN, LM.OFFER_TYPES, f, offerSig).signer, me.address)) {
4088
+ throw new ToolError(`Not sent: the line board's acceptance names an offer of ${amount(units)} USDG at a premium of ${bpsText(f.premiumBps)} from root #${root} that this wallet did not sign: its LineOffer signature does not recover to this wallet (${me.address}), and line_send sends only an offer this wallet signed. ${SENT_NOTHING}`);
4089
+ }
4073
4090
  const ca = call.args && typeof call.args === "object" ? call.args : {}, cc = ca.c && typeof ca.c === "object" ? ca.c : {};
4074
4091
  let encoded = null;
4075
4092
  try { encoded = POOL_SEND.encodeFunctionData("vouchWithConsent", [ca.sponsorId, ca.agentId, ca.amount, ca.premiumBps, [cc.agentId, cc.sponsorId, cc.owner, cc.maxPremiumBps, cc.nonce, cc.deadline], ca.sig]); } catch (_) { encoded = null; }