@zerodust/mcp-server 0.2.1 → 0.3.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/dist/index.js CHANGED
@@ -14,17 +14,30 @@
14
14
  * ZERODUST_API_KEY - Optional API key for higher rate limits
15
15
  *
16
16
  * Sweeping is read-only by default. To let an agent actually move funds, see
17
- * `execute.ts` for the ZERODUST_ALLOW_EXECUTE / ZERODUST_PRIVATE_KEY opt-in.
17
+ * `execute.ts` for the ZERODUST_ALLOW_EXECUTE opt-in and `signer.ts` for the
18
+ * four accepted ways to supply a signing key.
19
+ *
20
+ * Tool descriptions here lead with the problem rather than the product. An
21
+ * agent picks a tool by matching the user's words against a description, and
22
+ * "check balances" collides with every other balance tool in the client. What
23
+ * is actually distinctive is the impossibility ZeroDust removes: you cannot
24
+ * send 100% of a native gas token, because sending it costs it.
18
25
  */
26
+ import { createRequire } from "node:module";
27
+ import { pathToFileURL } from "node:url";
19
28
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
20
29
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
21
30
  import { z } from "zod";
22
31
  import { readExecuteConfig, registerExecuteTools } from "./execute.js";
23
32
  const API_BASE = process.env.ZERODUST_API_URL || "https://api.zerodust.xyz";
24
33
  const API_KEY = process.env.ZERODUST_API_KEY;
34
+ // Read from package.json rather than hardcoding: the literal here drifted to
35
+ // 0.2.1 behind the package and shipped a wrong version over the wire, which
36
+ // directory listings surface to users.
37
+ const { version: VERSION } = createRequire(import.meta.url)("../package.json");
25
38
  const server = new McpServer({
26
39
  name: "zerodust",
27
- version: "0.1.0",
40
+ version: VERSION,
28
41
  });
29
42
  // Helper to make API requests
30
43
  async function apiRequest(path, options = {}) {
@@ -48,7 +61,14 @@ async function apiRequest(path, options = {}) {
48
61
  }
49
62
  // ============ Tool: Get Supported Chains ============
50
63
  server.registerTool("zerodust_get_chains", {
51
- description: "Get a list of all blockchain chains supported by ZeroDust for sweeping native gas tokens. Returns chain IDs, names, native tokens, and contract addresses.",
64
+ description: "List the EVM chains a native gas balance can be emptied to exactly zero on. Returns " +
65
+ "chain IDs, names, and native tokens. Call this to check whether a specific chain is " +
66
+ "supported before quoting or sweeping.",
67
+ annotations: {
68
+ title: "List supported chains",
69
+ readOnlyHint: true,
70
+ openWorldHint: true,
71
+ },
52
72
  inputSchema: {},
53
73
  }, async () => {
54
74
  try {
@@ -80,7 +100,18 @@ server.registerTool("zerodust_get_chains", {
80
100
  });
81
101
  // ============ Tool: Get Balances ============
82
102
  server.registerTool("zerodust_get_balances", {
83
- description: "Check native gas token balances across all supported chains for a wallet address. Shows which chains have sweepable balances and their USD values.",
103
+ description: "Find leftover native gas token (ETH, BNB, POL, ...) stranded across every supported EVM " +
104
+ "chain for one address, and report which of it can be recovered. Normally these balances " +
105
+ "are unrecoverable: you cannot transfer 100% of a gas token, because paying for the " +
106
+ "transfer consumes the thing you are transferring, so a remainder is always left behind. " +
107
+ "This reports what is stuck and what could be moved out. Useful when a wallet has small " +
108
+ "amounts scattered over many chains, when someone cannot send their full balance, or " +
109
+ "before closing out, winding down or decommissioning a wallet.",
110
+ annotations: {
111
+ title: "Find stranded gas across chains",
112
+ readOnlyHint: true,
113
+ openWorldHint: true,
114
+ },
84
115
  inputSchema: {
85
116
  address: z
86
117
  .string()
@@ -126,7 +157,15 @@ server.registerTool("zerodust_get_balances", {
126
157
  });
127
158
  // ============ Tool: Get Quote ============
128
159
  server.registerTool("zerodust_get_quote", {
129
- description: "Get a quote for sweeping native gas tokens from one chain. Returns the estimated amount the user will receive, fee breakdown, and a quote ID for executing the sweep. Quotes expire in 60 seconds.",
160
+ description: "Price out emptying a chain's native gas balance to exactly zero: how much actually " +
161
+ "arrives, the full fee breakdown, and whether the balance is even large enough to be " +
162
+ "worth recovering. Call this before sweeping so the user sees the numbers first. Returns " +
163
+ "a quote ID; quotes expire after about 60 seconds.",
164
+ annotations: {
165
+ title: "Quote emptying a chain",
166
+ readOnlyHint: true,
167
+ openWorldHint: true,
168
+ },
130
169
  inputSchema: {
131
170
  fromChainId: z.number().int().positive().describe("Source chain ID to sweep from"),
132
171
  toChainId: z.number().int().positive().describe("Destination chain ID to receive funds"),
@@ -170,7 +209,14 @@ server.registerTool("zerodust_get_quote", {
170
209
  });
171
210
  // ============ Tool: Check Sweep Status ============
172
211
  server.registerTool("zerodust_get_sweep_status", {
173
- description: "Check the status of a previously submitted sweep. Returns the current status (pending, simulating, executing, bridging, completed, failed), transaction hash if available, and error messages if failed.",
212
+ description: "Check how a previously submitted sweep is progressing. Returns the current status " +
213
+ "(pending, simulating, executing, bridging, completed, failed), the transaction hash once " +
214
+ "there is one, and the error message if it failed.",
215
+ annotations: {
216
+ title: "Check sweep status",
217
+ readOnlyHint: true,
218
+ openWorldHint: true,
219
+ },
174
220
  inputSchema: {
175
221
  sweepId: z
176
222
  .string()
@@ -214,7 +260,13 @@ server.registerTool("zerodust_get_sweep_status", {
214
260
  });
215
261
  // ============ Tool: List Sweeps ============
216
262
  server.registerTool("zerodust_list_sweeps", {
217
- description: "List past sweeps for a wallet address. Shows sweep history with status and amounts.",
263
+ description: "List past sweeps for a wallet address, with status and amounts. Useful for confirming a " +
264
+ "chain was already emptied before trying again.",
265
+ annotations: {
266
+ title: "List past sweeps",
267
+ readOnlyHint: true,
268
+ openWorldHint: true,
269
+ },
218
270
  inputSchema: {
219
271
  address: z
220
272
  .string()
@@ -272,9 +324,91 @@ server.registerTool("zerodust_list_sweeps", {
272
324
  };
273
325
  }
274
326
  });
327
+ // ============ Tool: Register API Key ============
328
+ server.registerTool("zerodust_register_api_key", {
329
+ description: "Issue this agent its own ZeroDust API key for higher rate limits, with no human signup " +
330
+ "step. The read-only tools work without a key, so only call this when rate limits are " +
331
+ "actually being hit, or when setting up an unattended agent that will run repeatedly. " +
332
+ "The key is returned once and is not stored by this server - report it to the operator " +
333
+ "so they can set ZERODUST_API_KEY.",
334
+ annotations: {
335
+ title: "Get an API key for this agent",
336
+ readOnlyHint: false,
337
+ // Creates a credential, but destroys nothing and touches no funds.
338
+ destructiveHint: false,
339
+ idempotentHint: false,
340
+ openWorldHint: true,
341
+ },
342
+ inputSchema: {
343
+ name: z
344
+ .string()
345
+ .min(3)
346
+ .max(100)
347
+ .describe("Human-readable name for this agent, e.g. 'arbitrage-bot-prod'"),
348
+ agentId: z
349
+ .string()
350
+ .max(255)
351
+ .optional()
352
+ .describe("Stable unique identifier for this agent, if it has one"),
353
+ contactEmail: z
354
+ .string()
355
+ .email()
356
+ .optional()
357
+ .describe("Contact email for support and abuse notices"),
358
+ },
359
+ }, async ({ name, agentId, contactEmail }) => {
360
+ try {
361
+ const body = { name };
362
+ if (agentId)
363
+ body.agentId = agentId;
364
+ if (contactEmail)
365
+ body.contactEmail = contactEmail;
366
+ const data = await apiRequest("/agent/register", { method: "POST", body });
367
+ return {
368
+ content: [
369
+ {
370
+ type: "text",
371
+ text: [
372
+ "API key issued. It is shown once and is not stored by this server.",
373
+ "",
374
+ ` ZERODUST_API_KEY=${data.apiKey}`,
375
+ "",
376
+ `Key type: ${data.keyType}`,
377
+ data.rateLimits
378
+ ? `Rate limits: ${data.rateLimits.perMinute}/minute, ${data.rateLimits.daily}/day`
379
+ : null,
380
+ "",
381
+ "Give this to the operator to add to the server environment. Treat it as a",
382
+ "secret: it raises rate limits, it does not authorise moving funds.",
383
+ ]
384
+ .filter(Boolean)
385
+ .join("\n"),
386
+ },
387
+ ],
388
+ };
389
+ }
390
+ catch (error) {
391
+ return {
392
+ content: [
393
+ {
394
+ type: "text",
395
+ text: `Error registering API key: ${error instanceof Error ? error.message : String(error)}`,
396
+ },
397
+ ],
398
+ isError: true,
399
+ };
400
+ }
401
+ });
275
402
  // ============ Tool: Service Info ============
276
403
  server.registerTool("zerodust_info", {
277
- description: "Get information about ZeroDust service, including what it does, fee structure, and how to use it. Use this tool when the user asks about ZeroDust or needs to understand the service.",
404
+ description: "Explain how a native gas balance can be emptied to exactly zero, what it costs, and how " +
405
+ "to set this server up to do it. Call this when asked how ZeroDust works, why a full " +
406
+ "balance normally cannot be sent, or what sweeping will cost.",
407
+ annotations: {
408
+ title: "How ZeroDust works",
409
+ readOnlyHint: true,
410
+ openWorldHint: false,
411
+ },
278
412
  inputSchema: {},
279
413
  }, async () => {
280
414
  return {
@@ -302,38 +436,72 @@ server.registerTool("zerodust_info", {
302
436
  " - Gas costs: Paid by relayer, reimbursed from swept amount",
303
437
  " - Users always receive the quoted amount or more",
304
438
  "",
305
- "Supported chains: 25+ EVM chains including Ethereum, Arbitrum, Base,",
306
- " Optimism, Polygon, BSC, Gnosis, and more.",
439
+ "Supported chains:",
440
+ " 25 EVM chains with EIP-7702 support. Call zerodust_get_chains for the",
441
+ " authoritative live list rather than relying on any written-down count.",
307
442
  "",
308
443
  "Integration:",
309
444
  " - SDK: npm install @zerodust/sdk viem",
310
- " - API: POST /quote, POST /sweep, GET /sweep/:id/status",
311
- " - MCP: This server (stdio transport)",
445
+ " - API: GET /quote, POST /authorization, POST /sweep, GET /sweep/:id",
446
+ " - MCP: this server (stdio), or https://api.zerodust.xyz/mcp (no install)",
447
+ "",
448
+ "Trying it safely:",
449
+ " Every sweep tool accepts dryRun=true. That fetches a real quote and",
450
+ " produces the real signatures, then stops before submitting, so an",
451
+ " integration can be proven end to end without moving any funds.",
312
452
  "",
313
453
  "Sweeping from this MCP server:",
314
- " Read-only by default. To execute sweeps, set both",
315
- " ZERODUST_PRIVATE_KEY and ZERODUST_ALLOW_EXECUTE=true, which adds the",
316
- " zerodust_sweep and zerodust_sweep_all tools. Funds may only be sent to",
317
- " the agent's own address unless ZERODUST_ALLOWED_DESTINATIONS lists more.",
454
+ " The zerodust_sweep and zerodust_sweep_all tools are always listed, but",
455
+ " refuse to move funds unless ZERODUST_ALLOW_EXECUTE=true and a signing",
456
+ " key are both configured. A key may be supplied four ways:",
457
+ " ZERODUST_SIGNER_MODULE module returning a viem LocalAccount,",
458
+ " which is how Turnkey, Privy and KMS are used",
459
+ " ZERODUST_KEYSTORE_FILE encrypted V3 keystore + password file",
460
+ " ZERODUST_PRIVATE_KEY_FILE hex key in a file, not in the config",
461
+ " ZERODUST_PRIVATE_KEY hex key inline",
462
+ " Funds may only be sent to the agent's own address unless",
463
+ " ZERODUST_ALLOWED_DESTINATIONS lists more.",
464
+ "",
465
+ "Rate limits:",
466
+ " The read-only tools work with no credential at all. For higher limits an",
467
+ " agent can issue itself an API key with zerodust_register_api_key, with no",
468
+ " human signup step, then pass it as ZERODUST_API_KEY.",
318
469
  ].join("\n"),
319
470
  },
320
471
  ],
321
472
  };
322
473
  });
323
474
  // ============ Start Server ============
475
+ /**
476
+ * The server instance with every read-only tool registered.
477
+ *
478
+ * Exported so tests can attach the execution tools and introspect the real tool
479
+ * surface over an in-memory transport, rather than asserting against a copy of
480
+ * the tool list that could drift from what agents actually see.
481
+ */
482
+ export { server };
324
483
  async function main() {
325
484
  const executeConfig = readExecuteConfig();
326
- if (executeConfig) {
327
- registerExecuteTools(server, executeConfig);
328
- }
485
+ // Registered unconditionally: when executeConfig is null the sweep tools are
486
+ // visible but every handler refuses, so agents and directories can discover
487
+ // the real tool surface without the server granting any spend capability.
488
+ registerExecuteTools(server, executeConfig);
329
489
  const transport = new StdioServerTransport();
330
490
  await server.connect(transport);
331
491
  console.error(executeConfig
332
- ? "ZeroDust MCP Server running on stdio (sweep execution ENABLED)"
333
- : "ZeroDust MCP Server running on stdio (read-only; set ZERODUST_ALLOW_EXECUTE=true to sweep)");
492
+ ? `ZeroDust MCP Server running on stdio (sweep execution ENABLED via ${executeConfig.signer.description})`
493
+ : "ZeroDust MCP Server running on stdio (sweep tools listed but DISABLED; set " +
494
+ "ZERODUST_ALLOW_EXECUTE=true plus one of ZERODUST_SIGNER_MODULE, " +
495
+ "ZERODUST_KEYSTORE_FILE, ZERODUST_PRIVATE_KEY_FILE or ZERODUST_PRIVATE_KEY to enable)");
496
+ }
497
+ // Only start the transport when run as a binary. Importing this module — which
498
+ // the tests do — must not take over stdio.
499
+ const invokedDirectly = process.argv[1] !== undefined &&
500
+ import.meta.url === pathToFileURL(process.argv[1]).href;
501
+ if (invokedDirectly) {
502
+ main().catch((error) => {
503
+ console.error("Fatal error:", error);
504
+ process.exit(1);
505
+ });
334
506
  }
335
- main().catch((error) => {
336
- console.error("Fatal error:", error);
337
- process.exit(1);
338
- });
339
507
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEvE,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,0BAA0B,CAAC;AAC5E,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;AAE7C,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;IAC3B,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC;AAEH,8BAA8B;AAC9B,KAAK,UAAU,UAAU,CACvB,IAAY,EACZ,UAA+C,EAAE;IAEjD,MAAM,OAAO,GAA2B;QACtC,cAAc,EAAE,kBAAkB;QAClC,YAAY,EAAE,2BAA2B;KAC1C,CAAC;IACF,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC;IACjC,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,QAAQ,GAAG,IAAI,EAAE,EAAE;QACjD,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,KAAK;QAC/B,OAAO;Q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AM,CAAC,WAAW,GAAG;QAC1G,CAAC,CAAC,6EAA6E;YAC3E,kEAAkE;YAClE,sFAAsF,CAC7F,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,2CAA2C;AAC3C,MAAM,eAAe,GACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS;IAC7B,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAE1D,IAAI,eAAe,EAAE,CAAC;IACpB,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;QACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @fileoverview Signer resolution for the ZeroDust MCP server
3
+ *
4
+ * Sweeping requires a key that can produce an EIP-712 signature and two
5
+ * EIP-7702 authorizations. The original server accepted exactly one form of
6
+ * that key: a raw hex private key in an environment variable, which in practice
7
+ * means pasting a hot key into an MCP client's JSON config. Operators running
8
+ * agents with real balances decline to do that, which is precisely the
9
+ * population with the most stranded gas.
10
+ *
11
+ * So there are four ways in, in descending order of precedence:
12
+ *
13
+ * ZERODUST_SIGNER_MODULE a module that returns a viem LocalAccount
14
+ * ZERODUST_KEYSTORE_FILE an encrypted V3 keystore + password
15
+ * ZERODUST_PRIVATE_KEY_FILE a file containing a hex key
16
+ * ZERODUST_PRIVATE_KEY a hex key inline (unchanged, still supported)
17
+ *
18
+ * The module hook is the important one. Rather than depending on Turnkey,
19
+ * Privy, AWS KMS and every future custody vendor, this server loads any module
20
+ * that hands back a viem `LocalAccount` — which every one of those vendors
21
+ * already knows how to produce. ZeroDust stays out of the custody business and
22
+ * the integration surface stops growing.
23
+ */
24
+ import { type LocalAccount } from "viem";
25
+ /** How the signing key was supplied, for diagnostics and the address tool. */
26
+ export type SignerKind = "module" | "keystore" | "key-file" | "key-env";
27
+ export interface SignerSource {
28
+ kind: SignerKind;
29
+ /** Human-readable origin, safe to show an agent. Never contains key material. */
30
+ description: string;
31
+ /** Resolves the account. Called at most once per process. */
32
+ load: () => Promise<LocalAccount>;
33
+ }
34
+ /** True when any signer variable is present, used to detect a partial setup. */
35
+ export declare function hasSignerEnv(env: NodeJS.ProcessEnv): boolean;
36
+ /**
37
+ * Picks the signer source from the environment.
38
+ *
39
+ * @returns the source, or null when no signer variable is set
40
+ * @throws when more than one is set, or when the chosen one is incomplete
41
+ */
42
+ export declare function resolveSignerSource(env?: NodeJS.ProcessEnv): SignerSource | null;
43
+ //# sourceMappingURL=signer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAYH,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,MAAM,CAAC;AAkC9D,8EAA8E;AAC9E,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;AAExE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,UAAU,CAAC;IACjB,iFAAiF;IACjF,WAAW,EAAE,MAAM,CAAC;IACpB,6DAA6D;IAC7D,IAAI,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC;CACnC;AAUD,gFAAgF;AAChF,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,OAAO,CAE5D;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,YAAY,GAAG,IAAI,CAuB7F"}