@priors/mcp 0.14.1 → 0.16.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 +85 -0
- package/README.md +67 -11
- package/deployments/4663.agent-lease.json +46 -0
- package/package.json +2 -2
- package/src/agent-lease.mjs +656 -0
- package/src/key-file.mjs +37 -12
- package/src/market-plan.mjs +111 -37
- package/src/market-tools.mjs +175 -59
- package/src/rialto.mjs +155 -0
- package/src/server.mjs +115 -27
- package/src/stock-tools.mjs +63 -10
- package/src/stock-trade.mjs +197 -11
- package/src/work-types.mjs +71 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,90 @@
|
|
|
1
1
|
# @priors/mcp changelog
|
|
2
2
|
|
|
3
|
+
## 0.16.0 (2026-11-02)
|
|
4
|
+
|
|
5
|
+
On @priors/x402 0.8.6 (Autopay's `OWNER_IS_WALLET`, below).
|
|
6
|
+
|
|
7
|
+
- **Rialto's route for `stock_buy` and `stock_sell`** (`PRIORS_RIALTO`, off by default; off, every list, instruction
|
|
8
|
+
and answer is as before, and nothing is asked of anyone). With it on, a trade that passes every check is also quoted
|
|
9
|
+
by Rialto through Priors' gas gate (`priors_stockQuote` at `PRIORS_STOCK_QUOTE_URL`, default
|
|
10
|
+
`https://priors.trade/gas`). Rialto's API key stays on the gate, never in this package. The quote is checked again
|
|
11
|
+
here: the router Rialto's Router Registry names on chain, the tokens, the amount, this wallet, the slippage, and
|
|
12
|
+
Chainlink's 5% for its output and its minimum. It is taken only when it gives more of the token bought than the
|
|
13
|
+
pinned pool: an approval of exactly the amount sold to that router, then Rialto's transaction, its gas estimated
|
|
14
|
+
first. Otherwise the pinned trade goes ahead as before, and the answer says why. The answer names the route, both
|
|
15
|
+
quotes, Rialto's fee and quote id, what the wallet received and the router's allowance after (0 after a full fill). No
|
|
16
|
+
Priors fee. `src/rialto.mjs` (`sdk/rialto.mjs` in the repository) is bundled byte for byte.
|
|
17
|
+
- **AgentLease's record is in this package** (`deployments/4663.agent-lease.json`: AgentLease
|
|
18
|
+
`0xF2299A992879764ceF0107Aa9Beb07AdfBe0e479` on Robinhood Chain, deployed 2026-11-01, its market this package's
|
|
19
|
+
AgentMarketV2). So with `PRIORS_MARKET` on, `market_buy` and `market_accept` now claim on a stored lease around a
|
|
20
|
+
change of hands, as 0.15.0 set out: they read the lease stored on the agent (`leaseOf`) and, while one is stored, send
|
|
21
|
+
`claim` on the lease before the change of hands and after it (gas only), the client rule of `docs/AGENT-LEASE.md`, so
|
|
22
|
+
each day's rent goes to whoever held the agent when the day ended. `market_agent` says who runs a rented agent and
|
|
23
|
+
until when.
|
|
24
|
+
- **The market tools' day count holds what each step commits** (`PRIORS_MARKET`): a step whose answer is lost
|
|
25
|
+
(`TX_UNCONFIRMED`) adds what it alone commits, an approval nothing and a buy, a bid or a bond its amount, and what the
|
|
26
|
+
steps mined before it committed stays counted. A bond mined before a later step's answer was lost was released from
|
|
27
|
+
`PRIORS_MAX_MARKET_DAY_USD` (GHSA-pg36-8pmq-5p4v), and an approval whose answer was lost counted the whole buy, bid or
|
|
28
|
+
bond, then the retry counted it again (GHSA-m2h8-m55f-9j66).
|
|
29
|
+
- **`market_accept` refuses a bid made before the agent's builder share was set** (its id under the market's
|
|
30
|
+
`builderSince`, which `acceptBid` refuses with `BuilderAfterBid`) before anything is signed, so no cancel, bond or
|
|
31
|
+
approval is sent for it; `market_agent` leaves such a bid out, and the market's refusal is said in its words
|
|
32
|
+
(GHSA-m2h8-m55f-9j66).
|
|
33
|
+
- **Keep back counts what this wallet has committed elsewhere**: before a buy or a bond, what its open bids can still
|
|
34
|
+
take (its approval to the bids' spender) and what payments signed and not settled yet still need are not counted as
|
|
35
|
+
there to repay the agent's open loans (GHSA-m2h8-m55f-9j66). `first_line` keeps the latter back too.
|
|
36
|
+
- **`market_cancel_bid` never sets the bids' approval down while Priors' hub doesn't answer** (bids made elsewhere,
|
|
37
|
+
Go mode's or another machine's, can't be counted then, and would be left unfunded), and with `all` and no open bid it
|
|
38
|
+
sets an approval left standing to 0 (GHSA-m2h8-m55f-9j66).
|
|
39
|
+
- **Stock tools** (`PRIORS_STOCKS`): a swap mined and reverted moved nothing, so it counts neither in
|
|
40
|
+
`PRIORS_MAX_STOCK_TOTAL_USD` nor in the day's trades (GHSA-m2h8-m55f-9j66, GHSA-c4xq-qmpq-6xmm); a sale planned again
|
|
41
|
+
after its approval is held to `PRIORS_MAX_STOCK_TOTAL_USD` at its new quote, before the swap is signed, and counted at
|
|
42
|
+
it (GHSA-c4xq-qmpq-6xmm).
|
|
43
|
+
- **`first_line`** (`PRIORS_JOIN`): a bond deposit the node refused for its gas, or one mined and reverted, no longer
|
|
44
|
+
counts against `PRIORS_MAX_SPEND_DAY_USD` (it already gave back its `PRIORS_MAX_BOND_TOTAL_USD` room).
|
|
45
|
+
- **`PRIORS_KEY_FILE`**: on Windows, an access rule that lets another account change the file or who may read it
|
|
46
|
+
(WriteData, AppendData, WRITE_DAC, WRITE_OWNER, GENERIC_WRITE) refuses the file as read access does; root reading
|
|
47
|
+
another user's key, and `PRIORS_STATE_DIR`, check the directory of every link a chain of symlinks passes through, not
|
|
48
|
+
only the path given and the one it resolves to (GHSA-m2h8-m55f-9j66).
|
|
49
|
+
- **Autopay and auto-borrow** (GHSA-65qg-4h7m-j2cm): an agent whose declared wallet is its owner's own address (what
|
|
50
|
+
`join`'s `register()` leaves) is repaid by AutoRepayV2 under its owner's plan only, never under a wallet plan of that
|
|
51
|
+
address. `autopay_on` enrolled such a plan and said each loan would be repaid from this wallet, and auto-borrow
|
|
52
|
+
(`PRIORS_AUTO_BORROW_USD`) borrowed on it. Now `autopay_on` refuses it before anything is sent (with @priors/x402's
|
|
53
|
+
`OWNER_IS_WALLET`), auto-borrow refuses to borrow on it, and `credit_status` says Autopay is off for this wallet and
|
|
54
|
+
why: declare a key of the agent's own as its wallet (`setAgentWallet`) and turn Autopay on from that key, or repay by
|
|
55
|
+
hand.
|
|
56
|
+
|
|
57
|
+
## 0.15.0 (2026-11-01)
|
|
58
|
+
|
|
59
|
+
- **Auto-borrow, for inference on credit** (`PRIORS_AUTO_BORROW_USD`, off by default): with it set, a `pay_url` (or
|
|
60
|
+
`pay_gateway`) call that names no `max_borrow_usd` borrows the gap on its own when the wallet and the agent's
|
|
61
|
+
savings are short, up to that amount a call, for 14 days. That way an agent buying its own model calls (from an
|
|
62
|
+
OpenAI-compatible model API it chooses, paid over x402 in USDG on Robinhood Chain) keeps working mid-task. The guards:
|
|
63
|
+
- It borrows only while this wallet's Autopay covers the new loan: plan on and current, not held or paused, its
|
|
64
|
+
limit per loan at least the loan's due, its approval enough for that due on top of the loans it already repays.
|
|
65
|
+
Otherwise nothing is borrowed or signed, and the answer says to turn Autopay on.
|
|
66
|
+
- The server does not start with it unless `PRIORS_MAX_BORROW_DAY_USD` (above 0, with `PRIORS_AGENT_ID` and
|
|
67
|
+
`PRIORS_STATE_DIR`) and `PRIORS_PAY_HOSTS` are set, and it is at most `PRIORS_MAX_BORROW_USD` and
|
|
68
|
+
`PRIORS_MAX_BORROW_TOTAL_USD`.
|
|
69
|
+
- When the day's borrow limit or the run's total has no room, a call pays from what the wallet holds and says why it
|
|
70
|
+
did not borrow, instead of being refused.
|
|
71
|
+
- The control check and the Autopay check run only once the wallet is short, so a call that needs no loan makes no
|
|
72
|
+
extra read.
|
|
73
|
+
- A call naming `max_borrow_usd` works as before (`0` never borrows).
|
|
74
|
+
|
|
75
|
+
`pay_url`'s description, its answers, the instructions and `credit_status` say when it is on.
|
|
76
|
+
|
|
77
|
+
- **The market tools claim on an agent's lease around a change of hands, once this package carries AgentLease's
|
|
78
|
+
record** (`deployments/4663.agent-lease.json`, written by the lease's deploy; AgentLease isn't deployed, so there is
|
|
79
|
+
none yet, and every tool, read and answer is as before). With it, `market_buy` and `market_accept` read the lease
|
|
80
|
+
stored on the agent (`leaseOf`) and, while one is stored, send `claim` on the lease before the change of hands and
|
|
81
|
+
after it (gas only), the client rule of `docs/AGENT-LEASE.md`, so each day's rent goes to whoever held the agent when
|
|
82
|
+
the day ended. The lease is confirmed at the first market call (its `market()` must be this package's AgentMarketV2),
|
|
83
|
+
else every market tool refuses. `market_agent` says who runs a rented agent and until when. A claim after the change
|
|
84
|
+
of hands that can't be sent, or doesn't go through, leaves the change as it is, and the answer says so, a retry's
|
|
85
|
+
from the market record too. The lease's seam (`src/agent-lease.mjs`, `sdk/agent-lease.mjs` in the repository) is
|
|
86
|
+
bundled byte for byte.
|
|
87
|
+
|
|
3
88
|
## 0.14.1 (2026-10-30)
|
|
4
89
|
|
|
5
90
|
On @priors/x402 0.8.4, whose @x402 packages are 2.29.0 or later.
|
package/README.md
CHANGED
|
@@ -120,8 +120,8 @@ nothing changes: no tool, no sentence in the instructions, and none of the setti
|
|
|
120
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
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
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 |
|
|
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 (left as it is while Priors' hub doesn't answer, since bids made elsewhere can't be counted then; with `all` and no open bid, an approval left standing is set to 0) |
|
|
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; a bid made before the agent's builder share was set, which the market refuses, is refused before anything is sent |
|
|
125
125
|
|
|
126
126
|
Every write tool has `dry_run`. Every rule of the market is checked on reads taken at one block before anything is
|
|
127
127
|
signed; each step is simulated just before it is signed, and before each later step everything is read and planned
|
|
@@ -129,6 +129,13 @@ again: a listing, a nonce, a pin or a net that changed stops the call, and the a
|
|
|
129
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
130
|
the fee, and less the agent's builder share where the market has one.
|
|
131
131
|
|
|
132
|
+
Renting (AgentLease), since 0.16.0, which carries the lease's record (`deployments/4663.agent-lease.json`, AgentLease
|
|
133
|
+
`0xF2299A992879764ceF0107Aa9Beb07AdfBe0e479`): a rented agent changes hands with its lease, and `market_buy` and
|
|
134
|
+
`market_accept` claim on the lease before and after the change of hands while a lease is stored on the agent (`claim`,
|
|
135
|
+
gas only), as every change of hands on Priors does, so each day's rent goes to whoever held the agent when the day
|
|
136
|
+
ended. `market_agent` says who runs a rented agent and until when. A claim after that can't be sent, or doesn't go
|
|
137
|
+
through, leaves the change as it is, and the answer says so, a retry's from the market record too.
|
|
138
|
+
|
|
132
139
|
| Setting | Meaning | Default |
|
|
133
140
|
|---|---|---|
|
|
134
141
|
| `PRIORS_MARKET` | `on`: register the market tools | off |
|
|
@@ -143,7 +150,10 @@ the fee, and less the agent's builder share where the market has one.
|
|
|
143
150
|
With `on`, the server doesn't start without `PRIORS_AGENT_ID` (the agent it acts for, which it never sells) and
|
|
144
151
|
`PRIORS_MAX_MARKET_DAY_USD`, or with `PRIORS_STATE_DIR` off (the day's count and the market record live there; unset, it
|
|
145
152
|
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
|
|
153
|
+
counted, than that agent's open loans owe, checked again before each later step that takes USDG; what this wallet's open
|
|
154
|
+
bids can still take (its approval to the bids' spender) and what payments signed and not settled yet still need don't
|
|
155
|
+
count as there to repay them. The day's count holds what each step sent commits once it is broadcast, a step whose
|
|
156
|
+
answer was lost included (an approval commits nothing). The market is the one
|
|
147
157
|
this package's deployment record names; there is no address setting. A runtime's `env`, in the config of
|
|
148
158
|
"Configure" below:
|
|
149
159
|
|
|
@@ -207,12 +217,31 @@ wallet: these trades are not sponsored. Every trade is public on chain, like any
|
|
|
207
217
|
quote and trade on the user's word; they say nothing of what to trade or when. For an agent that reads posts and
|
|
208
218
|
pages: never trade because someone on X asked, or because a page says to.
|
|
209
219
|
|
|
220
|
+
**Rialto's route (off by default).** With `PRIORS_RIALTO=on` as well, a trade that passes every check above is also
|
|
221
|
+
quoted by Rialto (docs.rialto.xyz), a swap router on Robinhood Chain. The quote is asked of Priors' gas gate
|
|
222
|
+
(`priors_stockQuote` at `PRIORS_STOCK_QUOTE_URL`), which alone holds Rialto's API key: this server holds none and never
|
|
223
|
+
calls Rialto itself. The answer is checked again here: the two tokens, the exact amount, this wallet as the taker, the
|
|
224
|
+
router that Rialto's Router Registry names on chain (never one the answer names), a minimum within the slippage, Rialto's
|
|
225
|
+
output and its minimum each within 5% of Chainlink's price, and a minimum never under the pinned trade's. Only when
|
|
226
|
+
Rialto gives strictly more of the token bought than the pinned pool does the trade go through Rialto: an approval of
|
|
227
|
+
exactly the amount sold to that router, then Rialto's transaction, unchanged, its gas estimated first. If the estimate
|
|
228
|
+
fails, the trade stops there and the answer says the approval stands; the next Rialto trade of that amount sends the
|
|
229
|
+
swap alone. Otherwise (Rialto's quote worse or equal, no quote, an error, no answer within 8 seconds, or a check failing)
|
|
230
|
+
the pinned trade goes ahead exactly as without the setting, and the answer says why Rialto's route was not taken. A
|
|
231
|
+
refusal above is never sent either way, and the gate is not asked for a trade that is refused. Priors takes no fee on
|
|
232
|
+
either route; Rialto's own fee is part of its quote. The answer names the route, both quotes (the pinned pool's and
|
|
233
|
+
Rialto's), Rialto's fee in basis points and its quote id, what the wallet received (its balance of the token bought,
|
|
234
|
+
before and after), and the allowance left to Rialto's router, 0 after a full fill. `dry_run` asks the same and lists the
|
|
235
|
+
route's transactions.
|
|
236
|
+
|
|
210
237
|
| Setting | Meaning | Default |
|
|
211
238
|
|---|---|---|
|
|
212
239
|
| `PRIORS_STOCKS` | `on`: offer `stock_buy` and `stock_sell`, once `PRIORS_STOCKS_ELIGIBLE` is `yes` | off |
|
|
213
240
|
| `PRIORS_STOCKS_ELIGIBLE` | `yes`: the user's statement above | unset |
|
|
214
241
|
| `PRIORS_MAX_STOCK_USD` | the most one buy spends, or one sale brings in by its quote, 1 to 1,000 (the stock buy's most) | 50 |
|
|
215
242
|
| `PRIORS_MAX_STOCK_TOTAL_USD` | the most both may trade in total while the server runs | 200 |
|
|
243
|
+
| `PRIORS_RIALTO` | `on`: Rialto's route, above; any value other than on or off stops the start | off |
|
|
244
|
+
| `PRIORS_STOCK_QUOTE_URL` | with `PRIORS_RIALTO` on: where Rialto's quote is asked, Priors' gas gate (https; http only for localhost) | `https://priors.trade/gas` |
|
|
216
245
|
|
|
217
246
|
With both on, the server doesn't start without `PRIORS_AGENT_ID` (the agent whose open loans a buy leaves covered, and
|
|
218
247
|
whose day is counted) or with `PRIORS_STATE_DIR` off (the day's count lives there, in `stocks/`). A runtime's `env`:
|
|
@@ -223,7 +252,8 @@ whose day is counted) or with `PRIORS_STATE_DIR` off (the day's count lives ther
|
|
|
223
252
|
|
|
224
253
|
The SDK runs the same plan from any key: `stockQuote`, `stockBuy` and `stockSell` in the repository's
|
|
225
254
|
`sdk/stock-trade.mjs` (bundled here byte for byte), each refused unless the caller passes `eligible: true`, which states
|
|
226
|
-
the same, and a buy names `agentId` (or `null` for a key that acts for no agent).
|
|
255
|
+
the same, and a buy names `agentId` (or `null` for a key that acts for no agent). With `rialto: {}` (or
|
|
256
|
+
`{ url, fetch, timeoutMs }`) they take Rialto's route as above, checked by `sdk/rialto.mjs` (bundled here too).
|
|
227
257
|
|
|
228
258
|
## Paying USDC sellers on Base (off by default)
|
|
229
259
|
|
|
@@ -294,6 +324,7 @@ may spend. Rows marked (0.8.0) take effect from that version; 0.7.x ignores them
|
|
|
294
324
|
| `PRIORS_MAX_SPEND_DAY_USD` | none | (0.8.0) most `pay_url` (with `pay_gateway`) may sign per UTC day for the agent and for its wallet, across restarts and every process sharing `PRIORS_STATE_DIR`; needs `PRIORS_AGENT_ID` and a state directory, or the server does not start; (0.12.0) `first_line`'s bond counts against it too |
|
|
295
325
|
| `PRIORS_MAX_BORROW_DAY_USD` | none | (0.8.0) most `borrow`, `pay_url`, `pay_gateway` and `fund_base` may borrow per UTC day for the agent and for its wallet, the same way; `0` turns borrowing off |
|
|
296
326
|
| `PRIORS_PAY_HOSTS` | any public https host | (0.8.0) the only hosts `pay_url` (and `pay_gateway`, at `keyring.vantis.sh`) pays, comma-separated, matched exactly (no wildcard; a port only when named) |
|
|
327
|
+
| `PRIORS_AUTO_BORROW_USD` | off | (0.15.0) auto-borrow: `pay_url` (and `pay_gateway`) borrow the gap on their own, up to this amount a call, when the call names no `max_borrow_usd` and the wallet and savings are short; only while this wallet's Autopay covers the new loan, for 14 days. Needs `PRIORS_MAX_BORROW_DAY_USD` above 0 and `PRIORS_PAY_HOSTS`, and at most `PRIORS_MAX_BORROW_USD` and `PRIORS_MAX_BORROW_TOTAL_USD`, or the server does not start. See "Inference on credit" below |
|
|
297
328
|
| `PRIORS_ALLOW_LOCAL` | off | `1` lets `pay_url` reach `http://localhost` and private addresses (local testing only) |
|
|
298
329
|
| `PRIORS_SCORE_V2` | `https://priors.trade/api/score-v2` | where `score_of` reads Priors Score v2; `off` shows the on-chain score only |
|
|
299
330
|
| `PRIORS_STOCK_VAULT` | the bundled deployments file's `stockVault` | the stock vault the stock tools and `credit_status` read |
|
|
@@ -336,7 +367,7 @@ Settings → Developer → Edit Config (`claude_desktop_config.json`), then rest
|
|
|
336
367
|
"mcpServers": {
|
|
337
368
|
"priors": {
|
|
338
369
|
"command": "npx",
|
|
339
|
-
"args": ["-y", "@priors/mcp@0.
|
|
370
|
+
"args": ["-y", "@priors/mcp@0.16.0"],
|
|
340
371
|
"env": {
|
|
341
372
|
"PRIORS_KEY": "0xYOUR_AGENT_WALLET_KEY",
|
|
342
373
|
"PRIORS_AGENT_ID": "1234"
|
|
@@ -358,7 +389,7 @@ A project `.mcp.json` that reads the key from your shell's environment, so the f
|
|
|
358
389
|
"mcpServers": {
|
|
359
390
|
"priors": {
|
|
360
391
|
"command": "npx",
|
|
361
|
-
"args": ["-y", "@priors/mcp@0.
|
|
392
|
+
"args": ["-y", "@priors/mcp@0.16.0"],
|
|
362
393
|
"env": {
|
|
363
394
|
"PRIORS_KEY": "${PRIORS_KEY}",
|
|
364
395
|
"PRIORS_AGENT_ID": "${PRIORS_AGENT_ID:-}"
|
|
@@ -371,7 +402,7 @@ A project `.mcp.json` that reads the key from your shell's environment, so the f
|
|
|
371
402
|
or, for your user only, from a macOS or Linux terminal:
|
|
372
403
|
|
|
373
404
|
```sh
|
|
374
|
-
(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.
|
|
405
|
+
(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.16.0' priors-mcp ~/.config/priors/agent.key
|
|
375
406
|
```
|
|
376
407
|
|
|
377
408
|
It waits for the key without showing it (paste it, then Enter), saves it in a file only you can read, and gives Claude
|
|
@@ -396,7 +427,8 @@ macOS or Linux terminal (it waits for the key without showing it):
|
|
|
396
427
|
The server reads the file only when nobody but you can: on Linux and macOS a regular file you own with no group or
|
|
397
428
|
other permission (`chmod 600`; root may read a file another user owns, such as a secret mounted owner-only into a
|
|
398
429
|
container, but only where every directory above it belongs to root or to that user and nobody else can write it, as
|
|
399
|
-
ssh requires: never under /tmp); on Windows a file whose access list lets only you, SYSTEM and Administrators read it
|
|
430
|
+
ssh requires: never under /tmp); on Windows a file whose access list lets only you, SYSTEM and Administrators read it
|
|
431
|
+
or change it (its content, or who may read it),
|
|
400
432
|
which `icacls "C:\Users\you\.config\priors\agent-7311.key" /inheritance:r /grant:r "%USERNAME%:R"` sets. Anything
|
|
401
433
|
else is refused and not read: the server then starts with its read-only tools, and every tool that moves money says
|
|
402
434
|
what to fix. The path is absolute or starts with `~/` (`~\` on Windows; in JSON write `C:\\Users\\…` or `C:/Users/…`). In a
|
|
@@ -422,12 +454,36 @@ internationalised names in their `xn--` form), so a look-alike spelled with othe
|
|
|
422
454
|
the list is refused before any request; pay_url never follows a redirect, and every request the payer sends is checked
|
|
423
455
|
against the list too. A wildcard, a URL or a path in the list stops the server at start.
|
|
424
456
|
|
|
457
|
+
**Inference on credit (`PRIORS_AUTO_BORROW_USD`, 0.15.0).** An agent that buys its own model calls, from an
|
|
458
|
+
OpenAI-compatible model API you choose that charges over x402 in USDG on Robinhood Chain, can keep working when its
|
|
459
|
+
wallet runs short mid-task. With `PRIORS_AUTO_BORROW_USD` set, a `pay_url` call that names no `max_borrow_usd` takes the
|
|
460
|
+
agent's savings first, then borrows the gap from its Priors line. The loan is the larger of the gap and the pool's
|
|
461
|
+
minimum loan (5 USDG, so one loan pays many 0.02 USDG calls), for 14 days. It borrows only when this wallet's Autopay
|
|
462
|
+
covers the new loan: the plan is on and current, its limit per loan is at least the loan's due, and its approval covers
|
|
463
|
+
that due on top of the loans it already repays. Otherwise nothing is borrowed or signed, and the answer says to turn
|
|
464
|
+
Autopay on (`autopay_on`). The wallet must be a key of the agent's own, declared with the registry's `setAgentWallet`:
|
|
465
|
+
an agent `join` registered still has this wallet, its owner, as its declared wallet, and AutoRepay repays such an agent
|
|
466
|
+
under its owner's plan only, so `autopay_on` and auto-borrow refuse it. Autopay then repays the loan from the wallet in its window, the last hours before it is due,
|
|
467
|
+
which keeps the loan seasoned. The day's borrow limit and the run's total still hold: once either has no room, a call
|
|
468
|
+
pays from what the wallet holds and says why it did not borrow. A call that names `max_borrow_usd` works as before
|
|
469
|
+
(`0` never borrows). There is no default host: auto-borrow pays only the hosts in `PRIORS_PAY_HOSTS`. Suggested
|
|
470
|
+
settings for an agent buying inference (`models.example` stands for the model API's host):
|
|
471
|
+
|
|
472
|
+
```json
|
|
473
|
+
"PRIORS_AUTO_BORROW_USD": "5", "PRIORS_MAX_BORROW_DAY_USD": "10", "PRIORS_PAY_HOSTS": "models.example",
|
|
474
|
+
"PRIORS_AGENT_ID": "7311", "PRIORS_STATE_DIR": "~/.local/state/priors-mcp"
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
Then a chat call: `pay_url` with `url` the API's chat completions URL (for example
|
|
478
|
+
`https://models.example/v1/chat/completions`), `method` `POST`, `body` the OpenAI-style request
|
|
479
|
+
(`{"model": "…", "messages": […]}`) and `max_price_usd` the most to pay for the call (for example `0.02`).
|
|
480
|
+
|
|
425
481
|
**A block per runtime.** The hosted connector (`https://mcp.priors.trade/mcp`, no key) reads records and asks the owner
|
|
426
482
|
to approve a borrow; this package, with the key, pays for APIs. With borrowing off, the agent asks and its owner
|
|
427
483
|
approves each loan in Priors' Go mode. ElizaOS (`@elizaos/plugin-mcp`):
|
|
428
484
|
|
|
429
485
|
```ts
|
|
430
|
-
"priors-wallet": { type: "stdio", command: "npx", args: ["-y", "@priors/mcp@0.
|
|
486
|
+
"priors-wallet": { type: "stdio", command: "npx", args: ["-y", "@priors/mcp@0.16.0"],
|
|
431
487
|
env: { PRIORS_KEY_FILE: "/home/agent/.config/priors/agent-7311.key", PRIORS_AGENT_ID: "7311",
|
|
432
488
|
PRIORS_MAX_BORROW_USD: "0", PRIORS_MAX_BORROW_DAY_USD: "0", PRIORS_MAX_SPEND_DAY_USD: "1", PRIORS_MAX_PRICE_USD: "0.10",
|
|
433
489
|
PRIORS_PAY_HOSTS: "api.example.com" } }
|
|
@@ -439,7 +495,7 @@ OpenClaw (`mcp.servers`, JSON5) takes the same `command`, `args` and `env`; Herm
|
|
|
439
495
|
mcp_servers:
|
|
440
496
|
priors-wallet:
|
|
441
497
|
command: npx
|
|
442
|
-
args: ["-y", "@priors/mcp@0.
|
|
498
|
+
args: ["-y", "@priors/mcp@0.16.0"]
|
|
443
499
|
env:
|
|
444
500
|
PRIORS_KEY_FILE: /home/agent/.config/priors/agent-7311.key
|
|
445
501
|
PRIORS_AGENT_ID: "7311"
|
|
@@ -466,7 +522,7 @@ key proves it is there: it signs the ERC-8004 identity registry's `AgentWalletSe
|
|
|
466
522
|
agent's).
|
|
467
523
|
|
|
468
524
|
```sh
|
|
469
|
-
PRIORS_KEY_FILE=~/.config/priors/agent-7311.key npx -y @priors/mcp@0.
|
|
525
|
+
PRIORS_KEY_FILE=~/.config/priors/agent-7311.key npx -y @priors/mcp@0.16.0 link-wallet --agent 7311
|
|
470
526
|
```
|
|
471
527
|
|
|
472
528
|
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,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"chainId": 4663,
|
|
3
|
+
"agentLease": "0xF2299A992879764ceF0107Aa9Beb07AdfBe0e479",
|
|
4
|
+
"agentLeaseBlock": 103660343,
|
|
5
|
+
"market": "0x6a4583242B8313313E684d02aB7dc6bFf8749670",
|
|
6
|
+
"tx": "0x30e3720f45094c01e9891e170dbe6c68187a7f8769990f193d8261dcd1191dc2",
|
|
7
|
+
"txBlock": 103660343,
|
|
8
|
+
"deployedAt": "2026-11-01T20:25:21Z",
|
|
9
|
+
"deployer": "0x140e38e4eD308e534fBb2Ee3EF057A51b98d5932",
|
|
10
|
+
"nonce": 577,
|
|
11
|
+
"gasUsed": 4431461,
|
|
12
|
+
"salt": "0x1607e98fccc3b56df6921c0595e4fe9051ebc2bfeb46a1ce4548611be2801bfe",
|
|
13
|
+
"constructorArgs": {
|
|
14
|
+
"registry": "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432",
|
|
15
|
+
"usdg": "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",
|
|
16
|
+
"poolV2": "0x281210097f0de7A8FB6F87310AF0f089c9C8DE21",
|
|
17
|
+
"poolV1": "0x0259889e6EBab1a18CeE7e62Bc5B9648FB6C44e5",
|
|
18
|
+
"market": "0x6a4583242B8313313E684d02aB7dc6bFf8749670",
|
|
19
|
+
"previous": "0xe5C8b3FacD7802099C1DfB88c0C818Cd0ebA7B19",
|
|
20
|
+
"guardian": "0x20c6816B2419616238772591965E6E9AbE493fD5"
|
|
21
|
+
},
|
|
22
|
+
"constructorArgsEncoded": "0x0000000000000000000000008004a169fb4a3325136eb29fa0ceb6d2e539a4320000000000000000000000005fc5360d0400a0fd4f2af552add042d716f1d168000000000000000000000000281210097f0de7a8fb6f87310af0f089c9c8de210000000000000000000000000259889e6ebab1a18cee7e62bc5b9648fb6c44e50000000000000000000000006a4583242b8313313e684d02ab7dc6bff8749670000000000000000000000000e5c8b3facd7802099c1dfb88c0c818cd0eba7b1900000000000000000000000020c6816b2419616238772591965e6e9abe493fd5",
|
|
23
|
+
"source": "src/AgentLease.sol:AgentLease",
|
|
24
|
+
"sourceCommit": "0ffef5c1e74fd1623d42f45cf9bfcaded43f1704",
|
|
25
|
+
"compiler": {
|
|
26
|
+
"solc": "0.8.26+commit.8a97fa7a",
|
|
27
|
+
"optimizer": true,
|
|
28
|
+
"runs": 200,
|
|
29
|
+
"evmVersion": "cancun",
|
|
30
|
+
"viaIR": false
|
|
31
|
+
},
|
|
32
|
+
"creationCodeHash": "0xd94df7813804743e9c20f9e343f9ee23cc8188948c98912ce6003b06f1ccb8cd",
|
|
33
|
+
"initcodeHash": "0x3465dbbf5d4d99fc77b5b3706dd2323946ecb5a81defbf6cfff55c5f0cbf593f",
|
|
34
|
+
"runtimeCodeHash": "0xd9b292e4f9aac597020934aad823c69b2b24e968d8d69cb0f1b24657cc6d3867",
|
|
35
|
+
"verification": {
|
|
36
|
+
"script": "script/DeployAgentLease.s.sol verify(): the address is CREATE2(factory, salt, this build's initcode) and the runtime code equals a fresh local copy's",
|
|
37
|
+
"sourcify": {
|
|
38
|
+
"match": "exact_match",
|
|
39
|
+
"creationMatch": "exact_match",
|
|
40
|
+
"runtimeMatch": "exact_match",
|
|
41
|
+
"verifiedAt": "2026-11-01T20:26:40Z",
|
|
42
|
+
"url": "https://sourcify.dev/server/v2/contract/4663/0xF2299A992879764ceF0107Aa9Beb07AdfBe0e479"
|
|
43
|
+
},
|
|
44
|
+
"blockscout": "verified (exact match), AgentLease, 2026-11-01T20:26:53Z: https://robinhoodchain.blockscout.com/address/0xF2299A992879764ceF0107Aa9Beb07AdfBe0e479?tab=contract"
|
|
45
|
+
}
|
|
46
|
+
}
|
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.
|
|
4
|
+
"version": "0.16.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",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@modelcontextprotocol/sdk": "^1.30.1",
|
|
48
|
-
"@priors/x402": "0.8.
|
|
48
|
+
"@priors/x402": "0.8.6",
|
|
49
49
|
"ethers": "^6.13.4",
|
|
50
50
|
"undici": "6.29.1",
|
|
51
51
|
"viem": "^2.56.9",
|