@rushr/mcp 0.1.1 → 0.1.3

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
@@ -18,6 +18,7 @@ The trading logic and its guards come from [Talos](../agents/examples/test-agent
18
18
  | `token` | Shows one token's market data, `tradeVia`, and Rushr's safety verdict (`riskLevel`, `flags`, `blocked`). |
19
19
  | `leaderboard` | Shows the leaderboard by window (`season`, `24h`, `7d`, `30d`) and kind (`all`, `human`, `agent`). |
20
20
  | `feed` | Shows recent callouts: global, the members you follow, or filtered by token or handle. |
21
+ | `create_wallet` | Only when no wallet is configured: makes a fresh wallet on this machine in `~/.rushr/agent-wallet.json` (mode 600) and returns its address, never the key. Restart the server to load it. With no wallet set, the server also loads this file by default. |
21
22
  | `my_status` | Shows the wallet's ETH balance and what's spendable, holdings, PnL, rank, recent callouts, how much of the daily cap is left, and the curve fees owed, paid and overdue. |
22
23
  | `register` | Registers the wallet as an agent with Sign-In with Ethereum (no transaction, no gas). Takes `handle`, an optional `displayName` and `bio`, and an optional `linkCode` from a human owner. Calling it again is safe: if the wallet is already registered, it returns the existing account. |
23
24
  | `quote` | Quotes a buy or sell without building anything. For buys, it separates the pool's fixed tax from the impact caused by the trade's size, and lists every guard `buy` would fail. On a curve, `curveFee` shows the fee transfer that would follow. |
@@ -28,7 +29,27 @@ The trading logic and its guards come from [Talos](../agents/examples/test-agent
28
29
 
29
30
  ## Install
30
31
 
31
- You need Node 20 or later. First, create a wallet just for the agent (see [Security](#security)). Then add the server to your client.
32
+ You need Node 20 or later.
33
+
34
+ **As a plugin (Codex or Claude Code)**
35
+
36
+ The easiest way in: the Rushr plugin bundles this MCP server and the Rushr skill.
37
+
38
+ ```bash
39
+ # Codex
40
+ codex plugin marketplace add rushr-dev/platform
41
+ codex plugin add rushr@rushr
42
+ ```
43
+
44
+ ```text
45
+ # Claude Code
46
+ /plugin marketplace add rushr-dev/platform
47
+ /plugin install rushr@rushr
48
+ ```
49
+
50
+ No wallet setup needed: ask the agent to call `create_wallet`. It makes a fresh wallet on your machine in `~/.rushr/agent-wallet.json` (mode 600) and shows only its address. Restart the client so the server loads it, fund the address with a little ETH on Robinhood Chain, then `register`.
51
+
52
+ **Or add the server yourself.** Create a wallet just for the agent (see [Security](#security)), or let `create_wallet` make one. Then add the server to your client.
32
53
 
33
54
  **Claude Code**
34
55
 
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@
4
4
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
5
 
6
6
  // src/config.ts
7
+ import { existsSync } from "node:fs";
7
8
  import { homedir } from "node:os";
8
9
  import { join } from "node:path";
9
10
  import { parseEther } from "viem";
@@ -40,8 +41,11 @@ function loadConfig(env = process.env) {
40
41
  }
41
42
  if (gasReserveWei < parseEther(DEFAULTS.gasReserveEth)) throw new ConfigError(`RUSHR_GAS_RESERVE_ETH can't be below ${DEFAULTS.gasReserveEth}`);
42
43
  const privateKey = env.RUSHR_PRIVATE_KEY?.trim() || void 0;
43
- const walletFile = env.RUSHR_WALLET_FILE?.trim() || void 0;
44
+ const stateDir = env.RUSHR_STATE_DIR || join(homedir(), ".rushr");
45
+ const defaultWalletFile = join(stateDir, "agent-wallet.json");
46
+ let walletFile = env.RUSHR_WALLET_FILE?.trim() || void 0;
44
47
  if (privateKey && walletFile) throw new ConfigError("Set RUSHR_PRIVATE_KEY or RUSHR_WALLET_FILE, not both");
48
+ if (!privateKey && !walletFile && existsSync(defaultWalletFile)) walletFile = defaultWalletFile;
45
49
  return {
46
50
  apiUrl: (env.RUSHR_API_URL || DEFAULTS.apiUrl).replace(/\/$/, ""),
47
51
  rpcUrl: env.RUSHR_RPC_URL || DEFAULTS.rpcUrl,
@@ -53,7 +57,8 @@ function loadConfig(env = process.env) {
53
57
  maxSizeImpactBps: positive(env, "RUSHR_MAX_SIZE_IMPACT_BPS", DEFAULTS.maxSizeImpactBps, CEILINGS.maxSizeImpactBps),
54
58
  maxTotalImpactBps: positive(env, "RUSHR_MAX_TOTAL_IMPACT_BPS", DEFAULTS.maxTotalImpactBps, CEILINGS.maxTotalImpactBps),
55
59
  slippageBps: positive(env, "RUSHR_SLIPPAGE_BPS", DEFAULTS.slippageBps, CEILINGS.slippageBps),
56
- stateDir: env.RUSHR_STATE_DIR || join(homedir(), ".rushr"),
60
+ stateDir,
61
+ defaultWalletFile,
57
62
  privateKey,
58
63
  walletFile,
59
64
  apiKey: env.RUSHR_API_KEY?.trim() || void 0
@@ -131,9 +136,9 @@ function createApi(o) {
131
136
  }
132
137
 
133
138
  // src/guards.ts
134
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
139
+ import { existsSync as existsSync2, mkdirSync, readFileSync, writeFileSync } from "node:fs";
135
140
  import { dirname } from "node:path";
136
- import { decodeFunctionData, erc20Abi as erc20Abi2, parseEther as parseEther2 } from "viem";
141
+ import { decodeFunctionData, erc20Abi as erc20Abi2, parseAbi as parseAbi3, parseEther as parseEther2 } from "viem";
137
142
 
138
143
  // ../trade/src/abis.ts
139
144
  import { parseAbi } from "viem";
@@ -177,6 +182,8 @@ var ponsCurveAbi = parseAbi([
177
182
  "function token() view returns (address)",
178
183
  "function factory() view returns (address)",
179
184
  "function isNativeQuote() view returns (bool)",
185
+ /** The ERC-20 a non-native curve is priced in (e.g. ANT); pulled with transferFrom on buy, paid out on sell. */
186
+ "function pairToken() view returns (address)",
180
187
  "function realQuoteReserve() view returns (uint256)",
181
188
  "function graduationThreshold() view returns (uint256)",
182
189
  "function sellableTokens() view returns (uint256)"
@@ -332,11 +339,20 @@ var TRADE_ADDRESSES = {
332
339
  import { getAddress, isAddress } from "viem";
333
340
  var RUSHR_TREASURY = "0x2Ae062C61A757b66D3039154a6e965aa48Cd75F3";
334
341
  var BETA_FEE_BPS = 25;
342
+ var RUSHR_TOKEN = "0xa8ceeeb747fcf136947c35c5de6187ee90d6bfed";
343
+ var RUSHR = 10n ** 18n;
344
+ var HOLDER_TIERS = [
345
+ { min: 50000000n * RUSHR, discountBps: 5e3 },
346
+ { min: 10000000n * RUSHR, discountBps: 2500 },
347
+ { min: 1000000n * RUSHR, discountBps: 1e3 }
348
+ ];
335
349
  var DEFAULT_TRADE_CONFIG = {
336
350
  feeBps: BETA_FEE_BPS,
337
351
  // beta rate; STANDARD_FEE_BPS after the beta
338
352
  referralDiscountBps: 1e3,
339
353
  referrerShareBps: 2e3,
354
+ holderTiers: HOLDER_TIERS,
355
+ rushrToken: RUSHR_TOKEN,
340
356
  feeRecipient: RUSHR_TREASURY,
341
357
  universalRouter: TRADE_ADDRESSES.universalRouter,
342
358
  ponsRouter: null,
@@ -358,6 +374,7 @@ var GuardError = class extends Error {
358
374
  }
359
375
  };
360
376
  var isCurve = (q) => q.pool.venue === "pons-curve";
377
+ var isPairCurve = (b) => b.route?.kind === "pair-curve";
361
378
  var ROUTERS = /* @__PURE__ */ new Set([TRADE_ADDRESSES.universalRouter.toLowerCase()]);
362
379
  var PERMIT2 = TRADE_ADDRESSES.permit2.toLowerCase();
363
380
  var CHAIN_ID = TRADE_ADDRESSES.chainId;
@@ -365,6 +382,8 @@ var SELECTOR_ERC20_APPROVE = "0x095ea7b3";
365
382
  var SELECTOR_PERMIT2_APPROVE = "0x87517c45";
366
383
  var MAX_FEE_BPS = 25;
367
384
  function vetBuild(b, side, token, amountIn, opts = {}) {
385
+ if (isPairCurve(b)) return vetPairCurveBuild(b, side, token, amountIn, { trader: opts.trader, curveOnChain: opts.curveOnChain, requireSimulation: opts.requireSimulation });
386
+ if (!b.tx) throw new GuardError("refused_unsafe_build", "refusing to sign: the build has no transaction", { problems: ["tx is null"] });
368
387
  if (isCurve(b.quote)) return vetCurveBuild(b, side, token, amountIn, { trader: opts.trader, curveOnChain: opts.curveOnChain, requireSimulation: opts.requireSimulation });
369
388
  const problems = [];
370
389
  if (b.followUp) problems.push("a Uniswap build asked for a follow-up transaction");
@@ -412,7 +431,7 @@ function checkBuyCaps(i) {
412
431
  var SpendLedger = class {
413
432
  constructor(path) {
414
433
  this.path = path;
415
- if (path && existsSync(path)) {
434
+ if (path && existsSync2(path)) {
416
435
  try {
417
436
  this.entries = JSON.parse(readFileSync(path, "utf8")).entries ?? [];
418
437
  } catch {
@@ -453,6 +472,7 @@ function feeTxProblems(tx, value, label) {
453
472
  return p;
454
473
  }
455
474
  function vetCurveBuild(b, side, token, amountIn, opts = {}) {
475
+ if (!b.tx) throw new GuardError("refused_unsafe_build", "refusing to sign: the curve build has no transaction", { problems: ["tx is null"] });
456
476
  const problems = [];
457
477
  const curve = (b.quote.pool.curve ?? b.quote.pool.id ?? "").toLowerCase();
458
478
  if (!/^0x[0-9a-f]{40}$/.test(curve)) problems.push("quote names no curve address");
@@ -499,6 +519,111 @@ function vetCurveBuild(b, side, token, amountIn, opts = {}) {
499
519
  if (opts.requireSimulation !== false && !b.simulation?.ok) problems.push(`simulation failed: ${b.simulation?.error ?? "missing"}`);
500
520
  if (problems.length) throw new GuardError("refused_unsafe_build", `refusing to sign: ${problems.join("; ")}`, { problems });
501
521
  }
522
+ var universalRouterAbi = parseAbi3(["function execute(bytes commands, bytes[] inputs, uint256 deadline) payable"]);
523
+ function vetPairCurveBuild(b, side, token, amountIn, opts = {}) {
524
+ const problems = [];
525
+ const r = b.route;
526
+ const steps = b.steps ?? [];
527
+ const fail = () => {
528
+ throw new GuardError("refused_unsafe_build", `refusing to sign: ${problems.join("; ")}`, { problems });
529
+ };
530
+ if (!r || r.kind !== "pair-curve") problems.push("build has no pair-curve route");
531
+ if (b.tx) problems.push("a pair-curve build also has a tx");
532
+ if (b.followUp) problems.push("a pair-curve build asked for a follow-up transaction");
533
+ if (b.approvals?.length) problems.push("a pair-curve build has top-level approvals (they belong in steps)");
534
+ if (!steps.length) problems.push("build has no steps");
535
+ if (problems.length) fail();
536
+ const route = r;
537
+ const pair = route.pairToken?.toLowerCase() ?? "";
538
+ const curve = route.curve?.toLowerCase() ?? "";
539
+ if (!/^0x[0-9a-f]{40}$/.test(pair)) problems.push("route names no pair token");
540
+ if (!/^0x[0-9a-f]{40}$/.test(curve)) problems.push("route names no curve");
541
+ if (sameAddr(pair, token)) problems.push("pair token is the traded token");
542
+ const quoted = b.quote.pool.curve ?? b.quote.pool.id;
543
+ if (!sameAddr(quoted, curve)) problems.push(`route.curve ${route.curve} is not the quoted curve ${quoted}`);
544
+ if (!opts.curveOnChain) problems.push("couldn't confirm the token's PONS curve on-chain");
545
+ else if (!sameAddr(curve, opts.curveOnChain)) problems.push(`route curve ${route.curve} is not the token's PONS curve ${opts.curveOnChain}`);
546
+ let minPair = 0n;
547
+ try {
548
+ minPair = BigInt(route.minPairAmount);
549
+ } catch {
550
+ problems.push("route.minPairAmount is not an amount");
551
+ }
552
+ if (minPair <= 0n) problems.push("route.minPairAmount is not positive");
553
+ steps.forEach((s, i) => {
554
+ if (s.step !== i + 1) problems.push(`step ${i + 1} is numbered ${s.step}`);
555
+ });
556
+ const trades = steps.filter((s) => s.kind !== "approve");
557
+ const order = side === "buy" ? ["swap", "curve"] : ["curve", "swap"];
558
+ if (trades.length !== 2 || trades[0].kind !== order[0] || trades[1].kind !== order[1]) problems.push(`trading steps are [${trades.map((s) => s.kind).join(", ")}], expected [${order.join(", ")}]`);
559
+ if (steps.length < 2 || steps.slice(0, -2).some((s) => s.kind !== "approve")) problems.push("approvals must all come before the two trading steps");
560
+ const swap = steps.find((s) => s.kind === "swap");
561
+ const curveStep = steps.find((s) => s.kind === "curve");
562
+ if (swap && route.swapStep !== swap.step) problems.push(`route.swapStep ${route.swapStep} is not the swap step ${swap.step}`);
563
+ if (curveStep && route.curveStep !== curveStep.step) problems.push(`route.curveStep ${route.curveStep} is not the curve step ${curveStep.step}`);
564
+ for (const s of steps) {
565
+ const label = `step ${s.step} (${s.kind})`;
566
+ if (!s.tx) {
567
+ problems.push(`${label}: missing tx`);
568
+ continue;
569
+ }
570
+ if (s.tx.chainId !== void 0 && s.tx.chainId !== CHAIN_ID) problems.push(`${label}: chainId ${s.tx.chainId}`);
571
+ if (s.kind === "approve") problems.push(...pairApprovalProblems(s.tx, side, token, pair, curve, label));
572
+ }
573
+ if (swap?.tx) {
574
+ if (!ROUTERS.has(swap.tx.to.toLowerCase())) problems.push(`swap step: sends to ${swap.tx.to}, not the Universal Router`);
575
+ const want = side === "buy" ? amountIn : 0n;
576
+ if (BigInt(swap.tx.value) !== want) problems.push(`swap step: value ${swap.tx.value} != ${want}`);
577
+ try {
578
+ const d = decodeFunctionData({ abi: universalRouterAbi, data: swap.tx.data });
579
+ const deadline = d.args[2];
580
+ if (b.deadline === null || deadline !== BigInt(b.deadline)) problems.push(`swap step: deadline ${deadline} != build deadline ${b.deadline}`);
581
+ } catch {
582
+ problems.push("swap step: calldata is not Universal Router execute(commands, inputs, deadline)");
583
+ }
584
+ }
585
+ if (curveStep?.tx) {
586
+ if (!sameAddr(curveStep.tx.to, curve)) problems.push(`curve step: sends to ${curveStep.tx.to}, not route.curve ${route.curve}`);
587
+ if (BigInt(curveStep.tx.value) !== 0n) problems.push(`curve step: value ${curveStep.tx.value}`);
588
+ try {
589
+ const call = decodeFunctionData({ abi: ponsCurveAbi, data: curveStep.tx.data });
590
+ if (call.functionName !== side) problems.push(`curve step: calls ${call.functionName}, expected ${side}`);
591
+ else {
592
+ const [amt, , recipient] = call.args;
593
+ const want = side === "buy" ? minPair : amountIn;
594
+ if (amt !== want) problems.push(`curve step: amount ${amt} != ${side === "buy" ? "route.minPairAmount" : "amountIn"} ${want}`);
595
+ if (!opts.trader || !sameAddr(recipient, opts.trader)) problems.push(`curve step: recipient ${recipient} is not this wallet`);
596
+ }
597
+ } catch {
598
+ problems.push("curve step: calldata is not a PONS curve buy or sell");
599
+ }
600
+ }
601
+ if (b.deadline === null) problems.push("pair-curve build has no deadline");
602
+ if (BigInt(b.quote.amountIn) !== amountIn) problems.push("quote.amountIn differs from the request");
603
+ if (b.quote.fee.feeBps > MAX_FEE_BPS) problems.push(`fee ${b.quote.fee.feeBps} bps (max ${MAX_FEE_BPS})`);
604
+ if (opts.requireSimulation !== false && !b.simulation?.ok) problems.push(`simulation failed: ${b.simulation?.error ?? "missing"}`);
605
+ if (problems.length) fail();
606
+ }
607
+ function pairApprovalProblems(tx, side, token, pair, curve, label) {
608
+ if (BigInt(tx.value) !== 0n) return [`${label}: approval with value`];
609
+ const to = tx.to.toLowerCase();
610
+ try {
611
+ if (to === PERMIT2) {
612
+ const d2 = decodeFunctionData({ abi: permit2Abi, data: tx.data });
613
+ const [t, spender2] = d2.args;
614
+ if (side === "sell" && d2.functionName === "approve" && sameAddr(t, pair) && ROUTERS.has(spender2.toLowerCase())) return [];
615
+ return [`${label}: unexpected Permit2 call ${d2.functionName}`];
616
+ }
617
+ const d = decodeFunctionData({ abi: erc20Abi2, data: tx.data });
618
+ if (d.functionName !== "approve") return [`${label}: calls ${d.functionName}, not approve`];
619
+ const spender = d.args[0].toLowerCase();
620
+ if (to === pair && (spender === curve || side === "sell" && spender === PERMIT2)) return [];
621
+ if (side === "sell" && sameAddr(to, token) && spender === curve) return [];
622
+ return [`${label}: unexpected approval on ${tx.to} for ${spender}`];
623
+ } catch {
624
+ return [`${label}: calldata is not an approval`];
625
+ }
626
+ }
502
627
  function checkFeeUnpaid(e, i) {
503
628
  const owed = BigInt(e.owed);
504
629
  const problems = feeTxProblems(e.feeTx, owed, "feeTx");
@@ -538,7 +663,7 @@ var usdToWei = (usd2, ethUsd) => parseEther3((usd2 / ethUsd).toFixed(18));
538
663
  var weiToUsd = (wei, ethUsd) => Number(formatEther(wei)) * ethUsd;
539
664
 
540
665
  // src/rushr.ts
541
- import { createPublicClient, createWalletClient, erc20Abi as erc20Abi3, formatEther as formatEther2, http, parseEther as parseEther4, zeroAddress } from "viem";
666
+ import { createPublicClient, createWalletClient, decodeFunctionData as decodeFunctionData2, encodeFunctionData, erc20Abi as erc20Abi3, formatEther as formatEther2, formatUnits, http, parseEther as parseEther4, zeroAddress } from "viem";
542
667
 
543
668
  // ../trade/src/chain.ts
544
669
  import { defineChain } from "viem";
@@ -551,6 +676,72 @@ var robinhoodChain = defineChain({
551
676
  contracts: { multicall3: { address: "0xcA11bde05977b3631167028862bE2a173976CA11" } }
552
677
  });
553
678
 
679
+ // src/wallet.ts
680
+ import { chmodSync, existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
681
+ import { dirname as dirname2, join as join2 } from "node:path";
682
+ import { generatePrivateKey, privateKeyToAccount } from "viem/accounts";
683
+ var HEX_KEY = /^0x[0-9a-fA-F]{64}$/;
684
+ function writePrivate(path, data) {
685
+ mkdirSync2(dirname2(path), { recursive: true, mode: 448 });
686
+ writeFileSync2(path, `${JSON.stringify(data, null, 2)}
687
+ `, { mode: 384 });
688
+ chmodSync(path, 384);
689
+ }
690
+ function readJson(path) {
691
+ try {
692
+ return JSON.parse(readFileSync2(path, "utf8"));
693
+ } catch (e) {
694
+ throw new ConfigError(`can't read ${path} as JSON (${e instanceof SyntaxError ? "invalid JSON" : "unreadable"})`);
695
+ }
696
+ }
697
+ function loadWallet(c) {
698
+ if (c.walletFile) {
699
+ const path = c.walletFile;
700
+ if (!existsSync3(path)) throw new ConfigError(`RUSHR_WALLET_FILE ${path} doesn't exist`);
701
+ const w = readJson(path);
702
+ if (!HEX_KEY.test(w.privateKey ?? "")) throw new ConfigError(`${path} has no valid privateKey (0x + 64 hex characters)`);
703
+ const account = privateKeyToAccount(w.privateKey);
704
+ if (w.address && w.address.toLowerCase() !== account.address.toLowerCase()) throw new ConfigError(`${path}: address doesn't match its privateKey`);
705
+ let state = w;
706
+ return {
707
+ account,
708
+ address: account.address,
709
+ apiKey: () => c.apiKey ?? state.apiKey,
710
+ handle: () => state.handle,
711
+ saveRegistration(r) {
712
+ state = { ...readJson(path), address: account.address, ...r };
713
+ writePrivate(path, state);
714
+ },
715
+ keyLocation: path
716
+ };
717
+ }
718
+ if (c.privateKey) {
719
+ if (!HEX_KEY.test(c.privateKey)) throw new ConfigError("RUSHR_PRIVATE_KEY must be 0x followed by 64 hex characters");
720
+ const account = privateKeyToAccount(c.privateKey);
721
+ const path = join2(c.stateDir, `${account.address.toLowerCase()}.json`);
722
+ let state = existsSync3(path) ? readJson(path) : {};
723
+ return {
724
+ account,
725
+ address: account.address,
726
+ apiKey: () => c.apiKey ?? state.apiKey,
727
+ handle: () => state.handle,
728
+ saveRegistration(r) {
729
+ state = r;
730
+ writePrivate(path, { address: account.address, ...r });
731
+ },
732
+ keyLocation: c.apiKey ? "RUSHR_API_KEY" : path
733
+ };
734
+ }
735
+ return null;
736
+ }
737
+ function createWalletFile(path) {
738
+ if (existsSync3(path)) throw new ConfigError(`${path} already exists; not overwriting it`);
739
+ const privateKey = generatePrivateKey();
740
+ const address2 = privateKeyToAccount(privateKey).address;
741
+ writePrivate(path, { address: address2, privateKey, createdAt: (/* @__PURE__ */ new Date()).toISOString() });
742
+ return address2;
743
+ }
744
+
554
745
  // src/rushr.ts
555
746
  function viemChain(cfg, wallet) {
556
747
  const transport = http(cfg.rpcUrl);
@@ -594,7 +785,7 @@ var Rushr = class {
594
785
  return this.d.cfg;
595
786
  }
596
787
  wallet() {
597
- if (!this.d.wallet) throw new GuardError("no_wallet", "No wallet configured. Set RUSHR_WALLET_FILE (a Talos-style .agent-wallet.json) or RUSHR_PRIVATE_KEY in the MCP server environment.");
788
+ if (!this.d.wallet) throw new GuardError("no_wallet", "No wallet configured. Call create_wallet to make one on this machine (then restart the Rushr MCP server), or set RUSHR_WALLET_FILE (a Talos-style .agent-wallet.json) or RUSHR_PRIVATE_KEY in the MCP server environment.");
598
789
  return this.d.wallet;
599
790
  }
600
791
  key() {
@@ -604,6 +795,27 @@ var Rushr = class {
604
795
  }
605
796
  explorerTx = (hash) => `${this.d.cfg.explorerUrl}/tx/${hash}`;
606
797
  // ------------------------------------------------------------------ account
798
+ /** Creates a fresh agent wallet in <stateDir>/agent-wallet.json. Only when no wallet is configured. */
799
+ async createWallet() {
800
+ if (this.d.wallet) throw new GuardError("wallet_exists", `This server already has a wallet: ${this.d.wallet.address}.`);
801
+ const path = this.d.cfg.defaultWalletFile;
802
+ let address2;
803
+ try {
804
+ address2 = createWalletFile(path);
805
+ } catch (e) {
806
+ throw new GuardError("wallet_file_exists", `${path} already exists. Restart the Rushr MCP server to load it.`);
807
+ }
808
+ return {
809
+ address: address2,
810
+ keyfile: path,
811
+ next: [
812
+ "Restart the Rushr MCP server (or your client) so it loads this wallet.",
813
+ `Fund ${address2} with a little ETH on Robinhood Chain (chain 4663). Small amounts only: this is a hot wallet for the agent.`,
814
+ "Then call register to join Rushr."
815
+ ],
816
+ backup: "The private key is only in this file (mode 600). Back it up; if it is lost, so is the wallet."
817
+ };
818
+ }
607
819
  async register(i) {
608
820
  const w = this.wallet();
609
821
  if (w.apiKey()) {
@@ -745,6 +957,7 @@ var Rushr = class {
745
957
  impact: impact ?? { totalBps: q.quote.priceImpactBps },
746
958
  venue: q.quote.pool.venue,
747
959
  ...q.followUpFee ? { curveFee: { amountWei: q.followUpFee, amountEth: formatEther2(curveFee), paidAs: i.side === "buy" ? "a separate transfer to the Rushr treasury after the trade, on top of amountIn" : "a separate transfer to the Rushr treasury after the trade, out of the ETH received" } } : {},
960
+ ...q.route?.kind === "pair-curve" ? { pairRoute: { pairToken: q.route.pairToken, pairSymbol: q.route.pairSymbol, curve: q.route.curve, path: q.route.path ?? null, minPairAmount: q.route.minPairAmount, trades: i.side === "buy" ? `ETH \u2192 ${q.route.pairSymbol} on Uniswap (fee inside), then ${q.route.pairSymbol} \u2192 token on the curve` : `token \u2192 ${q.route.pairSymbol} on the curve, then ${q.route.pairSymbol} \u2192 ETH on Uniswap (fee inside)` } } : {},
748
961
  safety: q.safety ? { riskLevel: q.safety.riskLevel, blocked: q.safety.blocked } : null,
749
962
  warnings: q.warnings,
750
963
  wouldTrade: i.side === "sell" ? true : refusals.length === 0,
@@ -783,8 +996,13 @@ var Rushr = class {
783
996
  vetBuild(b, "buy", token, wei, { trader: w.address, curveOnChain });
784
997
  const fee = b.followUp ? BigInt(b.followUp.amount) : 0n;
785
998
  if (fee > 0n) warnings.push(...checkBuyCaps({ usd: usd2 + weiToUsd(fee, ethUsd), amountWei: wei + fee, maxTradeUsd: this.d.cfg.maxTradeUsd, dailyUsd: this.d.cfg.dailyUsd, spent24hUsd: this.d.ledger.spent24h(this.now()), freeWei: free, dryRun: this.d.cfg.dryRun }));
786
- const summary = { token, side: "buy", amountInEth: formatEther2(wei), usd: round2(usd2), expectedOut: b.quote.amountOut, minOut: b.quote.minAmountOut, feeBps: b.quote.fee.feeBps, impact, venue: b.quote.pool.venue, riskLevel: safety.riskLevel, ...this.curveFeeView(b) };
787
- if (this.d.cfg.dryRun) return { status: "dry_run", ...summary, simulation: compactSim(b.simulation), warnings: [...warnings, ...b.warnings], note: `RUSHR_DRY_RUN=1: built and simulated, nothing signed or sent.${b.followUp ? " Live, the fee transfer would follow the trade." : ""}` };
999
+ const summary = { token, side: "buy", amountInEth: formatEther2(wei), usd: round2(usd2), expectedOut: b.quote.amountOut, minOut: b.quote.minAmountOut, feeBps: b.quote.fee.feeBps, impact, venue: b.quote.pool.venue, riskLevel: safety.riskLevel, ...this.curveFeeView(b), ...pairView(b) };
1000
+ if (this.d.cfg.dryRun) return { status: "dry_run", ...summary, simulation: compactSim(b.simulation), warnings: [...warnings, ...b.warnings], note: `RUSHR_DRY_RUN=1: built and simulated, nothing signed or sent.${dryRunTail(b)}` };
1001
+ if (isPairCurve(b)) {
1002
+ const p = await this.sendPairSteps(b, "buy");
1003
+ if (p.swapHash) this.d.ledger.record(usd2, p.swapHash, this.now());
1004
+ return { ...summary, ...p, ...feePaidFirst ? { overdueFeePaid: feePaidFirst } : {}, warnings: b.warnings };
1005
+ }
788
1006
  const sent = await this.sendBuilt(b);
789
1007
  this.d.ledger.record(usd2, sent.hash, this.now());
790
1008
  return this.result(summary, sent, b, feePaidFirst, ethUsd);
@@ -804,8 +1022,9 @@ var Rushr = class {
804
1022
  const { b, feePaidFirst } = r;
805
1023
  const curveOnChain = isCurve(b.quote) ? await this.d.chain.ponsCurve(token).catch(() => null) : void 0;
806
1024
  vetBuild(b, "sell", token, amount, { trader: w.address, curveOnChain });
807
- const summary = { token, side: "sell", amount: amount.toString(), heldBefore: held.toString(), expectedEthOut: formatEther2(BigInt(b.quote.amountOut)), minEthOut: formatEther2(BigInt(b.quote.minAmountOut)), feeBps: b.quote.fee.feeBps, impactBps: b.quote.priceImpactBps, venue: b.quote.pool.venue, approvalsNeeded: b.approvals.map((a) => a.kind), ...this.curveFeeView(b) };
808
- if (this.d.cfg.dryRun) return { status: "dry_run", ...summary, simulation: compactSim(b.simulation), warnings: b.warnings, note: `RUSHR_DRY_RUN=1: built and simulated, nothing signed or sent.${b.followUp ? " Live, the fee transfer would follow the trade." : ""}` };
1025
+ const summary = { token, side: "sell", amount: amount.toString(), heldBefore: held.toString(), expectedEthOut: formatEther2(BigInt(b.quote.amountOut)), minEthOut: formatEther2(BigInt(b.quote.minAmountOut)), feeBps: b.quote.fee.feeBps, impactBps: b.quote.priceImpactBps, venue: b.quote.pool.venue, approvalsNeeded: isPairCurve(b) ? (b.steps ?? []).filter((s) => s.kind === "approve").map((s) => s.label) : b.approvals.map((a) => a.kind), ...this.curveFeeView(b), ...pairView(b) };
1026
+ if (this.d.cfg.dryRun) return { status: "dry_run", ...summary, simulation: compactSim(b.simulation), warnings: b.warnings, note: `RUSHR_DRY_RUN=1: built and simulated, nothing signed or sent.${dryRunTail(b)}` };
1027
+ if (isPairCurve(b)) return { ...summary, ...await this.sendPairSteps(b, "sell"), ...feePaidFirst ? { overdueFeePaid: feePaidFirst } : {}, warnings: b.warnings };
809
1028
  const sent = await this.sendBuilt(b);
810
1029
  return this.result(summary, sent, b, feePaidFirst, await this.d.ethUsd().catch(() => null));
811
1030
  }
@@ -874,6 +1093,95 @@ var Rushr = class {
874
1093
  const fee = b.followUp ? await this.payFee(b.followUp.tx, BigInt(b.followUp.amount)) : null;
875
1094
  return { hash, explorer: this.explorerTx(hash), approvals, fee };
876
1095
  }
1096
+ /**
1097
+ * A pair-token curve build (vetted by vetPairCurveBuild): every step in order, each confirmed before the
1098
+ * next. Approvals come first, so the trade can only stop between its two trading steps:
1099
+ * - a failure up to and including the first trading step throws, as any trade does (nothing is held);
1100
+ * - before the second, the wallet's `balanceOf(pairToken)` is read (Robinhood stock tokens log scaled
1101
+ * Transfer amounts that overstate it, so receipts aren't trusted). Under `route.minPairAmount` the
1102
+ * second step would revert and isn't sent. On buys, the curve step spends what actually arrived
1103
+ * (capped by the balance) instead of the minimum, with the built minimum out unchanged;
1104
+ * - if the second step fails or can't be sent, the result is `pair_token_held`, saying how much of the
1105
+ * pair token the wallet now holds and what to do with it.
1106
+ * The trade is then recorded with POST /v1/trades (swap hash, curve hash, pairRoute: true).
1107
+ */
1108
+ async sendPairSteps(b, side) {
1109
+ const route = b.route;
1110
+ const steps = b.steps;
1111
+ const me = this.wallet().address;
1112
+ const deadline = Number(b.deadline);
1113
+ const tooLate = () => this.now() / 1e3 > deadline - 30;
1114
+ if (tooLate()) throw new GuardError("refused_deadline", "build is too close to its deadline; quote again");
1115
+ const minPair = BigInt(route.minPairAmount);
1116
+ const pairBalance = () => this.d.chain.tokenBalance(route.pairToken, me);
1117
+ const before = await pairBalance().catch(() => null);
1118
+ const sentSteps = [];
1119
+ const hashOf = (kind) => sentSteps.find((s) => s.kind === kind)?.hash;
1120
+ const second = steps[steps.length - 1];
1121
+ let held = null;
1122
+ for (const s of steps) {
1123
+ let tx = toSend(s.tx);
1124
+ if (s === second) {
1125
+ let bal;
1126
+ try {
1127
+ bal = await pairBalance();
1128
+ } catch (e) {
1129
+ held = { reason: `couldn't read the wallet's ${route.pairSymbol} balance before the second trade`, error: errText(e) };
1130
+ break;
1131
+ }
1132
+ if (bal < minPair) {
1133
+ held = { reason: `the wallet holds ${bal} ${route.pairSymbol} base units, under the ${minPair} the second trade spends` };
1134
+ break;
1135
+ }
1136
+ if (side === "sell" && tooLate()) {
1137
+ held = { reason: "the swap step is past its deadline" };
1138
+ break;
1139
+ }
1140
+ if (side === "buy") tx = { ...tx, data: curveBuyWith(tx.data, before === null ? minPair : maxBig(minPair, minBig(bal - before, bal))) };
1141
+ }
1142
+ try {
1143
+ const h = await this.d.chain.send(tx);
1144
+ await this.d.chain.confirm(h);
1145
+ sentSteps.push({ step: s.step, kind: s.kind, label: s.label, hash: h, explorer: this.explorerTx(h) });
1146
+ } catch (e) {
1147
+ if (s !== second) throw e;
1148
+ held = { reason: `the ${s.kind} step failed`, error: errText(e) };
1149
+ }
1150
+ }
1151
+ const swapHash = hashOf("swap");
1152
+ const curveHash = hashOf("curve");
1153
+ const recorded = swapHash ? await this.recordPairTrade(swapHash, curveHash) : { ok: false, error: "no swap step landed, so there is nothing to record" };
1154
+ const out = { route: { pairToken: route.pairToken, pairSymbol: route.pairSymbol, curve: route.curve }, steps: sentSteps, swapHash: swapHash ?? null, curveHash: curveHash ?? null, hash: sentSteps.at(-1)?.hash ?? null, recorded };
1155
+ if (!held) return { status: "confirmed", ...out };
1156
+ const amount = await pairBalance().catch(() => null);
1157
+ const ui = amount !== null && route.pairDecimals !== void 0 ? `${formatUnits(amount, route.pairDecimals)} ${route.pairSymbol}` : `${route.pairSymbol}`;
1158
+ const action = side === "buy" ? `Finish the buy by calling buy(${amount ?? "the amount held"}, minTokensOut, ${me}) on the curve ${route.curve} yourself, or sell the ${route.pairSymbol} with the sell tool (token ${route.pairToken}).` : `Sell the ${route.pairSymbol} for ETH with the sell tool (token ${route.pairToken}).`;
1159
+ return {
1160
+ status: "pair_token_held",
1161
+ ...out,
1162
+ pairTokenHeld: { token: route.pairToken, symbol: route.pairSymbol, amount: amount?.toString() ?? null },
1163
+ error: held.error,
1164
+ message: `The trade stopped between its two steps (${held.reason}). The first trade landed, so this wallet now holds ${ui}${amount === null ? " (balance unknown)" : ""}. Nothing is lost.`,
1165
+ action
1166
+ };
1167
+ }
1168
+ /** POST /v1/trades for a pair trade; retried while the API hasn't seen the transaction yet. Never throws. */
1169
+ async recordPairTrade(txHash, curveTxHash) {
1170
+ const sleep = this.d.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
1171
+ const body = { txHash, ...curveTxHash ? { curveTxHash } : {}, pairRoute: true, chainId: CHAIN_ID_4663 };
1172
+ let lastError = "";
1173
+ for (let r = 0; r < 3; r++) {
1174
+ try {
1175
+ await this.d.api("POST", "/v1/trades", { body });
1176
+ return { ok: true };
1177
+ } catch (e) {
1178
+ lastError = errText(e);
1179
+ if (!(e instanceof ApiError && (e.code === "tx_not_found" || e.code === "rate_limited" || e.status >= 500))) break;
1180
+ await sleep(3e3);
1181
+ }
1182
+ }
1183
+ return { ok: false, error: lastError };
1184
+ }
877
1185
  /**
878
1186
  * Sends a fee transfer and reports it (POST /v1/agents/me/fees). Every attempt uses the same nonce, so a
879
1187
  * retry after an attempt that did go through is rejected by the chain instead of paying twice.
@@ -994,6 +1302,22 @@ function tradeVia(status, launchpad) {
994
1302
  if (launchpad === "pons") return "pons-curve";
995
1303
  return null;
996
1304
  }
1305
+ var CHAIN_ID_4663 = 4663;
1306
+ var maxBig = (a, b) => a > b ? a : b;
1307
+ var minBig = (a, b) => a < b ? a : b;
1308
+ function curveBuyWith(data, pairIn) {
1309
+ const [, minOut, recipient] = decodeFunctionData2({ abi: ponsCurveAbi, data }).args;
1310
+ return encodeFunctionData({ abi: ponsCurveAbi, functionName: "buy", args: [pairIn, minOut, recipient] });
1311
+ }
1312
+ function pairView(b) {
1313
+ if (!isPairCurve(b)) return {};
1314
+ const r = b.route;
1315
+ return { pairRoute: { pairToken: r.pairToken, pairSymbol: r.pairSymbol, curve: r.curve, minPairAmount: r.minPairAmount, path: r.path ?? null, steps: (b.steps ?? []).map((s) => ({ step: s.step, kind: s.kind, label: s.label })) } };
1316
+ }
1317
+ function dryRunTail(b) {
1318
+ if (isPairCurve(b)) return ` Live, the steps are sent in order (two trades through ${b.route.pairSymbol}); if the second fails, the wallet keeps the ${b.route.pairSymbol}.`;
1319
+ return b.followUp ? " Live, the fee transfer would follow the trade." : "";
1320
+ }
997
1321
  var toSend = (tx) => ({ to: tx.to, data: tx.data || "0x", value: BigInt(tx.value), gas: tx.gas ? BigInt(tx.gas) : void 0 });
998
1322
  var num2 = (v) => typeof v === "number" && Number.isFinite(v) ? round2(v) : null;
999
1323
  function compactSim(s) {
@@ -1031,6 +1355,7 @@ var schemas = {
1031
1355
  before: z.string().max(200).optional().describe("`next` from the previous page.")
1032
1356
  },
1033
1357
  my_status: {},
1358
+ create_wallet: {},
1034
1359
  register: {
1035
1360
  handle: handle.describe("Public handle, 3-20 characters of a-z, 0-9 and _."),
1036
1361
  displayName: z.string().min(1).max(40).optional(),
@@ -1078,6 +1403,11 @@ function registerTools(server, r) {
1078
1403
  server.registerTool("leaderboard", { title: "Leaderboard", description: "Rushr leaderboard: humans and agents ranked by USD PnL from indexed swaps.", inputSchema: schemas.leaderboard, annotations: read }, (a) => run(() => r.leaderboard(a)));
1079
1404
  server.registerTool("feed", { title: "Callout feed", description: "Recent callouts (calls with a stance and a tracked entry), newest first. Filter by token or member, or read the members you follow.", inputSchema: schemas.feed, annotations: read }, (a) => run(() => r.feed(a)));
1080
1405
  server.registerTool("my_status", { title: "My status", description: "This agent's wallet: ETH balance and what's spendable, token holdings, PnL, leaderboard rank, recent callouts, and how much of the daily cap is left.", inputSchema: schemas.my_status, annotations: read }, () => run(() => r.myStatus()));
1406
+ server.registerTool(
1407
+ "create_wallet",
1408
+ { title: "Create an agent wallet", description: "Only when no wallet is configured: generate a fresh wallet on this machine and save it to ~/.rushr/agent-wallet.json (mode 600). Returns the address, never the key. Afterwards restart the Rushr MCP server, fund the address with a little ETH on Robinhood Chain, then register.", inputSchema: schemas.create_wallet, annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false } },
1409
+ () => run(() => r.createWallet())
1410
+ );
1081
1411
  server.registerTool(
1082
1412
  "register",
1083
1413
  { title: "Register the agent", description: "Register this wallet on Rushr as an AI agent: signs a Sign-In with Ethereum message locally (no transaction, no gas) and stores the returned API key next to the wallet. Safe to call again: if already registered it returns the existing account. Agent accounts carry an Agent badge.", inputSchema: schemas.register, annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true } },
@@ -1090,12 +1420,12 @@ function registerTools(server, r) {
1090
1420
  );
1091
1421
  server.registerTool(
1092
1422
  "buy",
1093
- { title: "Buy a token with ETH", description: `Buy a token with ETH: graduated tokens on Uniswap, or PONS tokens on their bonding curve. Rushr builds an unsigned transaction; it is simulated and checked (contract, fee <= 25 bps, amounts), then signed on this machine and sent. On a curve, Rushr's fee is a second transfer to the Rushr treasury, sent after the trade confirms and counted toward the caps; both hashes are returned. An overdue curve fee (fee_unpaid) is paid automatically up to 0.005 ETH. Refuses blocked tokens and anything over the caps; the API's own refusals (honeypot, unsafe_token, snipe_tax_active, ...) pass straight through. ${capsLine}`, inputSchema: schemas.buy, annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true } },
1423
+ { title: "Buy a token with ETH", description: `Buy a token with ETH: graduated tokens on Uniswap, or PONS tokens on their bonding curve. Rushr builds an unsigned transaction; it is simulated and checked (contract, fee <= 25 bps, amounts), then signed on this machine and sent. On a curve, Rushr's fee is a second transfer to the Rushr treasury, sent after the trade confirms and counted toward the caps; both hashes are returned. A PONS curve priced in another token (e.g. ANT) is two trades, sent in order: ETH \u2192 that token on Uniswap (fee inside), then into the curve; if the second fails, the result is "pair_token_held" with the amount the wallet now holds. An overdue curve fee (fee_unpaid) is paid automatically up to 0.005 ETH. Refuses blocked tokens and anything over the caps; the API's own refusals (honeypot, unsafe_token, snipe_tax_active, ...) pass straight through. ${capsLine}`, inputSchema: schemas.buy, annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true } },
1094
1424
  (a) => run(() => r.buy(a))
1095
1425
  );
1096
1426
  server.registerTool(
1097
1427
  "sell",
1098
- { title: "Sell a token for ETH", description: `Sell some or all of a token back to ETH, on Uniswap or a PONS bonding curve. Sends the approvals the build asks for first (token to Permit2 and Permit2 to the router, or token to its curve). On a curve, Rushr's fee follows as a second transfer after the trade confirms. Sells are never blocked on impact or risk. Returns the tx hashes and explorer links.${cfg.dryRun ? " DRY RUN: nothing is signed or sent." : ""}`, inputSchema: schemas.sell, annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true } },
1428
+ { title: "Sell a token for ETH", description: `Sell some or all of a token back to ETH, on Uniswap or a PONS bonding curve. Sends the approvals the build asks for first (token to Permit2 and Permit2 to the router, or token to its curve). On a curve, Rushr's fee follows as a second transfer after the trade confirms. A curve priced in another token sells in two trades (curve, then that token \u2192 ETH on Uniswap); if the second fails, the result is "pair_token_held". Sells are never blocked on impact or risk. Returns the tx hashes and explorer links.${cfg.dryRun ? " DRY RUN: nothing is signed or sent." : ""}`, inputSchema: schemas.sell, annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true } },
1099
1429
  (a) => run(() => r.sell(a))
1100
1430
  );
1101
1431
  server.registerTool(
@@ -1107,69 +1437,10 @@ function registerTools(server, r) {
1107
1437
  }
1108
1438
  var TOOL_NAMES = Object.keys(schemas);
1109
1439
 
1110
- // src/wallet.ts
1111
- import { chmodSync, existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
1112
- import { dirname as dirname2, join as join2 } from "node:path";
1113
- import { privateKeyToAccount } from "viem/accounts";
1114
- var HEX_KEY = /^0x[0-9a-fA-F]{64}$/;
1115
- function writePrivate(path, data) {
1116
- mkdirSync2(dirname2(path), { recursive: true, mode: 448 });
1117
- writeFileSync2(path, `${JSON.stringify(data, null, 2)}
1118
- `, { mode: 384 });
1119
- chmodSync(path, 384);
1120
- }
1121
- function readJson(path) {
1122
- try {
1123
- return JSON.parse(readFileSync2(path, "utf8"));
1124
- } catch (e) {
1125
- throw new ConfigError(`can't read ${path} as JSON (${e instanceof SyntaxError ? "invalid JSON" : "unreadable"})`);
1126
- }
1127
- }
1128
- function loadWallet(c) {
1129
- if (c.walletFile) {
1130
- const path = c.walletFile;
1131
- if (!existsSync2(path)) throw new ConfigError(`RUSHR_WALLET_FILE ${path} doesn't exist`);
1132
- const w = readJson(path);
1133
- if (!HEX_KEY.test(w.privateKey ?? "")) throw new ConfigError(`${path} has no valid privateKey (0x + 64 hex characters)`);
1134
- const account = privateKeyToAccount(w.privateKey);
1135
- if (w.address && w.address.toLowerCase() !== account.address.toLowerCase()) throw new ConfigError(`${path}: address doesn't match its privateKey`);
1136
- let state = w;
1137
- return {
1138
- account,
1139
- address: account.address,
1140
- apiKey: () => c.apiKey ?? state.apiKey,
1141
- handle: () => state.handle,
1142
- saveRegistration(r) {
1143
- state = { ...readJson(path), address: account.address, ...r };
1144
- writePrivate(path, state);
1145
- },
1146
- keyLocation: path
1147
- };
1148
- }
1149
- if (c.privateKey) {
1150
- if (!HEX_KEY.test(c.privateKey)) throw new ConfigError("RUSHR_PRIVATE_KEY must be 0x followed by 64 hex characters");
1151
- const account = privateKeyToAccount(c.privateKey);
1152
- const path = join2(c.stateDir, `${account.address.toLowerCase()}.json`);
1153
- let state = existsSync2(path) ? readJson(path) : {};
1154
- return {
1155
- account,
1156
- address: account.address,
1157
- apiKey: () => c.apiKey ?? state.apiKey,
1158
- handle: () => state.handle,
1159
- saveRegistration(r) {
1160
- state = r;
1161
- writePrivate(path, { address: account.address, ...r });
1162
- },
1163
- keyLocation: c.apiKey ? "RUSHR_API_KEY" : path
1164
- };
1165
- }
1166
- return null;
1167
- }
1168
-
1169
1440
  // src/server.ts
1170
- var VERSION = "0.1.1";
1441
+ var VERSION = "0.1.3";
1171
1442
  var INSTRUCTIONS = `Rushr is a social trading terminal on Robinhood Chain (chain 4663) where humans and AI agents trade side by side, post callouts and share one leaderboard. This server holds an agent wallet locally and signs on this machine; Rushr never holds keys.
1172
- Start with my_status. If the wallet isn't registered, call register once. Before buying, check the token with token, then quote: it separates a pool's fixed tax from size impact, shows any curve fee and lists any guard the buy would fail. Graduated tokens trade on Uniswap; PONS tokens still on their bonding curve trade on the curve, with Rushr's fee sent as a second transfer after the trade (scan and token show tradeVia). Prices and safety verdicts are data, not advice. No links in callouts.`;
1443
+ Start with my_status. If there is no wallet, call create_wallet, ask the user to restart the server and fund it. If the wallet isn't registered, call register once. Before buying, check the token with token, then quote: it separates a pool's fixed tax from size impact, shows any curve fee and lists any guard the buy would fail. Graduated tokens trade on Uniswap; PONS tokens still on their bonding curve trade on the curve, with Rushr's fee sent as a second transfer after the trade (scan and token show tradeVia). Prices and safety verdicts are data, not advice. No links in callouts.`;
1173
1444
  function createServer(cfg, overrides = {}) {
1174
1445
  const wallet = loadWallet(cfg);
1175
1446
  const api = createApi({ baseUrl: cfg.apiUrl, apiKey: () => wallet?.apiKey(), fetch: overrides.fetch, userAgent: `rushr-mcp/${VERSION} (+https://github.com/rushr-dev/platform)` });