@priors/mcp 0.1.7 → 0.2.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/README.md CHANGED
@@ -23,7 +23,9 @@ repaying.
23
23
  |---|---|---|
24
24
  | `pay_url(url, method?, body?, max_price_usd?, max_borrow_usd?)` | fetch an https URL, pay its x402 402 in USDG if the price is ≤ `max_price_usd` (default **$0.10**); borrows the gap only if `max_borrow_usd` is given. Refuses private and local addresses, never follows a redirect, answers within 45 s, and never signs a second payment for a purchase that is still pending (a new call resends the same one) | yes |
25
25
  | `wallet_balance(address?)` | USDG and gas ETH of the wallet (or any address) | no (with `address`) |
26
- | `credit_status(agent_id?)` | line, drawn, available, backer, record, score, open loans and due dates | no (with `agent_id`) |
26
+ | `credit_status(agent_id?)` | line, drawn, available, backer, record, score, open loans and due dates; on a stock line, the stock tokens behind it, and `available` capped by what the stock vault lets it draw | no (with `agent_id`) |
27
+ | `stock_assets(symbol?)` | the stock tokens the Priors stock vault accepts: live Chainlink price, whether it lends against each now (or why not: a sharp price move, a multiplier change, a paused or blocked token), loan-to-value | no |
28
+ | `stock_position(agent_id?)` | the stock tokens behind an agent's stock line: amount, what the vault values them at, loan-to-value, what the line can draw now, any lending hold | no (with `agent_id`) |
27
29
  | `borrow(amount_usd, days, dry_run?)` | borrow USDG from the line into the wallet; both amounts required; `dry_run` quotes the fee | yes |
28
30
  | `repay(loan_id? \| all)` | repay one of the agent's own loans, or all of them earliest due first; another agent's loan is refused | yes |
29
31
  | `score_of(agent_id)` | any agent's on-chain score (0 to 1000) and repayment record, plus its Priors Score v2 and trust rung when published | no |
@@ -51,8 +53,11 @@ dedicated agent wallet holding only what the agent may spend.
51
53
  | `PRIORS_MAX_BORROW_TOTAL_USD` | `25` | most `borrow` and `pay_url` may borrow in total while the server runs |
52
54
  | `PRIORS_ALLOW_LOCAL` | off | `1` lets `pay_url` reach `http://localhost` and private addresses (local testing only) |
53
55
  | `PRIORS_SCORE_V2` | `https://priors.trade/api/score-v2` | where `score_of` reads Priors Score v2; `off` shows the on-chain score only |
56
+ | `PRIORS_STOCK_VAULT` | the bundled deployments file's `stockVault` | the stock vault the stock tools and `credit_status` read |
54
57
 
55
- Contract addresses (pool, lens, registry, USDG) come from `deployments/4663.v2.json`, bundled in the package.
58
+ Contract addresses (pool, lens, registry, USDG) come from `deployments/4663.v2.json`, bundled in the package, and the
59
+ accepted stock tokens from `deployments/stock-assets.4663.json`. The stock vault's address (live since 2026-09-28)
60
+ comes from the same deployments file, or from `PRIORS_STOCK_VAULT`.
56
61
 
57
62
  ### Claude Desktop
58
63
 
@@ -63,7 +68,7 @@ Settings → Developer → Edit Config (`claude_desktop_config.json`), then rest
63
68
  "mcpServers": {
64
69
  "priors": {
65
70
  "command": "npx",
66
- "args": ["-y", "@priors/mcp@0.1.7"],
71
+ "args": ["-y", "@priors/mcp@0.2.0"],
67
72
  "env": {
68
73
  "PRIORS_KEY": "0xYOUR_AGENT_WALLET_KEY",
69
74
  "PRIORS_AGENT_ID": "1234"
@@ -85,7 +90,7 @@ A project `.mcp.json` that reads the key from your shell's environment, so the f
85
90
  "mcpServers": {
86
91
  "priors": {
87
92
  "command": "npx",
88
- "args": ["-y", "@priors/mcp@0.1.7"],
93
+ "args": ["-y", "@priors/mcp@0.2.0"],
89
94
  "env": {
90
95
  "PRIORS_KEY": "${PRIORS_KEY}",
91
96
  "PRIORS_AGENT_ID": "${PRIORS_AGENT_ID:-}"
@@ -95,7 +100,7 @@ A project `.mcp.json` that reads the key from your shell's environment, so the f
95
100
  }
96
101
  ```
97
102
 
98
- or, for your user only: `claude mcp add priors --scope user -e PRIORS_KEY="$PRIORS_KEY" -- npx -y @priors/mcp@0.1.7`
103
+ or, for your user only: `claude mcp add priors --scope user -e PRIORS_KEY="$PRIORS_KEY" -- npx -y @priors/mcp@0.2.0`
99
104
  (the key is expanded by your shell from the environment; do not paste it on the command line).
100
105
 
101
106
  ## Try it
@@ -25,5 +25,8 @@
25
25
  "v1Pool": "0x0259889e6EBab1a18CeE7e62Bc5B9648FB6C44e5",
26
26
  "seatVaultV2": "0x6D934C07a33E7285cE691A9B258cdB53F18e6B5F",
27
27
  "seatVaultV2AgentId": 6229,
28
- "seatVaultBlock": 72192188
28
+ "seatVaultBlock": 72192188,
29
+ "stockVault": "0xbEcd07EC689988e16b870C121756C4c2C8cb02B6",
30
+ "stockVaultAgentId": 6424,
31
+ "stockVaultBlock": 74826641
29
32
  }
@@ -0,0 +1,430 @@
1
+ {
2
+ "chainId": 4663,
3
+ "generatedAt": "2026-09-27T16:24:57.452Z",
4
+ "sources": {
5
+ "tokens": "https://api.robinhood.com/rhj/assets",
6
+ "prices": "https://reference-data-directory.vercel.app/feeds-robinhood-mainnet.json"
7
+ },
8
+ "assets": [
9
+ {
10
+ "symbol": "AAPL",
11
+ "name": "Apple",
12
+ "token": "0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9",
13
+ "decimals": 18,
14
+ "feed": "0x6B22A786bAa607d76728168703a39Ea9C99f2cD0",
15
+ "feedDecimals": 8,
16
+ "heartbeat": 86400,
17
+ "marketHours": "us_equities_24/5",
18
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0xaf3d76f1834a1d425780943c99ea8a608f8a93f9.png",
19
+ "isin": "US0378331005"
20
+ },
21
+ {
22
+ "symbol": "AMD",
23
+ "name": "AMD",
24
+ "token": "0x86923f96303D656E4aa86D9d42D1e57ad2023fdC",
25
+ "decimals": 18,
26
+ "feed": "0x943A29E7ae51A4798823ca9eEd2ed533B2A22C72",
27
+ "feedDecimals": 8,
28
+ "heartbeat": 86400,
29
+ "marketHours": "us_equities_24/5",
30
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0x86923f96303d656e4aa86d9d42d1e57ad2023fdc.png",
31
+ "isin": "US0079031078"
32
+ },
33
+ {
34
+ "symbol": "AMZN",
35
+ "name": "Amazon",
36
+ "token": "0x12f190a9F9d7D37a250758b26824B97CE941bF54",
37
+ "decimals": 18,
38
+ "feed": "0xD5a1508ceD74c084eBf3cBe853e2C968fB2a651C",
39
+ "feedDecimals": 8,
40
+ "heartbeat": 86400,
41
+ "marketHours": "us_equities_24/5",
42
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0x12f190a9f9d7d37a250758b26824b97ce941bf54.png",
43
+ "isin": "US0231351067"
44
+ },
45
+ {
46
+ "symbol": "ASML",
47
+ "name": "ASML Holding NV",
48
+ "token": "0x47F93d52cBeC7C6D2CfC080e154002370a60dAEA",
49
+ "decimals": 18,
50
+ "feed": "0xB4106147E8cce40b7d46124090d373A71b70f87D",
51
+ "feedDecimals": 8,
52
+ "heartbeat": 86400,
53
+ "marketHours": "us_equities_24/5",
54
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0x47f93d52cbec7c6d2cfc080e154002370a60daea.png",
55
+ "isin": "USN070592100"
56
+ },
57
+ {
58
+ "symbol": "BABA",
59
+ "name": "Alibaba",
60
+ "token": "0xad25Ac6C84D497db898fa1E8387bf6Af3532a1c4",
61
+ "decimals": 18,
62
+ "feed": "0x62Cc8F9b5f56a33c9C8A60c8B92779f523c4E984",
63
+ "feedDecimals": 8,
64
+ "heartbeat": 86400,
65
+ "marketHours": "us_equities_24/5",
66
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0xad25ac6c84d497db898fa1e8387bf6af3532a1c4.png",
67
+ "isin": "US01609W1027"
68
+ },
69
+ {
70
+ "symbol": "CLSK",
71
+ "name": "CleanSpark",
72
+ "token": "0xcBB95BBF36099d34dA091dc6Fa6F49EfA257Cee3",
73
+ "decimals": 18,
74
+ "feed": "0x810c12D3a554Bc47fd39597Fe3b3AAC4941F50eF",
75
+ "feedDecimals": 8,
76
+ "heartbeat": 86400,
77
+ "marketHours": "us_equities_24/5",
78
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0xcbb95bbf36099d34da091dc6fa6f49efa257cee3.png",
79
+ "isin": "US18452B2097"
80
+ },
81
+ {
82
+ "symbol": "COIN",
83
+ "name": "Coinbase",
84
+ "token": "0x6330D8C3178a418788dF01a47479c0ce7CCF450b",
85
+ "decimals": 18,
86
+ "feed": "0xA3a468A452940B7D6b69991207B508c609a98Ef2",
87
+ "feedDecimals": 8,
88
+ "heartbeat": 86400,
89
+ "marketHours": "us_equities_24/5",
90
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0x6330d8c3178a418788df01a47479c0ce7ccf450b.png",
91
+ "isin": "US19260Q1076"
92
+ },
93
+ {
94
+ "symbol": "CRCL",
95
+ "name": "Circle Internet Group",
96
+ "token": "0xdF0992E440dD0be65BD8439b609d6D4366bf1CB5",
97
+ "decimals": 18,
98
+ "feed": "0x6652eDf64bA3731C4F2D3ce821A0Fb1f1f6b482a",
99
+ "feedDecimals": 8,
100
+ "heartbeat": 86400,
101
+ "marketHours": "us_equities_24/5",
102
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0xdf0992e440dd0be65bd8439b609d6d4366bf1cb5.png",
103
+ "isin": "US1725731079"
104
+ },
105
+ {
106
+ "symbol": "CRWV",
107
+ "name": "CoreWeave",
108
+ "token": "0x5f10A1C971B69e47e059e1dC91901B59b3fB49C3",
109
+ "decimals": 18,
110
+ "feed": "0xe1b3aABCAFAd1c94708dc1367dcfF8Aa4407487C",
111
+ "feedDecimals": 8,
112
+ "heartbeat": 86400,
113
+ "marketHours": "us_equities_24/5",
114
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0x5f10a1c971b69e47e059e1dc91901b59b3fb49c3.png",
115
+ "isin": "US21873S1087"
116
+ },
117
+ {
118
+ "symbol": "DELL",
119
+ "name": "Dell",
120
+ "token": "0x941AE714EC6D8130c7B75d67160Ca08f1e7d11Dd",
121
+ "decimals": 18,
122
+ "feed": "0x1C6c8cADBe02E19129c39dDB92281cE4c0bf206b",
123
+ "feedDecimals": 8,
124
+ "heartbeat": 86400,
125
+ "marketHours": "us_equities_24/5",
126
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0x941ae714ec6d8130c7b75d67160ca08f1e7d11dd.png",
127
+ "isin": "US24703L2025"
128
+ },
129
+ {
130
+ "symbol": "EWY",
131
+ "name": "iShares MSCI South Korea fund",
132
+ "token": "0x7f0aBeF0C07280F82c6a08ead09dEd6BAE2C13Fc",
133
+ "decimals": 18,
134
+ "feed": "0xEFdf54610B62A7753Ec30bDc380847c12D32e1D1",
135
+ "feedDecimals": 8,
136
+ "heartbeat": 86400,
137
+ "marketHours": "us_equities_24/5",
138
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0x7f0abef0c07280f82c6a08ead09ded6bae2c13fc.png",
139
+ "isin": "US4642867729"
140
+ },
141
+ {
142
+ "symbol": "GME",
143
+ "name": "GameStop",
144
+ "token": "0x1b0E319c6A659F002271B69dB8A7df2F911c153E",
145
+ "decimals": 18,
146
+ "feed": "0x27C71df6A64fB476468EdF256CF72c038baB5B67",
147
+ "feedDecimals": 8,
148
+ "heartbeat": 86400,
149
+ "marketHours": "us_equities_24/5",
150
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0x1b0e319c6a659f002271b69db8a7df2f911c153e.png",
151
+ "isin": "US36467W1099"
152
+ },
153
+ {
154
+ "symbol": "GOOGL",
155
+ "name": "Alphabet Class A",
156
+ "token": "0x2e0847E8910a9732eB3fb1bb4b70a580ADAD4FE3",
157
+ "decimals": 18,
158
+ "feed": "0xF6f373a037c30F0e5010d854385cA89185AE638b",
159
+ "feedDecimals": 8,
160
+ "heartbeat": 86400,
161
+ "marketHours": "us_equities_24/5",
162
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0x2e0847e8910a9732eb3fb1bb4b70a580adad4fe3.png",
163
+ "isin": "US02079K3059"
164
+ },
165
+ {
166
+ "symbol": "INTC",
167
+ "name": "Intel",
168
+ "token": "0xc72b96e0E48ecd4DC75E1e45396e26300BC39681",
169
+ "decimals": 18,
170
+ "feed": "0x3f390C5C24628Ac7C489515402235FeAD71D1913",
171
+ "feedDecimals": 8,
172
+ "heartbeat": 86400,
173
+ "marketHours": "us_equities_24/5",
174
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0xc72b96e0e48ecd4dc75e1e45396e26300bc39681.png",
175
+ "isin": "US4581401001"
176
+ },
177
+ {
178
+ "symbol": "IONQ",
179
+ "name": "IonQ",
180
+ "token": "0x558378E000D634A36593E338eBacdd6207640EfE",
181
+ "decimals": 18,
182
+ "feed": "0x22EfeC4919baf55F360E0EDee4AbEB26DE4971eb",
183
+ "feedDecimals": 8,
184
+ "heartbeat": 86400,
185
+ "marketHours": "us_equities_24/5",
186
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0x558378e000d634a36593e338ebacdd6207640efe.png",
187
+ "isin": "US46222L1089"
188
+ },
189
+ {
190
+ "symbol": "META",
191
+ "name": "Meta Platforms",
192
+ "token": "0xc0D6457C16Cc70d6790Dd43521C899C87ce02f35",
193
+ "decimals": 18,
194
+ "feed": "0x7C38C00C30BEe9378381E7B6135d7283356D71b1",
195
+ "feedDecimals": 8,
196
+ "heartbeat": 86400,
197
+ "marketHours": "us_equities_24/5",
198
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0xc0d6457c16cc70d6790dd43521c899c87ce02f35.png",
199
+ "isin": "US30303M1027"
200
+ },
201
+ {
202
+ "symbol": "MSFT",
203
+ "name": "Microsoft",
204
+ "token": "0xe93237C50D904957Cf27E7B1133b510C669c2e74",
205
+ "decimals": 18,
206
+ "feed": "0x45C3C877C15E6BA2EBB19eA114Ea508d14C1Af2E",
207
+ "feedDecimals": 8,
208
+ "heartbeat": 86400,
209
+ "marketHours": "us_equities_24/5",
210
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0xe93237c50d904957cf27e7b1133b510c669c2e74.png",
211
+ "isin": "US5949181045"
212
+ },
213
+ {
214
+ "symbol": "MSTR",
215
+ "name": "Strategy Inc.",
216
+ "token": "0xec262a75e413fAfD0dF80480274532C79D42da09",
217
+ "decimals": 18,
218
+ "feed": "0x396118bdFB181e6240E74D243F266B061c0edc3D",
219
+ "feedDecimals": 8,
220
+ "heartbeat": 86400,
221
+ "marketHours": "us_equities_24/5",
222
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0xec262a75e413fafd0df80480274532c79d42da09.png",
223
+ "isin": "US5949724083"
224
+ },
225
+ {
226
+ "symbol": "MU",
227
+ "name": "Micron Technology",
228
+ "token": "0xfF080c8ce2E5feadaCa0Da81314Ae59D232d4afD",
229
+ "decimals": 18,
230
+ "feed": "0x425EEFdCf05ed6526C3cE61Af99429A228a6d596",
231
+ "feedDecimals": 8,
232
+ "heartbeat": 86400,
233
+ "marketHours": "us_equities_24/5",
234
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0xff080c8ce2e5feadaca0da81314ae59d232d4afd.png",
235
+ "isin": "US5951121038"
236
+ },
237
+ {
238
+ "symbol": "NBIS",
239
+ "name": "Nebius Group",
240
+ "token": "0x9D9c6684F596F66a64C030B93A886D51Fd4D7931",
241
+ "decimals": 18,
242
+ "feed": "0xE1D87B116Ba0fe898998f1D140339D1fA1E09705",
243
+ "feedDecimals": 8,
244
+ "heartbeat": 86400,
245
+ "marketHours": "us_equities_24/5",
246
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0x9d9c6684f596f66a64c030b93a886d51fd4d7931.png",
247
+ "isin": "NL0009805522"
248
+ },
249
+ {
250
+ "symbol": "NVDA",
251
+ "name": "NVIDIA",
252
+ "token": "0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC",
253
+ "decimals": 18,
254
+ "feed": "0x379EC4f7C378F34a1B47E4F3cbeBCbAC3E8E9F15",
255
+ "feedDecimals": 8,
256
+ "heartbeat": 86400,
257
+ "marketHours": "us_equities_24/5",
258
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec.png",
259
+ "isin": "US67066G1040"
260
+ },
261
+ {
262
+ "symbol": "ORCL",
263
+ "name": "Oracle",
264
+ "token": "0xb0992820E760d836549ba69BC7598b4af75dEE03",
265
+ "decimals": 18,
266
+ "feed": "0x0e6a64a2B58A6693a531E6c555f3A5d042eEA844",
267
+ "feedDecimals": 8,
268
+ "heartbeat": 86400,
269
+ "marketHours": "us_equities_24/5",
270
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0xb0992820e760d836549ba69bc7598b4af75dee03.png",
271
+ "isin": "US68389X1054"
272
+ },
273
+ {
274
+ "symbol": "PLTR",
275
+ "name": "Palantir Technologies",
276
+ "token": "0x894E1EC2D74FFE5AEF8Dc8A9e84686acCB964F2A",
277
+ "decimals": 18,
278
+ "feed": "0x820ABedFF239034956B7A9d2F0a331f9F075eB4c",
279
+ "feedDecimals": 8,
280
+ "heartbeat": 86400,
281
+ "marketHours": "us_equities_24/5",
282
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0x894e1ec2d74ffe5aef8dc8a9e84686accb964f2a.png",
283
+ "isin": "US69608A1088"
284
+ },
285
+ {
286
+ "symbol": "QQQ",
287
+ "name": "Invesco QQQ",
288
+ "token": "0xD5f3879160bc7c32ebb4dC785F8a4F505888de68",
289
+ "decimals": 18,
290
+ "feed": "0x80901d846d5D7B030F26B480776EE3b29374C2ae",
291
+ "feedDecimals": 8,
292
+ "heartbeat": 86400,
293
+ "marketHours": "us_equities_24/5",
294
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0xd5f3879160bc7c32ebb4dc785f8a4f505888de68.png",
295
+ "isin": "US46090E1038"
296
+ },
297
+ {
298
+ "symbol": "RGTI",
299
+ "name": "Rigetti Computing",
300
+ "token": "0x284358abc07F9359f19f4b5b4aC91901Be2597Ba",
301
+ "decimals": 18,
302
+ "feed": "0x2A045cF1C49c61c166C036d2f06FA2D2d984f765",
303
+ "feedDecimals": 8,
304
+ "heartbeat": 86400,
305
+ "marketHours": "us_equities_24/5",
306
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0x284358abc07f9359f19f4b5b4ac91901be2597ba.png",
307
+ "isin": "US76655K1034"
308
+ },
309
+ {
310
+ "symbol": "RKLB",
311
+ "name": "Rocket Lab Corporation",
312
+ "token": "0x3b14C39E89D60D627b42a1A4CA45b5bb45Fc12e2",
313
+ "decimals": 18,
314
+ "feed": "0x045477BF65Aef6f4F2386ad0164579e48381CC74",
315
+ "feedDecimals": 8,
316
+ "heartbeat": 86400,
317
+ "marketHours": "us_equities_24/5",
318
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0x3b14c39e89d60d627b42a1a4ca45b5bb45fc12e2.png",
319
+ "isin": "US7731211089"
320
+ },
321
+ {
322
+ "symbol": "SGOV",
323
+ "name": "iShares 0-3 Month Treasury Bond",
324
+ "token": "0x92FD66527192E3e61d4DDd13322Aa222DE86F9B5",
325
+ "decimals": 18,
326
+ "feed": "0xa0DF4ee0fFf975306345875E3548Fcc519577A11",
327
+ "feedDecimals": 8,
328
+ "heartbeat": 86400,
329
+ "marketHours": "us_equities_24/5",
330
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0x92fd66527192e3e61d4ddd13322aa222de86f9b5.png",
331
+ "isin": "US46436E7186"
332
+ },
333
+ {
334
+ "symbol": "SLV",
335
+ "name": "iShares Silver Trust",
336
+ "token": "0x411eFb0E7f985935DAec3D4C3ebaEa0d0AD7D89f",
337
+ "decimals": 18,
338
+ "feed": "0x209b73908e92Ae021826eD79609845451Ecba2ce",
339
+ "feedDecimals": 8,
340
+ "heartbeat": 86400,
341
+ "marketHours": "us_equities_24/5",
342
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0x411efb0e7f985935daec3d4c3ebaea0d0ad7d89f.png",
343
+ "isin": "US46428Q1094"
344
+ },
345
+ {
346
+ "symbol": "SNDK",
347
+ "name": "Sandisk Corporation",
348
+ "token": "0xB90A19fF0Af67f7779afF50A882A9CfF42446400",
349
+ "decimals": 18,
350
+ "feed": "0xfb133Fa4B7b385802B693a293606682Df47109A3",
351
+ "feedDecimals": 8,
352
+ "heartbeat": 86400,
353
+ "marketHours": "us_equities_24/5",
354
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0xb90a19ff0af67f7779aff50a882a9cff42446400.png",
355
+ "isin": "US80004C2008"
356
+ },
357
+ {
358
+ "symbol": "SPCX",
359
+ "name": "Space Exploration Technologies Corp. Class A Common Stock",
360
+ "token": "0x4a0E65A3EcceC6dBe60AE065F2e7bb85Fae35eEa",
361
+ "decimals": 18,
362
+ "feed": "0xB265810950ba6c5C0Ff821c9963014a56fD8Bffb",
363
+ "feedDecimals": 8,
364
+ "heartbeat": 86400,
365
+ "marketHours": "us_equities_24/5",
366
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0x4a0e65a3eccec6dbe60ae065f2e7bb85fae35eea.png",
367
+ "isin": "US84615Q1031"
368
+ },
369
+ {
370
+ "symbol": "SPY",
371
+ "name": "SPDR S&P 500 ETF Trust",
372
+ "token": "0x117cc2133c37B721F49dE2A7a74833232B3B4C0C",
373
+ "decimals": 18,
374
+ "feed": "0x319724394D3A0e3669269846abE664Cd621f9f6A",
375
+ "feedDecimals": 8,
376
+ "heartbeat": 86400,
377
+ "marketHours": "us_equities_24/5",
378
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0x117cc2133c37b721f49de2a7a74833232b3b4c0c.png",
379
+ "isin": "US78462F1030"
380
+ },
381
+ {
382
+ "symbol": "TSLA",
383
+ "name": "Tesla",
384
+ "token": "0x322F0929c4625eD5bAd873c95208D54E1c003b2d",
385
+ "decimals": 18,
386
+ "feed": "0x4A1166a659A55625345e9515b32adECea5547C38",
387
+ "feedDecimals": 8,
388
+ "heartbeat": 86400,
389
+ "marketHours": "us_equities_24/5",
390
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0x322f0929c4625ed5bad873c95208d54e1c003b2d.png",
391
+ "isin": "US88160R1014"
392
+ },
393
+ {
394
+ "symbol": "TSM",
395
+ "name": "Taiwan Semiconductor Manufacturing",
396
+ "token": "0x58FfE4a942d3885bAa22D7520691F611EF09e7AA",
397
+ "decimals": 18,
398
+ "feed": "0x874cF94aa8eC88Fd9560094dD065f2fB3E41Fc2F",
399
+ "feedDecimals": 8,
400
+ "heartbeat": 86400,
401
+ "marketHours": "us_equities_24/5",
402
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0x58ffe4a942d3885baa22d7520691f611ef09e7aa.png",
403
+ "isin": "US8740391003"
404
+ },
405
+ {
406
+ "symbol": "USAR",
407
+ "name": "USA Rare Earth",
408
+ "token": "0xd917B029C761D264c6A312BBbcDA868658eF86a6",
409
+ "decimals": 18,
410
+ "feed": "0xA994d3684e8400A6c8078226925779FdeE682DD9",
411
+ "feedDecimals": 8,
412
+ "heartbeat": 86400,
413
+ "marketHours": "us_equities_24/5",
414
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0xd917b029c761d264c6a312bbbcda868658ef86a6.png",
415
+ "isin": "US91733P1075"
416
+ },
417
+ {
418
+ "symbol": "USO",
419
+ "name": "United States Oil Fund",
420
+ "token": "0xa30FA36Db767ad9eD3f7a60fC79526fB4d56D344",
421
+ "decimals": 18,
422
+ "feed": "0x75a9c76Ef439e2C7c2E5a34Ab105EcFe3766431c",
423
+ "feedDecimals": 8,
424
+ "heartbeat": 86400,
425
+ "marketHours": "us_equities_24/5",
426
+ "logo": "https://cdn.robinhood.com/ncw_assets/logos/0xa30fa36db767ad9ed3f7a60fc79526fb4d56d344.png",
427
+ "isin": "US91232N2071"
428
+ }
429
+ ]
430
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@priors/mcp",
3
- "version": "0.1.7",
3
+ "version": "0.2.0",
4
4
  "private": false,
5
5
  "description": "MCP server for Priors on Robinhood Chain: pay x402 URLs in USDG, read balances, credit lines and scores, borrow and repay. Key from PRIORS_KEY only.",
6
6
  "type": "module",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@modelcontextprotocol/sdk": "^1.30.1",
45
- "@priors/x402": "0.1.3",
45
+ "@priors/x402": "0.2.0",
46
46
  "ethers": "^6.13.4",
47
47
  "undici": "6.29.0",
48
48
  "zod": "^4.6.5"
package/src/server.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  // @priors/mcp: an MCP server that lets an AI assistant pay x402 URLs in USDG on Robinhood Chain and run a Priors
2
- // credit line. Tools: pay_url, wallet_balance, credit_status, borrow, repay, score_of, find_services.
2
+ // credit line. Tools: pay_url, wallet_balance, credit_status, stock_assets, stock_position, borrow, repay, score_of,
3
+ // find_services.
3
4
  //
4
5
  // The private key comes from the environment (PRIORS_KEY) only. It is never read from argv, never logged, and never
5
6
  // part of any tool result or error: every text this server returns passes through `redact()`, which removes the key
@@ -16,6 +17,7 @@
16
17
  // PRIORS_MAX_BORROW_TOTAL_USD most borrowed in total per process (default 25)
17
18
  // PRIORS_ALLOW_LOCAL "1": pay_url may reach http://localhost and private addresses (testing only)
18
19
  // PRIORS_SCORE_V2 where score_of reads Priors Score v2 (default https://priors.trade/api/score-v2; "off": v1 only)
20
+ // PRIORS_STOCK_VAULT the stock vault's address (default: deployments/4663.v2.json `stockVault`, once deployed)
19
21
  import { readFileSync } from "node:fs";
20
22
  import { randomBytes } from "node:crypto";
21
23
  import { lookup as dnsLookup } from "node:dns/promises";
@@ -39,6 +41,8 @@ const { X, C } = await loadX402();
39
41
 
40
42
  export const VERSION = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
41
43
  const ADDRESSES = JSON.parse(readFileSync(new URL("../deployments/4663.v2.json", import.meta.url), "utf8"));
44
+ /** The stock tokens the stock vault accepts (a copy of the repository's deployments/stock-assets.4663.json). */
45
+ const STOCK_ASSETS = JSON.parse(readFileSync(new URL("../deployments/stock-assets.4663.json", import.meta.url), "utf8")).assets;
42
46
  const DEFAULT_PAY_MAX_USD = 0.1;
43
47
 
44
48
  /** A private key (64 hex, optional 0x) anywhere in a string: refused on the command line. */
@@ -105,6 +109,14 @@ export function guardedFetch(resolve = dnsLookupCb) {
105
109
 
106
110
  const usd = (units) => `${X.formatUsdg(units)} USDG`;
107
111
  const when = (t) => new Date(Number(t) * 1000).toISOString().replace(".000Z", "Z");
112
+ /** A token amount (bigint base units) with `decimals` places, trailing zeros trimmed. */
113
+ const tokens = (units, decimals) => (Number.isInteger(decimals) ? ethers.formatUnits(units, decimals).replace(/\.0$/, "") : String(units));
114
+ /** One line for the stock collateral behind a line (creditStatus.collateral, or a stockPosition). */
115
+ export function collateralText(c, symbol = c.symbol, decimals = c.decimals) {
116
+ const what = symbol ? `${tokens(c.amount, decimals)} ${symbol}` : `${c.amount} base units of ${c.token}`;
117
+ return `Backed by ${what}${c.value !== null ? ` worth ${usd(c.value)} to the vault` : " (not priced for new loans right now)"}, at ${Number(c.ltvBps) / 100}% loan-to-value: ${usd(c.borrowRoom)} can be drawn now.`
118
+ + (c.hold ? ` New loans wait: ${c.holdReason || "a lending hold"}.` : "") + (c.closing ? " Closing: no new loans." : "");
119
+ }
108
120
  const short = (s, n) => (s.length > n ? `${s.slice(0, n)}… (${s.length - n} more characters cut)` : s);
109
121
  const clean = (s, n) => short(String(s ?? "").replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g, ""), n);
110
122
 
@@ -188,7 +200,7 @@ export async function createPriorsMcpServer({ env = process.env, fetchImpl = glo
188
200
  for (const n of ["PAYMENT-RESPONSE", "X-PAYMENT-RESPONSE"]) { const h = res.headers.get(n); if (h) { try { return JSON.parse(Buffer.from(h, "base64").toString("utf8")); } catch (_) { /* not ours to read */ } } }
189
201
  return undefined;
190
202
  };
191
- const addresses = { ...ADDRESSES, ...(deps.addresses || {}) };
203
+ const addresses = { ...ADDRESSES, ...(env.PRIORS_STOCK_VAULT ? { stockVault: env.PRIORS_STOCK_VAULT } : {}), ...(deps.addresses || {}) };
192
204
 
193
205
  // Everything returned passes through here: the key (with or without 0x, any case) and a private RPC URL are cut.
194
206
  const secrets = [];
@@ -196,14 +208,18 @@ export async function createPriorsMcpServer({ env = process.env, fetchImpl = glo
196
208
  if (env.PRIORS_RPC && env.PRIORS_RPC !== X.robinhood.rpcUrl) secrets.push(new RegExp(env.PRIORS_RPC.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g"));
197
209
  const redact = (s) => secrets.reduce((acc, re) => acc.replace(re, (m) => (m.startsWith("http") ? "<rpc>" : "<redacted>")), String(s));
198
210
 
199
- const provider = deps.provider || new ethers.JsonRpcProvider(rpc, ethers.Network.from(X.robinhood.chainId), { staticNetwork: true, cacheTimeout: -1 });
211
+ // One call per request: ethers batches parallel reads up to 100 calls, and the public node (the default PRIORS_RPC)
212
+ // answers a batch that size with HTTP 429, which ethers retries until its 5-minute timeout (stock_assets' ~140 reads).
213
+ const provider = deps.provider || new ethers.JsonRpcProvider(rpc, ethers.Network.from(X.robinhood.chainId), { staticNetwork: true, cacheTimeout: -1, batchMaxCount: 1 });
200
214
  const wallet = key ? new ethers.Wallet(key, provider) : null;
201
- const contracts = C.creditContracts({ runner: provider, addresses: { pool: addresses.pool, lens: addresses.lens, usdg: addresses.usdg, registry: addresses.registry } });
215
+ const contracts = C.creditContracts({ runner: provider, addresses: { pool: addresses.pool, lens: addresses.lens, usdg: addresses.usdg, registry: addresses.registry, stockVault: addresses.stockVault || null } });
202
216
 
203
217
  // The chain, behind one facade (tests replace it).
204
218
  const credit = deps.credit || {
205
219
  balances: (addr) => C.balances(contracts, provider, addr),
206
220
  status: (id) => C.creditStatus(contracts, id),
221
+ stockAssets: () => C.stockAssets(contracts, STOCK_ASSETS),
222
+ stockPosition: (id) => C.stockPosition(contracts, id, STOCK_ASSETS),
207
223
  quote: (id, amount, term) => C.quoteBorrow(contracts, id, amount, term),
208
224
  borrow: (id, amount, term) => C.borrowLine(contracts, wallet, id, amount, term),
209
225
  repay: (loanId) => C.repayLoan(contracts, wallet, loanId),
@@ -244,7 +260,7 @@ export async function createPriorsMcpServer({ env = process.env, fetchImpl = glo
244
260
 
245
261
  function needWallet(action) {
246
262
  if (keyProblem) throw new ToolError(`${action} needs a wallet, but ${keyProblem}. Fix PRIORS_KEY in the MCP server's environment.`);
247
- if (!wallet) throw new ToolError(`${action} moves money and needs a wallet: set 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 with an address, credit_status, score_of, find_services) work without it.`);
263
+ if (!wallet) throw new ToolError(`${action} moves money and needs a wallet: set 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 with an address, credit_status, stock_assets, stock_position, score_of, find_services) work without it.`);
248
264
  return wallet;
249
265
  }
250
266
  async function needController(id) {
@@ -369,6 +385,7 @@ export async function createPriorsMcpServer({ env = process.env, fetchImpl = glo
369
385
  `Agent #${id}${s.owner ? ` (owner ${s.owner})` : ""}${s.defaulted ? " — DEFAULTED" : ""}${s.frozen ? " — frozen" : ""}${s.isRoot ? " — a backer (root)" : ""}`,
370
386
  s.sponsor === 0n ? "Backed by: nobody yet, so no line." : `Backed by: root #${s.sponsor}${s.premiumBps > 0n ? `, premium ${Number(s.premiumBps) / 100}%` : ""}.`,
371
387
  `Line ${usd(s.line)}: drawn ${usd(s.drawn)}, available ${usd(s.available)}.`,
388
+ ...(s.collateral ? [collateralText(s.collateral)] : []),
372
389
  `Record: ${s.loansRepaid} loans repaid (${s.qualifiedRepaid} qualified), ${usd(s.volumeRepaid)} repaid in total, ${usd(s.feesPaid)} in fees.${s.score !== null ? ` Score ${s.score}/1000.` : ""}`,
373
390
  ];
374
391
  if (s.openLoans.length === 0) lines.push("Open loans: none.");
@@ -376,6 +393,33 @@ export async function createPriorsMcpServer({ env = process.env, fetchImpl = glo
376
393
  return lines.join("\n");
377
394
  });
378
395
 
396
+ // ---- stock_assets / stock_position -----------------------------------------------------------------------------
397
+ tool("stock_assets", {
398
+ title: "Stock tokens Priors lends against",
399
+ description: "List the Robinhood stock tokens the Priors stock vault accepts as collateral on Robinhood Chain: each token's live Chainlink price, whether the vault lends against it right now (and if not, why: a sharp price move, a multiplier change such as a split, a paused or blocked token), and its loan-to-value. Read-only.",
400
+ inputSchema: { symbol: z.string().max(12).optional().describe("One ticker, e.g. SPY. Omit for all.") },
401
+ annotations: { readOnlyHint: true, openWorldHint: true },
402
+ }, async ({ symbol }) => {
403
+ const want = symbol ? String(symbol).trim().toUpperCase() : null;
404
+ const all = await credit.stockAssets();
405
+ const list = all.filter((a) => !want || a.symbol.toUpperCase() === want);
406
+ if (want && list.length === 0) throw new ToolError(`${oneLine(symbol, 12)} is not among the ${all.length} stock tokens the vault accepts.`);
407
+ const rows = list.map((a) => `- ${a.symbol} (${a.name}): ${a.price === null ? "no price" : `$${a.price.toFixed(2)}`}${a.updatedAt ? ` as of ${when(a.updatedAt)}` : ""}; ${a.usable ? `lends at ${Number(a.ltvBps) / 100}% of value` : `no new loans (${a.holdReason || "price not usable now"})`}`);
408
+ return `The Priors stock vault accepts ${all.length} stock tokens; ${list.filter((a) => a.usable).length} of those shown take new lines now:\n${rows.join("\n")}`;
409
+ });
410
+
411
+ tool("stock_position", {
412
+ title: "Stock collateral behind an agent's line",
413
+ description: "Show the stock tokens behind a Priors agent's stock line on Robinhood Chain: the token and amount the vault holds, what the vault values them at, the loan-to-value, what the line can draw now, whether new loans wait on a lending hold, and whether the line is closing. agent_id defaults to the configured wallet's agent. Read-only.",
414
+ inputSchema: { agent_id: z.number().int().nonnegative().optional().describe("Priors (ERC-8004) agent id; default: the configured wallet's agent.") },
415
+ annotations: { readOnlyHint: true, openWorldHint: true },
416
+ }, async ({ agent_id }) => {
417
+ const id = await resolveAgent(agent_id);
418
+ const p = await credit.stockPosition(id);
419
+ if (!p) return `Agent #${id} has no stock position: its line (if any) is not backed by stock tokens.`;
420
+ return [`Agent #${id}: stock line of ${usd(p.line)}, ${p.status}.`, collateralText(p)].join("\n");
421
+ });
422
+
379
423
  // ---- score_of ------------------------------------------------------------------------------------------------
380
424
  // Priors Score v2 (open weights, published at /api/score-v2) next to the on-chain v1: optional. Not published
381
425
  // (404/503), slow or unreachable means v1 only, never a tool error; a defaulted agent never shows a positive v2.
@@ -388,8 +432,8 @@ export async function createPriorsMcpServer({ env = process.env, fetchImpl = glo
388
432
  u.searchParams.set("agent", String(id));
389
433
  const r = await fetchImpl(u.href, { headers: { accept: "application/json" }, signal: AbortSignal.timeout(5_000) });
390
434
  if (!r.ok) return null;
391
- const t = await r.text();
392
- if (t.length > 65_536) return null;
435
+ const { text: t, cut } = await X.readCapped(r, 65_536); // streamed: a huge body is cancelled, not buffered
436
+ if (cut) return null;
393
437
  const s = JSON.parse(t)?.score;
394
438
  const num = (x) => (x !== null && x !== "" && Number.isFinite(Number(x)) ? Number(x) : null);
395
439
  if (!s || Number(s.agentId) !== Number(id) || num(s.score) === null || num(s.rung) === null) return null;