@priors/mcp 0.6.3 → 0.6.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/README.md +3 -3
- package/package.json +1 -1
- package/src/server.mjs +15 -3
package/README.md
CHANGED
|
@@ -135,7 +135,7 @@ Settings → Developer → Edit Config (`claude_desktop_config.json`), then rest
|
|
|
135
135
|
"mcpServers": {
|
|
136
136
|
"priors": {
|
|
137
137
|
"command": "npx",
|
|
138
|
-
"args": ["-y", "@priors/mcp@0.6.
|
|
138
|
+
"args": ["-y", "@priors/mcp@0.6.4"],
|
|
139
139
|
"env": {
|
|
140
140
|
"PRIORS_KEY": "0xYOUR_AGENT_WALLET_KEY",
|
|
141
141
|
"PRIORS_AGENT_ID": "1234"
|
|
@@ -157,7 +157,7 @@ A project `.mcp.json` that reads the key from your shell's environment, so the f
|
|
|
157
157
|
"mcpServers": {
|
|
158
158
|
"priors": {
|
|
159
159
|
"command": "npx",
|
|
160
|
-
"args": ["-y", "@priors/mcp@0.6.
|
|
160
|
+
"args": ["-y", "@priors/mcp@0.6.4"],
|
|
161
161
|
"env": {
|
|
162
162
|
"PRIORS_KEY": "${PRIORS_KEY}",
|
|
163
163
|
"PRIORS_AGENT_ID": "${PRIORS_AGENT_ID:-}"
|
|
@@ -167,7 +167,7 @@ A project `.mcp.json` that reads the key from your shell's environment, so the f
|
|
|
167
167
|
}
|
|
168
168
|
```
|
|
169
169
|
|
|
170
|
-
or, for your user only: `claude mcp add priors --scope user -e PRIORS_KEY="$PRIORS_KEY" -- npx -y @priors/mcp@0.6.
|
|
170
|
+
or, for your user only: `claude mcp add priors --scope user -e PRIORS_KEY="$PRIORS_KEY" -- npx -y @priors/mcp@0.6.4`
|
|
171
171
|
(the key is expanded by your shell from the environment; do not paste it on the command line).
|
|
172
172
|
|
|
173
173
|
## Try it
|
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.6.
|
|
4
|
+
"version": "0.6.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 only.",
|
|
7
7
|
"type": "module",
|
package/src/server.mjs
CHANGED
|
@@ -1112,14 +1112,26 @@ export async function createPriorsMcpServer({ env = process.env, fetchImpl = glo
|
|
|
1112
1112
|
try { b = await pt.trade(kind, o); } catch (e) { throw asked(e); }
|
|
1113
1113
|
return [termsLine(b.quote), `Nothing was sent. From ${b.account}, ${b.calls.length} call${b.calls.length > 1 ? "s" : ""} in order:`, callsText(b), minLine(b), ...b.warnings.map((w) => `Note: ${w}.`)].join("\n");
|
|
1114
1114
|
}
|
|
1115
|
-
// what left the wallet is counted even when the answer is lost: a send that started may have landed
|
|
1115
|
+
// what left the wallet is counted even when the answer is lost: a send that started may have landed. A send that
|
|
1116
|
+
// failed is `lost` unless it was refused before it left (a reverting estimate, no ETH for gas), as for a borrow
|
|
1117
|
+
// (GHSA-v9xj): the node may have taken it and its answer been lost, so it stays counted and is said (GHSA-549m: it
|
|
1118
|
+
// was given back as "nothing sent" and answered with the bare transport error)
|
|
1116
1119
|
const sent = [];
|
|
1117
|
-
|
|
1120
|
+
let lost = false;
|
|
1121
|
+
const counting = { getAddress: async () => signer.address, sendTransaction: async (tx) => {
|
|
1122
|
+
let r;
|
|
1123
|
+
try { r = await signer.sendTransaction(tx); } catch (e) { lost = e?.code !== "CALL_EXCEPTION" && e?.code !== "INSUFFICIENT_FUNDS"; throw e; }
|
|
1124
|
+
sent.push(r.hash);
|
|
1125
|
+
return r;
|
|
1126
|
+
} };
|
|
1118
1127
|
if (units !== null) session.ptBought += units;
|
|
1119
1128
|
let r;
|
|
1120
1129
|
try { r = await pt.trade(kind, { ...o, wallet: counting }); } catch (e) {
|
|
1130
|
+
const why = clean(e?.shortMessage || e?.message || String(e), 300);
|
|
1131
|
+
const was = `${sent.length} transaction${sent.length > 1 ? "s were" : " was"} sent (${sent.join(", ")})`;
|
|
1132
|
+
if (lost) throw new ToolError(`${sent.length ? `${was}, then another` : "A transaction"} may have been sent: its answer was lost (${why}).${units !== null ? ` Its ${usd(units)} stays counted against PRIORS_MAX_PT_TOTAL_USD.` : ""} Check pt_position and wallet_balance before trying again.`);
|
|
1121
1133
|
if (sent.length === 0 && units !== null) session.ptBought -= units;
|
|
1122
|
-
if (sent.length) throw new ToolError(`${
|
|
1134
|
+
if (sent.length) throw new ToolError(`${was}, then: ${why}. Check pt_position and wallet_balance before trying again.`);
|
|
1123
1135
|
throw asked(e);
|
|
1124
1136
|
}
|
|
1125
1137
|
const done = kind === "buy" ? `Bought about ${nf(r.quote.expectedOutText)} PT-USDG (at least ${nf(r.quote.minOutText)}) with ${usd(units)}`
|