@priors/mcp 0.14.1 → 0.15.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 +31 -0
- package/README.md +34 -6
- package/package.json +2 -2
- package/src/agent-lease.mjs +657 -0
- package/src/market-plan.mjs +86 -33
- package/src/market-tools.mjs +130 -45
- package/src/server.mjs +85 -18
- package/src/work-types.mjs +67 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @priors/mcp changelog
|
|
2
2
|
|
|
3
|
+
## 0.15.0 (2026-11-01)
|
|
4
|
+
|
|
5
|
+
- **Auto-borrow, for inference on credit** (`PRIORS_AUTO_BORROW_USD`, off by default): with it set, a `pay_url` (or
|
|
6
|
+
`pay_gateway`) call that names no `max_borrow_usd` borrows the gap on its own when the wallet and the agent's
|
|
7
|
+
savings are short, up to that amount a call, for 14 days. That way an agent buying its own model calls (agent402.tools'
|
|
8
|
+
OpenAI-compatible chat, paid over x402 in USDG on Robinhood Chain) keeps working mid-task. The guards:
|
|
9
|
+
- It borrows only while this wallet's Autopay covers the new loan: plan on and current, not held or paused, its
|
|
10
|
+
limit per loan at least the loan's due, its approval enough for that due on top of the loans it already repays.
|
|
11
|
+
Otherwise nothing is borrowed or signed, and the answer says to turn Autopay on.
|
|
12
|
+
- The server does not start with it unless `PRIORS_MAX_BORROW_DAY_USD` (above 0, with `PRIORS_AGENT_ID` and
|
|
13
|
+
`PRIORS_STATE_DIR`) and `PRIORS_PAY_HOSTS` are set, and it is at most `PRIORS_MAX_BORROW_USD` and
|
|
14
|
+
`PRIORS_MAX_BORROW_TOTAL_USD`.
|
|
15
|
+
- 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
|
|
16
|
+
did not borrow, instead of being refused.
|
|
17
|
+
- The control check and the Autopay check run only once the wallet is short, so a call that needs no loan makes no
|
|
18
|
+
extra read.
|
|
19
|
+
- A call naming `max_borrow_usd` works as before (`0` never borrows).
|
|
20
|
+
|
|
21
|
+
`pay_url`'s description, its answers, the instructions and `credit_status` say when it is on.
|
|
22
|
+
|
|
23
|
+
- **The market tools claim on an agent's lease around a change of hands, once this package carries AgentLease's
|
|
24
|
+
record** (`deployments/4663.agent-lease.json`, written by the lease's deploy; AgentLease isn't deployed, so there is
|
|
25
|
+
none yet, and every tool, read and answer is as before). With it, `market_buy` and `market_accept` read the lease
|
|
26
|
+
stored on the agent (`leaseOf`) and, while one is stored, send `claim` on the lease before the change of hands and
|
|
27
|
+
after it (gas only), the client rule of `docs/AGENT-LEASE.md`, so each day's rent goes to whoever held the agent when
|
|
28
|
+
the day ended. The lease is confirmed at the first market call (its `market()` must be this package's AgentMarketV2),
|
|
29
|
+
else every market tool refuses. `market_agent` says who runs a rented agent and until when. A claim after the change
|
|
30
|
+
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
|
|
31
|
+
from the market record too. The lease's seam (`src/agent-lease.mjs`, `sdk/agent-lease.mjs` in the repository) is
|
|
32
|
+
bundled byte for byte.
|
|
33
|
+
|
|
3
34
|
## 0.14.1 (2026-10-30)
|
|
4
35
|
|
|
5
36
|
On @priors/x402 0.8.4, whose @x402 packages are 2.29.0 or later.
|
package/README.md
CHANGED
|
@@ -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), once this package carries the lease's record (`deployments/4663.agent-lease.json`, written by its
|
|
133
|
+
deploy; there is none before): a rented agent changes hands with its lease, and `market_buy` and `market_accept` claim
|
|
134
|
+
on the lease before and after the change of hands while a lease is stored on the agent (`claim`, gas only), as every
|
|
135
|
+
change of hands on Priors does, so each day's rent goes to whoever held the agent when the day ended. `market_agent`
|
|
136
|
+
says who runs a rented agent and until when. A claim after that can't be sent, or doesn't go through, leaves the change
|
|
137
|
+
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 |
|
|
@@ -294,6 +301,7 @@ may spend. Rows marked (0.8.0) take effect from that version; 0.7.x ignores them
|
|
|
294
301
|
| `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
302
|
| `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
303
|
| `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) |
|
|
304
|
+
| `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
305
|
| `PRIORS_ALLOW_LOCAL` | off | `1` lets `pay_url` reach `http://localhost` and private addresses (local testing only) |
|
|
298
306
|
| `PRIORS_SCORE_V2` | `https://priors.trade/api/score-v2` | where `score_of` reads Priors Score v2; `off` shows the on-chain score only |
|
|
299
307
|
| `PRIORS_STOCK_VAULT` | the bundled deployments file's `stockVault` | the stock vault the stock tools and `credit_status` read |
|
|
@@ -336,7 +344,7 @@ Settings → Developer → Edit Config (`claude_desktop_config.json`), then rest
|
|
|
336
344
|
"mcpServers": {
|
|
337
345
|
"priors": {
|
|
338
346
|
"command": "npx",
|
|
339
|
-
"args": ["-y", "@priors/mcp@0.
|
|
347
|
+
"args": ["-y", "@priors/mcp@0.15.0"],
|
|
340
348
|
"env": {
|
|
341
349
|
"PRIORS_KEY": "0xYOUR_AGENT_WALLET_KEY",
|
|
342
350
|
"PRIORS_AGENT_ID": "1234"
|
|
@@ -358,7 +366,7 @@ A project `.mcp.json` that reads the key from your shell's environment, so the f
|
|
|
358
366
|
"mcpServers": {
|
|
359
367
|
"priors": {
|
|
360
368
|
"command": "npx",
|
|
361
|
-
"args": ["-y", "@priors/mcp@0.
|
|
369
|
+
"args": ["-y", "@priors/mcp@0.15.0"],
|
|
362
370
|
"env": {
|
|
363
371
|
"PRIORS_KEY": "${PRIORS_KEY}",
|
|
364
372
|
"PRIORS_AGENT_ID": "${PRIORS_AGENT_ID:-}"
|
|
@@ -371,7 +379,7 @@ A project `.mcp.json` that reads the key from your shell's environment, so the f
|
|
|
371
379
|
or, for your user only, from a macOS or Linux terminal:
|
|
372
380
|
|
|
373
381
|
```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.
|
|
382
|
+
(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.15.0' priors-mcp ~/.config/priors/agent.key
|
|
375
383
|
```
|
|
376
384
|
|
|
377
385
|
It waits for the key without showing it (paste it, then Enter), saves it in a file only you can read, and gives Claude
|
|
@@ -422,12 +430,32 @@ internationalised names in their `xn--` form), so a look-alike spelled with othe
|
|
|
422
430
|
the list is refused before any request; pay_url never follows a redirect, and every request the payer sends is checked
|
|
423
431
|
against the list too. A wildcard, a URL or a path in the list stops the server at start.
|
|
424
432
|
|
|
433
|
+
**Inference on credit (`PRIORS_AUTO_BORROW_USD`, 0.15.0).** An agent that buys its own model calls, such as
|
|
434
|
+
agent402.tools' OpenAI-compatible chat paid over x402 in USDG on Robinhood Chain, can keep working when its wallet
|
|
435
|
+
runs short mid-task. With `PRIORS_AUTO_BORROW_USD` set, a `pay_url` call that names no `max_borrow_usd` takes the
|
|
436
|
+
agent's savings first, then borrows the gap from its Priors line. The loan is the larger of the gap and the pool's
|
|
437
|
+
minimum loan (5 USDG, so one loan pays many 0.02 USDG calls), for 14 days. It borrows only when this wallet's Autopay
|
|
438
|
+
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
|
|
439
|
+
that due on top of the loans it already repays. Otherwise nothing is borrowed or signed, and the answer says to turn
|
|
440
|
+
Autopay on (`autopay_on`). Autopay then repays the loan from the wallet in its window, the last hours before it is due,
|
|
441
|
+
which keeps the loan seasoned. The day's borrow limit and the run's total still hold: once either has no room, a call
|
|
442
|
+
pays from what the wallet holds and says why it did not borrow. A call that names `max_borrow_usd` works as before
|
|
443
|
+
(`0` never borrows). Suggested settings for an agent buying inference:
|
|
444
|
+
|
|
445
|
+
```json
|
|
446
|
+
"PRIORS_AUTO_BORROW_USD": "5", "PRIORS_MAX_BORROW_DAY_USD": "10", "PRIORS_PAY_HOSTS": "agent402.tools",
|
|
447
|
+
"PRIORS_AGENT_ID": "7311", "PRIORS_STATE_DIR": "~/.local/state/priors-mcp"
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
Then a chat call: `pay_url` with `url` `https://agent402.tools/v1/chat/completions`, `method` `POST`, `body` the
|
|
451
|
+
OpenAI-style request (`{"model": "…", "messages": […]}`) and `max_price_usd` `0.02`.
|
|
452
|
+
|
|
425
453
|
**A block per runtime.** The hosted connector (`https://mcp.priors.trade/mcp`, no key) reads records and asks the owner
|
|
426
454
|
to approve a borrow; this package, with the key, pays for APIs. With borrowing off, the agent asks and its owner
|
|
427
455
|
approves each loan in Priors' Go mode. ElizaOS (`@elizaos/plugin-mcp`):
|
|
428
456
|
|
|
429
457
|
```ts
|
|
430
|
-
"priors-wallet": { type: "stdio", command: "npx", args: ["-y", "@priors/mcp@0.
|
|
458
|
+
"priors-wallet": { type: "stdio", command: "npx", args: ["-y", "@priors/mcp@0.15.0"],
|
|
431
459
|
env: { PRIORS_KEY_FILE: "/home/agent/.config/priors/agent-7311.key", PRIORS_AGENT_ID: "7311",
|
|
432
460
|
PRIORS_MAX_BORROW_USD: "0", PRIORS_MAX_BORROW_DAY_USD: "0", PRIORS_MAX_SPEND_DAY_USD: "1", PRIORS_MAX_PRICE_USD: "0.10",
|
|
433
461
|
PRIORS_PAY_HOSTS: "api.example.com" } }
|
|
@@ -439,7 +467,7 @@ OpenClaw (`mcp.servers`, JSON5) takes the same `command`, `args` and `env`; Herm
|
|
|
439
467
|
mcp_servers:
|
|
440
468
|
priors-wallet:
|
|
441
469
|
command: npx
|
|
442
|
-
args: ["-y", "@priors/mcp@0.
|
|
470
|
+
args: ["-y", "@priors/mcp@0.15.0"]
|
|
443
471
|
env:
|
|
444
472
|
PRIORS_KEY_FILE: /home/agent/.config/priors/agent-7311.key
|
|
445
473
|
PRIORS_AGENT_ID: "7311"
|
|
@@ -466,7 +494,7 @@ key proves it is there: it signs the ERC-8004 identity registry's `AgentWalletSe
|
|
|
466
494
|
agent's).
|
|
467
495
|
|
|
468
496
|
```sh
|
|
469
|
-
PRIORS_KEY_FILE=~/.config/priors/agent-7311.key npx -y @priors/mcp@0.
|
|
497
|
+
PRIORS_KEY_FILE=~/.config/priors/agent-7311.key npx -y @priors/mcp@0.15.0 link-wallet --agent 7311
|
|
470
498
|
```
|
|
471
499
|
|
|
472
500
|
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.
|
|
4
|
+
"version": "0.15.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.5",
|
|
49
49
|
"ethers": "^6.13.4",
|
|
50
50
|
"undici": "6.29.1",
|
|
51
51
|
"viem": "^2.56.9",
|