@priors/mcp 0.8.2 → 0.8.4
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 +18 -0
- package/README.md +7 -7
- package/deployments/4663.v2.json +4 -1
- package/package.json +2 -2
- package/src/key-file.mjs +31 -0
- package/src/server.mjs +11 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @priors/mcp changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.4 (2026-10-11)
|
|
4
|
+
|
|
5
|
+
- **SeatVaultV5 lines work out of the box.** The bundled `deployments/4663.v2.json` names SeatVaultV5
|
|
6
|
+
(`0xC999014C6218EC41f0aE412d49AE8f2aA4c539fD`, root `#8762`, live since 2026-10-11 and named by BuyAndBack and the
|
|
7
|
+
SwapLimiter), so a borrow on a V5 line refreshes the line first (from the agent's owner, or from this key once V5
|
|
8
|
+
has recorded it for 24 h); before, that needed `PRIORS_V5` and `PRIORS_V5_ROOT`, which still override it. On
|
|
9
|
+
`@priors/x402` 0.6.5, whose `robinhood` constants name the same V5 and whose `creditContracts` uses it by default.
|
|
10
|
+
|
|
11
|
+
## 0.8.3 (2026-10-10)
|
|
12
|
+
|
|
13
|
+
- **`PRIORS_STATE_DIR` must be yours alone** (GHSA-52gp-533q-jx99). It keeps what stops a payment being signed twice
|
|
14
|
+
and the daily limits' ledgers; another local user who could rename its entries made the server start counting from
|
|
15
|
+
nothing (a second borrow past `PRIORS_MAX_BORROW_DAY_USD`). On Linux and macOS, with a wallet configured, the
|
|
16
|
+
directory must belong to your user with no group or other write bit, and every directory above it must belong to
|
|
17
|
+
root or you and not be writable by others unless sticky (`/tmp`): OpenSSH's rule. Otherwise every money tool refuses
|
|
18
|
+
and says what to fix (`chmod 700`), and the read-only tools still answer. The default directory is created `0700`
|
|
19
|
+
and passes; one you made yourself under a `0002` umask (`0775`) needs `chmod 700`.
|
|
20
|
+
|
|
3
21
|
## 0.8.2 (2026-10-10)
|
|
4
22
|
|
|
5
23
|
- **On `@priors/x402` 0.6.4**, whose merchant-side `recordGate` keeps a bounded cache (GHSA-vjcp-qx2h-gr2q). The MCP
|
package/README.md
CHANGED
|
@@ -156,7 +156,7 @@ may spend. Rows marked (0.8.0) take effect from that version; 0.7.x ignores them
|
|
|
156
156
|
| `PRIORS_MAX_BRIDGE_TOTAL_USD` | `25` | most both may move in total while the server runs, either way (a transfer that may be out counts, and one in flight when the server starts counts too) |
|
|
157
157
|
| `PRIORS_MAX_BRIDGE_FEE_BPS` | `100` | a bridge fee above this, in basis points of the amount, is refused |
|
|
158
158
|
| `PRIORS_MAX_BASE_FLOAT_USD` | `10` | `fund_base` never brings the Base float above this |
|
|
159
|
-
| `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 |
|
|
159
|
+
| `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. |
|
|
160
160
|
|
|
161
161
|
Contract addresses (pool, lens, registry, USDG) come from `deployments/4663.v2.json`, bundled in the package, and the
|
|
162
162
|
accepted stock tokens from `deployments/stock-assets.4663.json`. The stock vault's address (live since 2026-09-28)
|
|
@@ -171,7 +171,7 @@ Settings → Developer → Edit Config (`claude_desktop_config.json`), then rest
|
|
|
171
171
|
"mcpServers": {
|
|
172
172
|
"priors": {
|
|
173
173
|
"command": "npx",
|
|
174
|
-
"args": ["-y", "@priors/mcp@0.8.
|
|
174
|
+
"args": ["-y", "@priors/mcp@0.8.4"],
|
|
175
175
|
"env": {
|
|
176
176
|
"PRIORS_KEY": "0xYOUR_AGENT_WALLET_KEY",
|
|
177
177
|
"PRIORS_AGENT_ID": "1234"
|
|
@@ -193,7 +193,7 @@ A project `.mcp.json` that reads the key from your shell's environment, so the f
|
|
|
193
193
|
"mcpServers": {
|
|
194
194
|
"priors": {
|
|
195
195
|
"command": "npx",
|
|
196
|
-
"args": ["-y", "@priors/mcp@0.8.
|
|
196
|
+
"args": ["-y", "@priors/mcp@0.8.4"],
|
|
197
197
|
"env": {
|
|
198
198
|
"PRIORS_KEY": "${PRIORS_KEY}",
|
|
199
199
|
"PRIORS_AGENT_ID": "${PRIORS_AGENT_ID:-}"
|
|
@@ -206,7 +206,7 @@ A project `.mcp.json` that reads the key from your shell's environment, so the f
|
|
|
206
206
|
or, for your user only, from a macOS or Linux terminal:
|
|
207
207
|
|
|
208
208
|
```sh
|
|
209
|
-
(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.8.
|
|
209
|
+
(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.8.4' priors-mcp ~/.config/priors/agent.key
|
|
210
210
|
```
|
|
211
211
|
|
|
212
212
|
It waits for the key without showing it (paste it, then Enter), saves it in a file only you can read, and gives Claude
|
|
@@ -259,7 +259,7 @@ to approve a borrow; this package, with the key, pays for APIs. With borrowing o
|
|
|
259
259
|
approves each loan in Priors' Go mode. ElizaOS (`@elizaos/plugin-mcp`):
|
|
260
260
|
|
|
261
261
|
```ts
|
|
262
|
-
"priors-wallet": { type: "stdio", command: "npx", args: ["-y", "@priors/mcp@0.8.
|
|
262
|
+
"priors-wallet": { type: "stdio", command: "npx", args: ["-y", "@priors/mcp@0.8.4"],
|
|
263
263
|
env: { PRIORS_KEY_FILE: "/home/agent/.config/priors/agent-7311.key", PRIORS_AGENT_ID: "7311",
|
|
264
264
|
PRIORS_MAX_BORROW_USD: "0", PRIORS_MAX_BORROW_DAY_USD: "0", PRIORS_MAX_SPEND_DAY_USD: "1", PRIORS_MAX_PRICE_USD: "0.10",
|
|
265
265
|
PRIORS_PAY_HOSTS: "api.example.com" } }
|
|
@@ -271,7 +271,7 @@ OpenClaw (`mcp.servers`, JSON5) takes the same `command`, `args` and `env`; Herm
|
|
|
271
271
|
mcp_servers:
|
|
272
272
|
priors-wallet:
|
|
273
273
|
command: npx
|
|
274
|
-
args: ["-y", "@priors/mcp@0.8.
|
|
274
|
+
args: ["-y", "@priors/mcp@0.8.4"]
|
|
275
275
|
env:
|
|
276
276
|
PRIORS_KEY_FILE: /home/agent/.config/priors/agent-7311.key
|
|
277
277
|
PRIORS_AGENT_ID: "7311"
|
|
@@ -298,7 +298,7 @@ key proves it is there: it signs the ERC-8004 identity registry's `AgentWalletSe
|
|
|
298
298
|
agent's).
|
|
299
299
|
|
|
300
300
|
```sh
|
|
301
|
-
PRIORS_KEY_FILE=~/.config/priors/agent-7311.key npx -y @priors/mcp@0.8.
|
|
301
|
+
PRIORS_KEY_FILE=~/.config/priors/agent-7311.key npx -y @priors/mcp@0.8.4 link-wallet --agent 7311
|
|
302
302
|
```
|
|
303
303
|
|
|
304
304
|
It reads the registry's EIP-712 domain and refuses to sign for any other, takes the owner from the chain (`--owner`
|
package/deployments/4663.v2.json
CHANGED
|
@@ -32,5 +32,8 @@
|
|
|
32
32
|
"seatSizerV4Block": 75614955,
|
|
33
33
|
"autoRepayV1": "0x765f51Bd38404154762f2822d3ac5d16CE9AF822",
|
|
34
34
|
"autoRepayV1Block": 79616581,
|
|
35
|
-
"autoRepayV1Note": "AutoRepay v1: retired before use, never enrolled, no allowance. Replaced by AutoRepay v2, recorded here as autoRepay and autoRepayBlock once deployed. Kept so the score mapping recognises both; nothing else uses it."
|
|
35
|
+
"autoRepayV1Note": "AutoRepay v1: retired before use, never enrolled, no allowance. Replaced by AutoRepay v2, recorded here as autoRepay and autoRepayBlock once deployed. Kept so the score mapping recognises both; nothing else uses it.",
|
|
36
|
+
"seatVaultV5": "0xC999014C6218EC41f0aE412d49AE8f2aA4c539fD",
|
|
37
|
+
"seatVaultV5AgentId": 8762,
|
|
38
|
+
"seatVaultV5Block": 85924243
|
|
36
39
|
}
|
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.8.
|
|
4
|
+
"version": "0.8.4",
|
|
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.6.
|
|
48
|
+
"@priors/x402": "0.6.5",
|
|
49
49
|
"ethers": "^6.13.4",
|
|
50
50
|
"undici": "6.29.0",
|
|
51
51
|
"viem": "^2.56.9",
|
package/src/key-file.mjs
CHANGED
|
@@ -117,6 +117,37 @@ export function securePathProblem(file, st, fs) {
|
|
|
117
117
|
return null;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
/**
|
|
121
|
+
* For PRIORS_STATE_DIR (POSIX): null when no other local user can rename or remove what is in `dir`, else what is wrong.
|
|
122
|
+
* It keeps the records that stop a payment being signed twice and the daily limits' ledgers, and a user who can write
|
|
123
|
+
* to it, or to a directory above it without the sticky bit, can move them aside so the server starts counting from
|
|
124
|
+
* nothing (GHSA-52gp). `dir` must belong to this user with no group or other write bit; each directory above it,
|
|
125
|
+
* on the path as given and as resolved, must belong to root or this user with no group or other write bit unless it
|
|
126
|
+
* is sticky (/tmp is): OpenSSH's rule, since a user's primary group can be shared (macOS's staff). `fs` needs
|
|
127
|
+
* realpathSync and statSync; `uid` is this process's.
|
|
128
|
+
*/
|
|
129
|
+
export function stateDirProblem(dir, { fs, uid }) {
|
|
130
|
+
let real, st;
|
|
131
|
+
try { real = fs.realpathSync(dir); st = fs.statSync(real); } catch (e) { return `it could not be checked (${e?.code || "error"})`; }
|
|
132
|
+
if (st.uid !== uid) return `it belongs to another user (uid ${st.uid})`;
|
|
133
|
+
if ((st.mode & 0o022) !== 0) return `other users can write to it (mode ${(st.mode & 0o7777).toString(8).padStart(4, "0")})`;
|
|
134
|
+
const dirs = [];
|
|
135
|
+
for (const p of [dir, real]) {
|
|
136
|
+
for (let d = path.posix.dirname(p); ; d = path.posix.dirname(d)) {
|
|
137
|
+
if (!dirs.includes(d)) dirs.push(d);
|
|
138
|
+
if (d === path.posix.dirname(d)) break;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
for (const d of dirs) {
|
|
142
|
+
let ds;
|
|
143
|
+
try { ds = fs.statSync(d); } catch (e) { return `the directory ${d} above it could not be checked (${e?.code || "error"})`; }
|
|
144
|
+
const sticky = (ds.mode & 0o1000) !== 0;
|
|
145
|
+
if (ds.uid !== 0 && ds.uid !== uid) return `the directory ${d} above it belongs to another user (uid ${ds.uid})`;
|
|
146
|
+
if (!sticky && (ds.mode & 0o022) !== 0) return `other users can write to the directory ${d} above it (mode ${(ds.mode & 0o7777).toString(8).padStart(4, "0")})`;
|
|
147
|
+
}
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
|
|
120
151
|
/** The absolute path PRIORS_KEY_FILE names on `platform` (~ expanded), or a problem. */
|
|
121
152
|
export function keyFilePath(raw, { platform = process.platform, homedir = osHomedir } = {}) {
|
|
122
153
|
const p = platform === "win32" ? path.win32 : path.posix;
|
package/src/server.mjs
CHANGED
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
// PRIORS_MAX_BRIDGE_TOTAL_USD most both may move in total while the server runs, either way (default 25)
|
|
66
66
|
// PRIORS_MAX_BRIDGE_FEE_BPS a bridge fee above this, in basis points of the amount, is refused (default 100)
|
|
67
67
|
// PRIORS_MAX_BASE_FLOAT_USD fund_base never brings the Base float above this (default 10)
|
|
68
|
-
import { readFileSync, writeFileSync, mkdirSync, renameSync, openSync, closeSync, statSync, rmSync } from "node:fs";
|
|
68
|
+
import { readFileSync, writeFileSync, mkdirSync, renameSync, openSync, closeSync, statSync, rmSync, existsSync, realpathSync } from "node:fs";
|
|
69
69
|
import { homedir } from "node:os";
|
|
70
70
|
import { isAbsolute, join } from "node:path";
|
|
71
71
|
import { randomBytes } from "node:crypto";
|
|
@@ -82,7 +82,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
82
82
|
import * as P from "./pt-usdg.mjs";
|
|
83
83
|
// 0.8.0, for agents that run on their own and read untrusted text (posts on X, mail, web pages): the key from a file,
|
|
84
84
|
// limits per UTC day that survive a restart, a list of hosts pay_url may pay, and the facts repay returns for a post.
|
|
85
|
-
import { keyFromEnv } from "./key-file.mjs";
|
|
85
|
+
import { keyFromEnv, stateDirProblem } from "./key-file.mjs";
|
|
86
86
|
import { parsePayHosts, hostAllowed, hostKey, guardFetch } from "./pay-hosts.mjs";
|
|
87
87
|
import { agentOf, dailyLedger, ledgerOwners } from "./daily.mjs";
|
|
88
88
|
import { shareFacts, factsLine, repaidPost } from "./share.mjs";
|
|
@@ -449,6 +449,14 @@ export async function createPriorsMcpServer({ env = process.env, fetchImpl = glo
|
|
|
449
449
|
if (stateHome && !/^(off|none|false|0)$/i.test(stateHome) && !isAbsolute(stateHome)) throw new Error(`PRIORS_STATE_DIR must be an absolute path (or start with ~/), not "${stateRaw}"`);
|
|
450
450
|
const stateDir = /^(off|none|false|0)$/i.test(stateRaw) ? null : stateHome || join(homedir(), ".local", "state", "priors-mcp");
|
|
451
451
|
const stateFile = wallet && stateDir ? join(stateDir, `outstanding-${wallet.address.toLowerCase()}.json`) : null;
|
|
452
|
+
// ...and only this user may change what is in it (POSIX): another local user who can rename its entries resets what
|
|
453
|
+
// keeps a payment from being signed twice and the daily limits (GHSA-52gp). Then the money tools refuse, as with a key
|
|
454
|
+
// they cannot use, and the read-only tools still answer. A directory that cannot be made at all is left to the writes.
|
|
455
|
+
let stateProblem = null;
|
|
456
|
+
if (wallet && stateDir && process.platform !== "win32" && typeof process.getuid === "function") {
|
|
457
|
+
try { mkdirSync(stateDir, { recursive: true, mode: 0o700 }); } catch (_) { /* checked below if it exists */ }
|
|
458
|
+
if (existsSync(stateDir)) stateProblem = stateDirProblem(stateDir, { fs: { realpathSync, statSync }, uid: process.getuid() });
|
|
459
|
+
}
|
|
452
460
|
// The daily ledger lives there too: without a state directory a daily limit could not outlive the process, and a
|
|
453
461
|
// limit that quietly resets on a restart is the very thing it replaces, so the start stops instead.
|
|
454
462
|
if ((daySpendCap !== null || dayBorrowCap !== null) && !stateDir) throw new Error("PRIORS_MAX_SPEND_DAY_USD and PRIORS_MAX_BORROW_DAY_USD are kept in PRIORS_STATE_DIR, which is off: set PRIORS_STATE_DIR to a directory, or unset the daily limits");
|
|
@@ -795,6 +803,7 @@ export async function createPriorsMcpServer({ env = process.env, fetchImpl = glo
|
|
|
795
803
|
|
|
796
804
|
function needWallet(action) {
|
|
797
805
|
if (keyProblem) throw new ToolError(keyed.problem ? `${action} needs a wallet, but ${keyProblem}. Nothing was done: restart the MCP server once that is fixed.` : `${action} needs a wallet, but ${keyProblem}. Fix ${keyed.source ?? "PRIORS_KEY"} in the MCP server's environment.`);
|
|
806
|
+
if (wallet && stateProblem) throw new ToolError(`${action} needs a wallet, but PRIORS_STATE_DIR ${stateDir}: ${stateProblem}, so another local user could move aside the records that keep a payment from being signed twice and the daily limits. Nothing was done: make it yours alone (chmod 700, with no directory above it that other users can write to) or set PRIORS_STATE_DIR to one that is, then restart the MCP server.`);
|
|
798
807
|
if (!wallet) throw new ToolError(`${action} moves money and needs a wallet: set PRIORS_KEY_FILE (the path of a file holding the key, readable by your user only) or PRIORS_KEY in the MCP server's environment (never pass a key as a tool argument or on the command line). Read-only tools (wallet_balance and savings with an address, credit_status, stock_assets, stock_position, score_of, find_services) work without it.`);
|
|
799
808
|
return wallet;
|
|
800
809
|
}
|