@nuluvium/mcp 0.2.0 → 0.2.1

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
@@ -57,7 +57,7 @@ new testnet mnemonic, never a real wallet's.
57
57
  | Tool | Does |
58
58
  |---|---|
59
59
  | `get_balance` | Shielded USDG per note with its status (approved, waiting, rejected), the deposit wallet, tradable tokens |
60
- | `deposit` | Moves USDG from the deposit wallet into the shielded balance (1 to 1,000 USDG) |
60
+ | `deposit` | Moves USDG from the deposit wallet into the shielded balance (1 to 1,000 USDG; common sizes such as 100 blend in better) |
61
61
  | `route_order` | Buys a stock token in pieces over a time window; returns at once, pieces go out in the background |
62
62
  | `cancel_order` | Cancels pieces not sent yet |
63
63
  | `get_orders` | Orders and the status of every piece |
@@ -22,7 +22,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
22
22
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
23
23
  import { formatUnits } from "viem";
24
24
  import { z } from "zod";
25
- import { depositAccount, depositUsdg, erc20Abi, keysFromMnemonic, planPieces, walletClientFor } from "../../sdk/src/index.js";
25
+ import { depositAccount, depositSizeAdvice, depositUsdg, erc20Abi, keysFromMnemonic, planPieces, walletClientFor } from "../../sdk/src/index.js";
26
26
  import { noteApproval, pickNote } from "./approval.js";
27
27
  import { ensureArtifacts, missingArtifacts } from "./artifacts.js";
28
28
  import { depositProblem } from "./deposit.js";
@@ -89,6 +89,14 @@ const prepareProver = () => {
89
89
  const store = new OrderStore(home, networkName);
90
90
  const engine = new Engine(network, keys, store, artifacts, prepareProver);
91
91
  const usdg = (units) => `${formatUnits(BigInt(units), 6)} USDG`;
92
+ /** Deposit-size guidance for an odd amount (advice only; the deposit already went through). */
93
+ function sizeNote(amount) {
94
+ const advice = depositSizeAdvice(amount);
95
+ if (advice.common || advice.split.length === 0)
96
+ return {};
97
+ const split = advice.split.map((size) => formatUnits(size, 6)).join(" + ");
98
+ return { sizeNote: `${usdg(amount)} is not a common size. Next time, deposits of ${split} USDG blend in better while the pool is small.` };
99
+ }
92
100
  const clock = (unix) => new Date(unix * 1000).toISOString().replace(".000Z", "Z");
93
101
  const reply = (body) => ({ content: [{ type: "text", text: JSON.stringify(body, null, 2) }] });
94
102
  const failure = (message) => ({ content: [{ type: "text", text: message }], isError: true });
@@ -136,7 +144,7 @@ async function walletFunds() {
136
144
  ]);
137
145
  return { usdg: usdgBalance, eth };
138
146
  }
139
- const server = new McpServer({ name: "nuluvium", version: "0.1.0" });
147
+ const server = new McpServer({ name: "nuluvium", version: "0.2.1" });
140
148
  server.registerTool("get_balance", {
141
149
  title: "Shielded balance",
142
150
  description: "Shows the agent's shielded USDG balance on Nuluvium, per note, and the deposit wallet that funds new deposits. One order is paid from one note, so the largest note is the largest order you can route right now.",
@@ -163,7 +171,7 @@ server.registerTool("get_balance", {
163
171
  }));
164
172
  server.registerTool("deposit", {
165
173
  title: "Deposit USDG into the shielded balance",
166
- description: "Moves USDG from the agent's deposit wallet (see get_balance) into its shielded balance as a new note. The deposit itself is public: anyone can see this wallet deposited this amount; what the note pays for later is not linked to it. Sends two transactions (approve, deposit) and waits for them. The new note can pay for orders once the clean-funds check approves it, usually within a minute. Up to 1,000 USDG per deposit until the audit.",
174
+ description: "Moves USDG from the agent's deposit wallet (see get_balance) into its shielded balance as a new note. The deposit itself is public: anyone can see this wallet deposited this amount; what the note pays for later is not linked to it. Sends two transactions (approve, deposit) and waits for them. The new note can pay for orders once the clean-funds check approves it, usually within a minute. Up to 1,000 USDG per deposit until the audit. Prefer a common size (10, 25, 50, 100, 250, 500 or 1,000 USDG): while few people use the pool, an odd amount is easier to pick out; split an odd amount into several deposits of common sizes.",
167
175
  inputSchema: {
168
176
  usdgAmount: z.number().positive().describe("USDG to deposit (1 to 1,000)"),
169
177
  },
@@ -180,6 +188,7 @@ server.registerTool("deposit", {
180
188
  from: depositWallet.address,
181
189
  transaction: `${network.explorer}/tx/${tx}`,
182
190
  next: "Wait about a minute for the clean-funds check, then route_order can pay from this note.",
191
+ ...sizeNote(amount),
183
192
  });
184
193
  }));
185
194
  server.registerTool("route_order", {
@@ -18,5 +18,6 @@ export { RelayerError, clearRelayerCache, getQuote, listRelayers, markRelayerFai
18
18
  export { quoteSwap, quotedBuy, quotedSellMinimum, quoterAbi, withSlippage } from "./quote.js";
19
19
  export { executePiece, randomNonce, runPlan } from "./routing.js";
20
20
  export { depositUsdg } from "./deposit.js";
21
+ export { COMMON_DEPOSIT_SIZES, depositSizeAdvice } from "./sizes.js";
21
22
  export { proveRagequit, ragequitAbi, ragequitNote, sellAtQuote, sellFromFresh } from "./exit.js";
22
23
  export { chainFor, erc20Abi, publicClientFor, walletClientFor } from "./chain.js";
@@ -0,0 +1,20 @@
1
+ // Deposit-size guidance. A deposit is public, and while few people use the pool an unusual amount
2
+ // (137.42) is easier to pick out than a common one (100). The app and the MCP server suggest common
3
+ // sizes and how to split an odd amount into them. Advice only: any amount still works.
4
+ // No dependencies, so the web app can import it without the rest of the SDK.
5
+ const UNIT = 1000000n; // USDG has 6 decimals
6
+ /** Common deposit sizes in whole USDG, largest first (the per-deposit cap is 1,000 until the audit). */
7
+ export const COMMON_DEPOSIT_SIZES = [1000n, 500n, 250n, 100n, 50n, 25n, 10n].map((size) => size * UNIT);
8
+ /** Splits `amount` (USDG units) into common sizes, largest first. */
9
+ export function depositSizeAdvice(amount) {
10
+ const common = COMMON_DEPOSIT_SIZES.includes(amount);
11
+ const split = [];
12
+ let rest = amount;
13
+ for (const size of COMMON_DEPOSIT_SIZES) {
14
+ while (rest >= size) {
15
+ split.push(size);
16
+ rest -= size;
17
+ }
18
+ }
19
+ return { common, split, rest };
20
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuluvium/mcp",
3
3
  "mcpName": "com.nuluvium/mcp",
4
- "version": "0.2.0",
4
+ "version": "0.2.1",
5
5
  "type": "module",
6
6
  "description": "Nuluvium MCP server: lets an AI agent trade Robinhood Chain stock tokens privately, from its own machine",
7
7
  "license": "Apache-2.0",