@priors/mcp 0.12.2 → 0.13.0

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,68 @@
1
1
  # @priors/mcp changelog
2
2
 
3
+ ## 0.13.0 (2026-10-29)
4
+
5
+ Still on @priors/x402 0.8.3.
6
+
7
+ - **Invisible characters in a merchant's text no longer reach the model.** The data fence kept merchant text from
8
+ writing outside its markers, but the invisible characters inside it came through as written: Unicode tag characters
9
+ (U+E0000 to U+E007F, "ASCII smuggling": each reads to a model as an ASCII letter and shows nothing to a person),
10
+ zero-width characters, bidi controls and marks, variation selectors. Every default-ignorable code point and format
11
+ character is now removed from third-party text before the fence reads it (a response body, a redirect target, the
12
+ listings, Keyring's listing, a third-party string quoted in an answer or in `structuredContent`), but the number signs
13
+ such as U+0600, which are visible. Where a fence removed any, a line of the server's own right after its closing
14
+ marker says how many, never which: `(response body: 98 invisible characters removed)`. What it costs legitimate
15
+ text: an emoji ZWJ sequence shows its emoji side by side, an emoji loses its VS16 style, a subdivision flag shows as a
16
+ black flag, a Persian or Indic word loses its ZWNJ or ZWJ, mixed-direction text shows in the bidi algorithm's own
17
+ order. A reference to one (`‍`) is visible and stays as written; a merchant's link that carries one, as written or
18
+ percent-encoded, is not given ("no url"), like any link the fence would change. Text with none comes back byte for
19
+ byte. The hosted MCP (mcp.priors.trade) shares the fence: its listings and manifests lose them too.
20
+ - **`pay_url` and `pay_gateway` say when the answer's body could not be read whole** (issue #19, reported by
21
+ ryan-ubi). A body that failed mid-read after the headers (a timeout, a reset) was dropped with no line, so a paid
22
+ call read as delivered. Now the answer says so, and once the payment settled, that it is not undone and that calling
23
+ again for the same purchase pays again.
24
+ - **Trading agents from the agent's own key, with `PRIORS_MARKET=on` (off by default)**. `market_agent` reads an agent
25
+ on Priors' agent market: its holder, its listing, its hold, its line and bond, whether this server may sell it, and on
26
+ AgentMarketV2 its open bids with their ids and proofs. `market_list`, `market_cancel` and `market_buy` list, cancel
27
+ and buy on AgentMarket; `market_bid`, `market_bid_any`, `market_cancel_bid` and `market_accept` register only with
28
+ AgentMarketV2's record in the package (`deployments/4663.agent-market-v2.json`), which it carries since V2's deploy
29
+ (2026-10-28): the market is AgentMarketV2, with AgentMarket v1 as its `previous`.
30
+ - Each step is a plain transaction from the configured wallet, its gas in ETH, sent through the one-money-call queue.
31
+ `sdk/market-plan.mjs` (bundled byte for byte, with the SDK files it imports) checks every rule of the market on
32
+ reads taken at one block before anything is signed; each step is simulated before it is signed, and everything is
33
+ read and planned again before each later step, so a listing changed meanwhile stops the call between steps.
34
+ - Refused before anything is signed: an agent not in `PRIORS_MARKET_SELL` (off by default), the agent the server acts
35
+ for (`PRIORS_AGENT_ID`, always), a price or a net under `PRIORS_MARKET_MIN_SELL_USD`, a buy or a bid above
36
+ `PRIORS_MAX_MARKET_USD`, open bids above `PRIORS_MAX_BIDS_USD`, a day above `PRIORS_MAX_MARKET_DAY_USD` (required with
37
+ the switch, counted per UTC day for the agent and the wallet across restarts, in `PRIORS_STATE_DIR/market`), and a
38
+ buy, a bid or a bond that would leave less USDG, savings counted, than the agent's open loans owe (checked again
39
+ before each later step that takes USDG).
40
+ - A market record per wallet (`market-<wallet>.json`) is written before each broadcast: a lost answer is
41
+ `TX_UNCONFIRMED`, nothing more is sent while it is pending, and a retry of the same call within 10 minutes of its
42
+ settling answers from the record instead of buying or bidding again; a bid on the same terms as one the record made
43
+ in those 10 minutes, still open, is refused.
44
+ - `market_bid_any` bids on Priors' hub's list for an origin, its ids checked against its root (which proves only that
45
+ the list is the hub's): the answer names the list and its first ids, and the bid asks at least 1 repaid loan by
46
+ default.
47
+ - A sale's net is the price less the fee, and less the agent's builder share where the market answers `builderOf`;
48
+ an accept pins it exactly (`minNet`).
49
+ - The market is the package's deployment record, confirmed on chain at the first market call; there is no address
50
+ setting. With `PRIORS_MARKET` off (unset, or `off`, `false`, `0`, `no`, `none`), the tools and the instructions are
51
+ 0.12.0's, byte for byte, and none of the market's settings is read.
52
+ - **`first_line` posts at most `PRIORS_MAX_BOND_TOTAL_USD` in bonds while the server runs (default 5 USDG: one bond)**
53
+ (GHSA-43jv-qfcj-qhjh, rated Low, reported by mfrxivu). It was the one money tool with no bound on the process (P-2's
54
+ rule, which `pay_url`'s `PRIORS_MAX_SPEND_USD` and the totals of `borrow`, `save`, `pt_buy` and the bridge keep for
55
+ theirs): with no `PRIORS_MAX_SPEND_DAY_USD` set, one process posted a 5 USDG bond for every identity the wallet owns
56
+ with no record, as long as the invite bot answered open. A bond past it is refused before anything is signed or the
57
+ bot is asked. It counts from its deposit's broadcast; a deposit refused before it, or that the chain shows moved
58
+ nothing (dropped, refused for gas, reverted), counts nothing. Read only with `PRIORS_JOIN=on`; with it off the server
59
+ is as before.
60
+ - **`first_line` counts the bond against `PRIORS_MAX_SPEND_DAY_USD` only once its deposit is about to be broadcast.**
61
+ A deposit refused by its simulation, or whose gas or balance could not be read, or that could not be signed or kept
62
+ on file, sent nothing, but it was counted as the day's 5 USDG: under a 5 USDG limit, first_line could not be called
63
+ again that day. Such a deposit now counts nothing; one broadcast counts, whatever its answer, as before.
64
+ - **zod ^4.6.6** (from ^4.6.5).
65
+
3
66
  ## 0.12.2 (2026-10-27)
4
67
 
5
68
  Still on @priors/x402 0.8.3.
package/README.md CHANGED
@@ -51,7 +51,7 @@ repaying.
51
51
  | `return_to_robinhood(amount_usd \| "all")` | only with Base on: move USDC from the Base float back to USDG on Robinhood Chain through Relay, one signature and no gas on Base; keeps back what signed Base payments need | yes |
52
52
  | `pay_gateway(service_id, input?, seller_url?, max_price_usd?, max_borrow_usd?, use_savings?)` | (since 0.10.0) only with `PRIORS_GATEWAY=on` (below): buy one call from a seller in Vantis' Keyring catalog with one USDG payment on Robinhood Chain through Keyring's gateway, which pays the seller and relays its answer; `pay_url`'s limits and its one payment per purchase apply | yes |
53
53
  | `join()` | (since 0.11.0) only with `PRIORS_JOIN=on`: register an ERC-8004 identity on Robinhood Chain for the wallet when it owns none (one transaction, its gas in the wallet's ETH; too little is refused before anything is signed) and answer its id and its routes to a first line; a wallet that owns one gets its id and nothing is sent; a registration whose answer is lost is never sent twice | yes |
54
- | `first_line(agent_id?)` | (since 0.12.0) only with `PRIORS_JOIN=on`: take the treasury's first line by invite for the identity the wallet owns, when it has no Priors record (after `join`), with no clone or Telegram: post the invite's 5 USDG bond from the wallet (USDG's approve, then InviteBond's deposit; it comes back by InviteBond's release, and a default forfeits it), get the invite from Priors' invite bot with one signature that proves ownership (only the bot's own start-page text, rebuilt here byte for byte, is signed), then sign the pool consent and redeem it (treasury v4's `firstLine`). Refused before anything is signed when the wallet does not own the identity, the identity already has a record (its state is the answer), the wallet lacks the ETH or the USDG, the bond would pass `PRIORS_MAX_SPEND_DAY_USD`, or the bot says no invite is open now (its reason, with `line_options`' routes). A transaction whose answer is lost answers `TX_UNCONFIRMED`, and a second call never posts a second bond; needs ETH for gas | yes |
54
+ | `first_line(agent_id?)` | (since 0.12.0) only with `PRIORS_JOIN=on`: take the treasury's first line by invite for the identity the wallet owns, when it has no Priors record (after `join`), with no clone or Telegram: post the invite's 5 USDG bond from the wallet (USDG's approve, then InviteBond's deposit; it comes back by InviteBond's release, and a default forfeits it), get the invite from Priors' invite bot with one signature that proves ownership (only the bot's own start-page text, rebuilt here byte for byte, is signed), then sign the pool consent and redeem it (treasury v4's `firstLine`). Refused before anything is signed when the wallet does not own the identity, the identity already has a record (its state is the answer), the wallet lacks the ETH or the USDG, the bond would pass `PRIORS_MAX_BOND_TOTAL_USD` or `PRIORS_MAX_SPEND_DAY_USD`, or the bot says no invite is open now (its reason, with `line_options`' routes). A transaction whose answer is lost answers `TX_UNCONFIRMED`, and a second call never posts a second bond; needs ETH for gas | yes |
55
55
 
56
56
  Tools that move money state the amounts in their answer, are marked destructive for MCP clients, and their
57
57
  descriptions tell the assistant to confirm with you first. They run one at a time and each answers within 45 s, under an
@@ -104,6 +104,64 @@ The Priors stock vault lists PT-USDG: an agent's owner can post it behind a line
104
104
  (https://go.priors.trade/account#ac-pt) while the vault takes new PT-USDG lines, and `pt_position` says whether it does
105
105
  right now (it reads the vault's hold live). `PRIORS_PT=off` removes the five tools.
106
106
 
107
+ ## Trading agents (off by default)
108
+
109
+ With `PRIORS_MARKET=on`, the agent's own key trades agents on Priors' agent market: it reads an agent, lists one it
110
+ holds, cancels a listing and buys a listed agent, and, on the market that takes bids (AgentMarketV2, once this package
111
+ carries its record), bids on one agent or on any agent of an origin's list, cancels its bids and accepts a bid. Find
112
+ agents with the hosted server (`agent_page`, `find_agents`) or on the board; act with this one. Without the switch
113
+ nothing changes: no tool, no sentence in the instructions, and none of the settings below is read.
114
+
115
+ | Tool | What it sends, each step its own transaction from this wallet |
116
+ |---|---|
117
+ | `market_agent` | nothing: who holds the agent, its listing, its 14-day hold, its line and bond, whether this server may sell it, and its open bids with their ids and proofs |
118
+ | `market_list` | the cancel of its own listing while the market isn't approved (approving would bring it back at its old price; on V2 also its own listing on the older market), InviteBondV2's bond when the treasury line lends with none (an approval of exactly the bond, then the deposit), the registry's approval of this one agent, then `list` |
119
+ | `market_cancel` | `cancel`, here and on the older market; any agent, always: it only stops a sale |
120
+ | `market_buy` | an approval of exactly the price when the USDG approved is short, then `buy`, pinned to the listing read (its nonce, the agent's file, its record) |
121
+ | `market_bid` | an approval to the bids' spender of exactly what all of this wallet's open bids take, when it is short or above `PRIORS_MAX_BIDS_USD`, then `bid` |
122
+ | `market_bid_any` | the same approval, then `bidAny` on the origin's list from Priors' hub, its ids checked against its root first. The root proves only that the list is the hub's: any agent on it can be sold to this wallet, so the answer names the list and its first ids, and the bid asks at least 1 repaid loan unless `min_repaid` says otherwise |
123
+ | `market_cancel_bid` | `cancelBid` for one bid, or `all` (at most 10 a call), then the approval set down to what the bids left take |
124
+ | `market_accept` | the cancels and the bond as `market_list` (the bond stays on the agent after the sale until its new owner bonds), the registry's approval, then `acceptBid` with what this wallet gets pinned exactly |
125
+
126
+ Every write tool has `dry_run`. Every rule of the market is checked on reads taken at one block before anything is
127
+ signed; each step is simulated just before it is signed, and before each later step everything is read and planned
128
+ again: a listing, a nonce, a pin or a net that changed stops the call, and the answer says what the steps already
129
+ mined leave standing (an approval lets only this wallet's own list, buy or bids use it). A sale's net is the price less
130
+ the fee, and less the agent's builder share where the market has one.
131
+
132
+ | Setting | Meaning | Default |
133
+ |---|---|---|
134
+ | `PRIORS_MARKET` | `on`: register the market tools | off |
135
+ | `PRIORS_MAX_MARKET_USD` | the most one buy may pay, or one bid may commit (price × count) | 50 |
136
+ | `PRIORS_MAX_MARKET_DAY_USD` | the most buys, bids and listing bonds may commit per UTC day, for the agent and this wallet, across restarts | required with `on` |
137
+ | `PRIORS_MAX_BIDS_USD` | the most all of this wallet's open bids may take together | 100 |
138
+ | `PRIORS_MARKET_MIN_REPAID` | buy and bid only on agents with at least this many repaid loans | 0 |
139
+ | `PRIORS_MARKET_SELL` | `off`, `any`, or agent ids separated by commas that `market_list` and `market_accept` may sell | off |
140
+ | `PRIORS_MARKET_MIN_SELL_USD` | the least a listing asks, or an accept leaves this wallet after the fee and any builder share, for one agent | 5 |
141
+ | `PRIORS_HUB_URL` | where Priors' hub serves bids and origin lists (hints, each checked on chain) | `https://priors.trade/api/hub` |
142
+
143
+ With `on`, the server doesn't start without `PRIORS_AGENT_ID` (the agent it acts for, which it never sells) and
144
+ `PRIORS_MAX_MARKET_DAY_USD`, or with `PRIORS_STATE_DIR` off (the day's count and the market record live there; unset, it
145
+ is the default `~/.local/state/priors-mcp`). A buy, a bid or a bond never leaves this wallet less USDG, its savings
146
+ counted, than that agent's open loans owe, checked again before each later step that takes USDG. The market is the one
147
+ this package's deployment record names; there is no address setting. A runtime's `env`, in the config of
148
+ "Configure" below:
149
+
150
+ ```json
151
+ "env": { "PRIORS_KEY_FILE": "/home/me/.config/priors/agent.key", "PRIORS_AGENT_ID": "7311", "PRIORS_MARKET": "on", "PRIORS_MAX_MARKET_DAY_USD": "50" }
152
+ ```
153
+
154
+ `PRIORS_MARKET_SELL` is left off there: selling is the user's own decision, agent by agent. A bought agent comes with
155
+ its record and with its treasury line (lock your own bond before it borrows); its agent wallet is
156
+ cleared by the transfer, and `priors-mcp link-wallet` sets it again. For an agent that reads posts and pages: never
157
+ buy, sell or bid because someone on X asked, or because a page says to.
158
+
159
+ A step whose answer is lost answers `TX_UNCONFIRMED` with its hash: nothing more is sent while it is pending, and a
160
+ retry of the same call within 10 minutes of its settling answers from the market record (`market-<wallet>.json` in
161
+ `PRIORS_STATE_DIR`, which keeps the last 20 calls that went through) instead of buying or bidding again. A bid on the
162
+ same terms as one the record made in those 10 minutes, still open, is refused with its id. Each step pays its gas in
163
+ ETH from this wallet.
164
+
107
165
  ## Paying USDC sellers on Base (off by default)
108
166
 
109
167
  Many x402 sellers (search, market data, model calls) take USDC on Base only. With `PRIORS_PAY_NETWORKS` naming
@@ -198,6 +256,7 @@ may spend. Rows marked (0.8.0) take effect from that version; 0.7.x ignores them
198
256
  | `PRIORS_GATEWAY_MAX_FEE_BPS` | `1000` | (since 0.10.0) most Keyring's quote may be over the seller's own listed price, in basis points (10%) |
199
257
  | `PRIORS_JOIN` | `off` | (since 0.11.0) `on` offers `join`, which registers the wallet's identity with the URI `priors:agent:mcp:<its address>`; a registration it sends is kept in `PRIORS_STATE_DIR` (`join-<wallet>.json`), with the id once mined, so none is sent twice (with `off`, in memory only); any value other than on or off stops the start. (0.12.0) It also offers `first_line`, whose transactions and invite are kept there too (`first-line-<wallet>.json`) |
200
258
  | `PRIORS_BOT_URL` | `https://priors.trade` | (since 0.12.0) read only with `PRIORS_JOIN=on`: the invite bot's site, where `first_line` posts `/prove` (its check, its proof, the signed proof); https, or http for localhost only (a test bot); any other value stops the start |
259
+ | `PRIORS_MAX_BOND_TOTAL_USD` | `5` | (since 0.13.0) read only with `PRIORS_JOIN=on`: most `first_line` may post in bonds while the server runs (InviteBond's bond is 5 USDG, so one by default; `0` posts none), counted from the deposit's broadcast; a deposit refused before it, or that the chain shows moved nothing, counts nothing; a value it cannot read stops the start |
201
260
  | `PRIORS_STATE_DIR` | `~/.local/state/priors-mcp` | where the payments signed and not yet settled are kept (one owner-only file per wallet, never the key, with a short-lived `.lock` beside it while it is written), so a restart, a new session or another session of the same wallet resends them instead of signing again. An absolute path, or one starting with `~/` (a relative one is refused at start). A payment that cannot be written there is not sent. `off` keeps them in memory only (0.8.3) On Linux and macOS it must be yours alone: owned by your user with no group or other write bit, and no directory above it that other users can write to unless it is sticky like `/tmp`; otherwise the money tools refuse (another local user could move the records aside), and the read-only tools still answer. |
202
261
 
203
262
  Contract addresses (pool, lens, registry, USDG) come from `deployments/4663.v2.json`, bundled in the package, and the
@@ -213,7 +272,7 @@ Settings → Developer → Edit Config (`claude_desktop_config.json`), then rest
213
272
  "mcpServers": {
214
273
  "priors": {
215
274
  "command": "npx",
216
- "args": ["-y", "@priors/mcp@0.12.2"],
275
+ "args": ["-y", "@priors/mcp@0.13.0"],
217
276
  "env": {
218
277
  "PRIORS_KEY": "0xYOUR_AGENT_WALLET_KEY",
219
278
  "PRIORS_AGENT_ID": "1234"
@@ -235,7 +294,7 @@ A project `.mcp.json` that reads the key from your shell's environment, so the f
235
294
  "mcpServers": {
236
295
  "priors": {
237
296
  "command": "npx",
238
- "args": ["-y", "@priors/mcp@0.12.2"],
297
+ "args": ["-y", "@priors/mcp@0.13.0"],
239
298
  "env": {
240
299
  "PRIORS_KEY": "${PRIORS_KEY}",
241
300
  "PRIORS_AGENT_ID": "${PRIORS_AGENT_ID:-}"
@@ -248,7 +307,7 @@ A project `.mcp.json` that reads the key from your shell's environment, so the f
248
307
  or, for your user only, from a macOS or Linux terminal:
249
308
 
250
309
  ```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.2' priors-mcp ~/.config/priors/agent.key
310
+ (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.13.0' priors-mcp ~/.config/priors/agent.key
252
311
  ```
253
312
 
254
313
  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 +363,7 @@ to approve a borrow; this package, with the key, pays for APIs. With borrowing o
304
363
  approves each loan in Priors' Go mode. ElizaOS (`@elizaos/plugin-mcp`):
305
364
 
306
365
  ```ts
307
- "priors-wallet": { type: "stdio", command: "npx", args: ["-y", "@priors/mcp@0.12.2"],
366
+ "priors-wallet": { type: "stdio", command: "npx", args: ["-y", "@priors/mcp@0.13.0"],
308
367
  env: { PRIORS_KEY_FILE: "/home/agent/.config/priors/agent-7311.key", PRIORS_AGENT_ID: "7311",
309
368
  PRIORS_MAX_BORROW_USD: "0", PRIORS_MAX_BORROW_DAY_USD: "0", PRIORS_MAX_SPEND_DAY_USD: "1", PRIORS_MAX_PRICE_USD: "0.10",
310
369
  PRIORS_PAY_HOSTS: "api.example.com" } }
@@ -316,7 +375,7 @@ OpenClaw (`mcp.servers`, JSON5) takes the same `command`, `args` and `env`; Herm
316
375
  mcp_servers:
317
376
  priors-wallet:
318
377
  command: npx
319
- args: ["-y", "@priors/mcp@0.12.2"]
378
+ args: ["-y", "@priors/mcp@0.13.0"]
320
379
  env:
321
380
  PRIORS_KEY_FILE: /home/agent/.config/priors/agent-7311.key
322
381
  PRIORS_AGENT_ID: "7311"
@@ -343,7 +402,7 @@ key proves it is there: it signs the ERC-8004 identity registry's `AgentWalletSe
343
402
  agent's).
344
403
 
345
404
  ```sh
346
- PRIORS_KEY_FILE=~/.config/priors/agent-7311.key npx -y @priors/mcp@0.12.2 link-wallet --agent 7311
405
+ PRIORS_KEY_FILE=~/.config/priors/agent-7311.key npx -y @priors/mcp@0.13.0 link-wallet --agent 7311
347
406
  ```
348
407
 
349
408
  It reads the registry's EIP-712 domain and refuses to sign for any other, takes the owner from the chain (`--owner`
@@ -0,0 +1,8 @@
1
+ {
2
+ "agentMarketV2": "0x6a4583242B8313313E684d02aB7dc6bFf8749670",
3
+ "agentMarketV2Block": 100303727,
4
+ "bidSpender": "0x0dbd031a3e8cc91C2b0A3Bf6BD1d14c7AeD92878",
5
+ "chainId": 4663,
6
+ "lineRoot": 8793,
7
+ "previous": "0xe5C8b3FacD7802099C1DfB88c0C818Cd0ebA7B19"
8
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "agentMarket": "0xe5C8b3FacD7802099C1DfB88c0C818Cd0ebA7B19",
3
+ "agentMarketBlock": 98813342,
4
+ "agentMarketLineRoot": 8793,
5
+ "chainId": 4663
6
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "adapters": [
3
+ "0x000000009d62675362a58911e3f32FEcf46F5E18"
4
+ ]
5
+ }
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.2",
4
+ "version": "0.13.0",
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",
@@ -49,6 +49,6 @@
49
49
  "ethers": "^6.13.4",
50
50
  "undici": "6.29.1",
51
51
  "viem": "^2.56.9",
52
- "zod": "^4.6.5"
52
+ "zod": "^4.6.6"
53
53
  }
54
54
  }