chain-insights 0.24.1 → 0.24.2
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/cli.cjs +49 -39
- package/dist/cli.mjs +49 -39
- package/dist/cli.mjs.map +1 -1
- package/dist/mcp-proxy.cjs +1 -1
- package/dist/mcp-proxy.mjs +1 -1
- package/dist/{tool-visibility-C8F9Yoxy.cjs → tool-visibility-DA4pOuJt.cjs} +6 -0
- package/dist/{tool-visibility-CXbwfKhv.mjs → tool-visibility-wDMzmHU-.mjs} +7 -1
- package/dist/{tool-visibility-CXbwfKhv.mjs.map → tool-visibility-wDMzmHU-.mjs.map} +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -23,7 +23,10 @@ function printMcpTextContent(result) {
|
|
|
23
23
|
const __dirname$1 = node_path.default.dirname((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
24
24
|
const installerPath = node_path.default.resolve(__dirname$1, "..", "bin", "install.cjs");
|
|
25
25
|
const program = new commander.Command();
|
|
26
|
-
|
|
26
|
+
function createCliCommand(name) {
|
|
27
|
+
return new commander.Command(name).showHelpAfterError();
|
|
28
|
+
}
|
|
29
|
+
program.name("cia").description("AML investigation toolkit for blockchain analysis").version(require_version.PACKAGE_INFO.version).showHelpAfterError().option("--claude", "Install Claude Code skills globally to ~/.claude/skills/").option("--codex", "Install Codex skills globally to ~/.codex/skills/ and register MCP").option("--hermes", "Install Hermes skills globally to ~/.hermes/skills/chain-insights/ and register MCP");
|
|
27
30
|
const rawArgs = process.argv.slice(2);
|
|
28
31
|
const installerFlags = rawArgs.filter((a) => a === "--claude" || a === "--codex" || a === "--hermes");
|
|
29
32
|
const wantsHelpOrVersion = rawArgs.some((a) => a === "--help" || a === "-h" || a === "--version" || a === "-V");
|
|
@@ -96,6 +99,24 @@ async function printNetworkCapability(name, opts) {
|
|
|
96
99
|
if (opts.json) console.log(JSON.stringify(network, null, 2));
|
|
97
100
|
else console.log(formatNetworkCapability(network));
|
|
98
101
|
}
|
|
102
|
+
function addAmlAddressRiskCommand(parent, networksCommand) {
|
|
103
|
+
parent.addCommand(createCliCommand("aml-address-risk").description("Screen an address for AML risk, exchange behavior, and optional comparison with another address").requiredOption("--address <address>", "Full blockchain address to screen").requiredOption("--network <network>", `Network to query. Run \`${networksCommand}\` for supported networks.`).option("--compare-address <address>", "Optional second address to compare against the screened address").action(async (opts) => {
|
|
104
|
+
try {
|
|
105
|
+
await withGraphMcpClient("chain-insights-cli-aml-address-risk", async (client) => {
|
|
106
|
+
const { addressRisk } = await Promise.resolve().then(() => require("./public-tools-Bou25cki.cjs"));
|
|
107
|
+
const result = await addressRisk(client, {
|
|
108
|
+
address: opts.address,
|
|
109
|
+
network: opts.network,
|
|
110
|
+
compareAddress: opts.compareAddress
|
|
111
|
+
});
|
|
112
|
+
console.log(result.summaryText);
|
|
113
|
+
});
|
|
114
|
+
} catch (err) {
|
|
115
|
+
console.error(err.message);
|
|
116
|
+
process.exit(1);
|
|
117
|
+
}
|
|
118
|
+
}));
|
|
119
|
+
}
|
|
99
120
|
program.command("networks").description("Show supported network status and dataset overview").option("--json", "Print raw capability JSON").action(async (opts) => {
|
|
100
121
|
try {
|
|
101
122
|
await printNetworkOverview(opts);
|
|
@@ -145,7 +166,7 @@ program.command("update").description("Check npmjs for a newer Chain Insights re
|
|
|
145
166
|
process.exit(1);
|
|
146
167
|
}
|
|
147
168
|
});
|
|
148
|
-
program.command("debug").description("Configure Chain Insights Graph debug mode").addCommand(
|
|
169
|
+
program.command("debug").description("Configure Chain Insights Graph debug mode").addCommand(createCliCommand("on").description("Enable Chain Insights Graph debug mode without x402 payments").requiredOption("--token <token>", "Debug bearer token").option("--endpoint <url>", "Chain Insights Graph endpoint").action(async (opts) => {
|
|
149
170
|
try {
|
|
150
171
|
const { saveConfig } = await Promise.resolve().then(() => require("./config-B542AM4w.cjs")).then((n) => n.config_exports);
|
|
151
172
|
await saveConfig({
|
|
@@ -160,7 +181,7 @@ program.command("debug").description("Configure Chain Insights Graph debug mode"
|
|
|
160
181
|
console.error(err.message);
|
|
161
182
|
process.exit(1);
|
|
162
183
|
}
|
|
163
|
-
})).addCommand(
|
|
184
|
+
})).addCommand(createCliCommand("off").description("Disable Chain Insights Graph debug mode and use paid x402 calls").action(async () => {
|
|
164
185
|
try {
|
|
165
186
|
const { saveConfig } = await Promise.resolve().then(() => require("./config-B542AM4w.cjs")).then((n) => n.config_exports);
|
|
166
187
|
await saveConfig({
|
|
@@ -173,7 +194,7 @@ program.command("debug").description("Configure Chain Insights Graph debug mode"
|
|
|
173
194
|
console.error(err.message);
|
|
174
195
|
process.exit(1);
|
|
175
196
|
}
|
|
176
|
-
})).addCommand(
|
|
197
|
+
})).addCommand(createCliCommand("status").description("Show Chain Insights Graph payment/debug mode").action(async () => {
|
|
177
198
|
try {
|
|
178
199
|
const { loadConfig } = await Promise.resolve().then(() => require("./config-B542AM4w.cjs")).then((n) => n.config_exports);
|
|
179
200
|
const config = await loadConfig();
|
|
@@ -186,7 +207,7 @@ program.command("debug").description("Configure Chain Insights Graph debug mode"
|
|
|
186
207
|
process.exit(1);
|
|
187
208
|
}
|
|
188
209
|
}));
|
|
189
|
-
program.command("access-key").description("Configure Chain Insights Graph test access key mode").addCommand(
|
|
210
|
+
program.command("access-key").description("Configure Chain Insights Graph test access key mode").addCommand(createCliCommand("set").description("Use a Chain Insights Graph test access key without x402 payments").argument("<key>", "Test access key").option("--endpoint <url>", "Chain Insights Graph endpoint").action(async (key, opts) => {
|
|
190
211
|
try {
|
|
191
212
|
const normalizedKey = key.trim();
|
|
192
213
|
if (!normalizedKey) throw new Error("Test access key is required");
|
|
@@ -203,7 +224,7 @@ program.command("access-key").description("Configure Chain Insights Graph test a
|
|
|
203
224
|
console.error(err.message);
|
|
204
225
|
process.exit(1);
|
|
205
226
|
}
|
|
206
|
-
})).addCommand(
|
|
227
|
+
})).addCommand(createCliCommand("clear").description("Remove the Chain Insights Graph test access key and use paid x402 calls").action(async () => {
|
|
207
228
|
try {
|
|
208
229
|
const { saveConfig } = await Promise.resolve().then(() => require("./config-B542AM4w.cjs")).then((n) => n.config_exports);
|
|
209
230
|
await saveConfig({
|
|
@@ -216,7 +237,7 @@ program.command("access-key").description("Configure Chain Insights Graph test a
|
|
|
216
237
|
console.error(err.message);
|
|
217
238
|
process.exit(1);
|
|
218
239
|
}
|
|
219
|
-
})).addCommand(
|
|
240
|
+
})).addCommand(createCliCommand("status").description("Show Chain Insights Graph test access key status").action(async () => {
|
|
220
241
|
try {
|
|
221
242
|
const { loadConfig } = await Promise.resolve().then(() => require("./config-B542AM4w.cjs")).then((n) => n.config_exports);
|
|
222
243
|
const config = await loadConfig();
|
|
@@ -228,14 +249,14 @@ program.command("access-key").description("Configure Chain Insights Graph test a
|
|
|
228
249
|
process.exit(1);
|
|
229
250
|
}
|
|
230
251
|
}));
|
|
231
|
-
program.command("setup").description("Configure external MCP clients").addCommand(
|
|
252
|
+
program.command("setup").description("Configure external MCP clients").addCommand(createCliCommand("claude-code").alias("claude").description("Install Claude Code skills and register the MCP proxy").action(() => {
|
|
232
253
|
runInstaller("--claude");
|
|
233
|
-
})).addCommand(
|
|
254
|
+
})).addCommand(createCliCommand("codex").description("Install Codex skills and register the MCP proxy").action(() => {
|
|
234
255
|
runInstaller("--codex");
|
|
235
|
-
})).addCommand(
|
|
256
|
+
})).addCommand(createCliCommand("hermes").description("Install Hermes skills and register the MCP proxy").action(() => {
|
|
236
257
|
runInstaller("--hermes");
|
|
237
258
|
}));
|
|
238
|
-
program.command("config").description("Read or write configuration values").addCommand(
|
|
259
|
+
program.command("config").description("Read or write configuration values").addCommand(createCliCommand("get").description("Read one Chain Insights configuration value").argument("<key>", "Config key to read").action(async (key) => {
|
|
239
260
|
const { loadConfig } = await Promise.resolve().then(() => require("./config-B542AM4w.cjs")).then((n) => n.config_exports);
|
|
240
261
|
const { CONFIG_KEYS } = await Promise.resolve().then(() => require("./schema-CtFWYoJz.cjs")).then((n) => n.schema_exports);
|
|
241
262
|
if (!CONFIG_KEYS.includes(key)) {
|
|
@@ -244,7 +265,7 @@ program.command("config").description("Read or write configuration values").addC
|
|
|
244
265
|
}
|
|
245
266
|
const value = (await loadConfig())[key];
|
|
246
267
|
console.log(value ?? "");
|
|
247
|
-
})).addCommand(
|
|
268
|
+
})).addCommand(createCliCommand("set").description("Write one Chain Insights configuration value").argument("<key>", "Config key to write").argument("<value>", "Value to set").action(async (key, value) => {
|
|
248
269
|
if (key === "walletPrivateKey") {
|
|
249
270
|
try {
|
|
250
271
|
const { setWalletPrivateKey } = await Promise.resolve().then(() => require("./wallet-B3hAr70M.cjs")).then((n) => n.wallet_exports);
|
|
@@ -271,7 +292,7 @@ program.command("config").description("Read or write configuration values").addC
|
|
|
271
292
|
const displayed = key.toLowerCase().includes("token") ? "[redacted]" : coerced;
|
|
272
293
|
console.log(`Set ${key} = ${displayed}`);
|
|
273
294
|
}));
|
|
274
|
-
program.command("wallet").description("Manage the local Base USDC payment wallet").addCommand(
|
|
295
|
+
program.command("wallet").description("Manage the local Base USDC payment wallet").addCommand(createCliCommand("create").description("Generate a new local Base payment wallet").action(async () => {
|
|
275
296
|
try {
|
|
276
297
|
const { isWalletConfigured, setWalletPrivateKey, walletPath } = await Promise.resolve().then(() => require("./wallet-B3hAr70M.cjs")).then((n) => n.wallet_exports);
|
|
277
298
|
const { createInterface } = await import("node:readline/promises");
|
|
@@ -300,7 +321,7 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
|
|
|
300
321
|
console.error(err.message);
|
|
301
322
|
process.exit(1);
|
|
302
323
|
}
|
|
303
|
-
})).addCommand(
|
|
324
|
+
})).addCommand(createCliCommand("import").description("Import a Base payment wallet").argument("<private-key>", "0x-prefixed EVM private key").option("--force", "Replace an existing wallet (the previous key is backed up next to wallet.json)").action(async (privateKey, opts) => {
|
|
304
325
|
try {
|
|
305
326
|
const { setWalletPrivateKey, isWalletConfigured } = await Promise.resolve().then(() => require("./wallet-B3hAr70M.cjs")).then((n) => n.wallet_exports);
|
|
306
327
|
const replacing = opts.force === true && await isWalletConfigured();
|
|
@@ -314,7 +335,7 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
|
|
|
314
335
|
console.error(err.message);
|
|
315
336
|
process.exit(1);
|
|
316
337
|
}
|
|
317
|
-
})).addCommand(
|
|
338
|
+
})).addCommand(createCliCommand("address").description("Print the local payment wallet address").action(async () => {
|
|
318
339
|
try {
|
|
319
340
|
const { getWalletAccount } = await Promise.resolve().then(() => require("./tools-BHfphgy9.cjs")).then((n) => n.tools_exports);
|
|
320
341
|
const account = await getWalletAccount();
|
|
@@ -323,7 +344,7 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
|
|
|
323
344
|
console.error(err.message);
|
|
324
345
|
process.exit(1);
|
|
325
346
|
}
|
|
326
|
-
})).addCommand(
|
|
347
|
+
})).addCommand(createCliCommand("balance").description("Show the local payment wallet Base USDC balance").action(async () => {
|
|
327
348
|
try {
|
|
328
349
|
const { getWalletBalanceText } = await Promise.resolve().then(() => require("./tools-BHfphgy9.cjs")).then((n) => n.tools_exports);
|
|
329
350
|
console.log(await getWalletBalanceText());
|
|
@@ -331,7 +352,7 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
|
|
|
331
352
|
console.error(err.message);
|
|
332
353
|
process.exit(1);
|
|
333
354
|
}
|
|
334
|
-
})).addCommand(
|
|
355
|
+
})).addCommand(createCliCommand("ready").description("Check and prepare the wallet for paid Chain Insights Graph calls").option("--check-only", "Only check readiness; do not submit the one-time payment setup").addOption(new commander.Option("--no-approve", "Deprecated alias for --check-only").hideHelp()).option("--payment-usdc <amount>", "USDC setup cap to prepare for paid calls", "1").addOption(new commander.Option("--approval-usdc <amount>", "Deprecated alias for --payment-usdc").hideHelp()).option("--json", "Print machine-readable readiness metadata").action(async (opts) => {
|
|
335
356
|
try {
|
|
336
357
|
const { formatWalletReadiness, parsePaymentApprovalUnits, prepareWalletForPaidCalls } = await Promise.resolve().then(() => require("./tools-BHfphgy9.cjs")).then((n) => n.tools_exports);
|
|
337
358
|
const result = await prepareWalletForPaidCalls({
|
|
@@ -347,7 +368,7 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
|
|
|
347
368
|
console.error(err.message);
|
|
348
369
|
process.exit(1);
|
|
349
370
|
}
|
|
350
|
-
})).addCommand(
|
|
371
|
+
})).addCommand(createCliCommand("topup").description("Open a local browser page to top up the payment wallet").option("--no-open", "Print the top-up URL without opening a browser").option("--json", "Print machine-readable top-up metadata").action(async (opts) => {
|
|
351
372
|
try {
|
|
352
373
|
const { buildTopupInfo, getWalletAccount } = await Promise.resolve().then(() => require("./tools-BHfphgy9.cjs")).then((n) => n.tools_exports);
|
|
353
374
|
const { startTopupServer } = await Promise.resolve().then(() => require("./topup-server-YN3iHrHW.cjs")).then((n) => n.topup_server_exports);
|
|
@@ -371,18 +392,19 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
|
|
|
371
392
|
process.exit(1);
|
|
372
393
|
}
|
|
373
394
|
}));
|
|
374
|
-
program
|
|
395
|
+
addAmlAddressRiskCommand(program, "cia networks");
|
|
396
|
+
const mcpCommand = program.command("mcp").description("Interact with the Chain Insights MCP endpoint").allowExcessArguments(false).addCommand(createCliCommand("networks").description("List the detailed Chain Insights capability matrix and tool support").option("--json", "Print raw capability JSON").action(async (opts) => {
|
|
375
397
|
try {
|
|
376
398
|
await printNetworkCapabilities(opts);
|
|
377
399
|
} catch (err) {
|
|
378
400
|
console.error(err.message);
|
|
379
401
|
process.exit(1);
|
|
380
402
|
}
|
|
381
|
-
})).addCommand(
|
|
403
|
+
})).addCommand(createCliCommand("tools").description("List remote GraphRAG MCP tools (cached for 24 hours)").option("--refresh", "Force refresh schema cache").action(async (opts) => {
|
|
382
404
|
try {
|
|
383
405
|
const { loadSchema, saveSchema } = await Promise.resolve().then(() => require("./schema-cache-n7Gbhvsj.cjs"));
|
|
384
406
|
const { formatToolsTable } = await Promise.resolve().then(() => require("./format-BjZuYDr8.cjs"));
|
|
385
|
-
const { visibleRemoteTools } = await Promise.resolve().then(() => require("./tool-visibility-
|
|
407
|
+
const { visibleRemoteTools } = await Promise.resolve().then(() => require("./tool-visibility-DA4pOuJt.cjs")).then((n) => n.tool_visibility_exports);
|
|
386
408
|
const { loadConfig } = await Promise.resolve().then(() => require("./config-B542AM4w.cjs")).then((n) => n.config_exports);
|
|
387
409
|
const { createConfiguredGraphMcpFetch, resolveGraphMcpEndpoint } = await Promise.resolve().then(() => require("./client-Ypw9BNbn.cjs")).then((n) => n.client_exports);
|
|
388
410
|
const config = await loadConfig();
|
|
@@ -409,25 +431,12 @@ program.command("mcp").description("Interact with the Chain Insights MCP endpoin
|
|
|
409
431
|
console.error(err.message);
|
|
410
432
|
process.exit(1);
|
|
411
433
|
}
|
|
412
|
-
}))
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
const { addressRisk } = await Promise.resolve().then(() => require("./public-tools-Bou25cki.cjs"));
|
|
416
|
-
const result = await addressRisk(client, {
|
|
417
|
-
address: opts.address,
|
|
418
|
-
network: opts.network,
|
|
419
|
-
compareAddress: opts.compareAddress
|
|
420
|
-
});
|
|
421
|
-
console.log(result.summaryText);
|
|
422
|
-
});
|
|
423
|
-
} catch (err) {
|
|
424
|
-
console.error(err.message);
|
|
425
|
-
process.exit(1);
|
|
426
|
-
}
|
|
427
|
-
})).addCommand(new commander.Command("call").description("Call an MCP tool directly (debug)").argument("<tool>", "Tool name to call").argument("[args...]", "Key=value arguments (e.g. address=0x1234... network=robinhood)").action(async (tool, rawArgs) => {
|
|
434
|
+
}));
|
|
435
|
+
addAmlAddressRiskCommand(mcpCommand, "cia mcp networks");
|
|
436
|
+
mcpCommand.addCommand(createCliCommand("call").description("Call an MCP tool directly (debug)").argument("<tool>", "Tool name to call").argument("[args...]", "Key=value arguments (e.g. address=0x1234... network=robinhood)").action(async (tool, rawArgs) => {
|
|
428
437
|
try {
|
|
429
438
|
const { parseMcpCallArgs } = await Promise.resolve().then(() => require("./call-args-DAiQSDmD.cjs"));
|
|
430
|
-
const { assertPublicMcpToolName, validatePublicMcpToolArguments } = await Promise.resolve().then(() => require("./tool-visibility-
|
|
439
|
+
const { assertPublicMcpToolName, validatePublicMcpToolArguments } = await Promise.resolve().then(() => require("./tool-visibility-DA4pOuJt.cjs")).then((n) => n.tool_visibility_exports);
|
|
431
440
|
const args = parseMcpCallArgs(rawArgs);
|
|
432
441
|
assertPublicMcpToolName(tool);
|
|
433
442
|
validatePublicMcpToolArguments(tool, args);
|
|
@@ -475,7 +484,8 @@ program.command("mcp").description("Interact with the Chain Insights MCP endpoin
|
|
|
475
484
|
}));
|
|
476
485
|
});
|
|
477
486
|
} catch (err) {
|
|
478
|
-
|
|
487
|
+
const { formatMcpCallError } = await Promise.resolve().then(() => require("./tool-visibility-DA4pOuJt.cjs")).then((n) => n.tool_visibility_exports);
|
|
488
|
+
console.error(formatMcpCallError(tool, err));
|
|
479
489
|
process.exit(1);
|
|
480
490
|
}
|
|
481
491
|
}));
|
package/dist/cli.mjs
CHANGED
|
@@ -21,7 +21,10 @@ function printMcpTextContent(result) {
|
|
|
21
21
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
22
22
|
const installerPath = path.resolve(__dirname, "..", "bin", "install.cjs");
|
|
23
23
|
const program = new Command();
|
|
24
|
-
|
|
24
|
+
function createCliCommand(name) {
|
|
25
|
+
return new Command(name).showHelpAfterError();
|
|
26
|
+
}
|
|
27
|
+
program.name("cia").description("AML investigation toolkit for blockchain analysis").version(PACKAGE_INFO.version).showHelpAfterError().option("--claude", "Install Claude Code skills globally to ~/.claude/skills/").option("--codex", "Install Codex skills globally to ~/.codex/skills/ and register MCP").option("--hermes", "Install Hermes skills globally to ~/.hermes/skills/chain-insights/ and register MCP");
|
|
25
28
|
const rawArgs = process.argv.slice(2);
|
|
26
29
|
const installerFlags = rawArgs.filter((a) => a === "--claude" || a === "--codex" || a === "--hermes");
|
|
27
30
|
const wantsHelpOrVersion = rawArgs.some((a) => a === "--help" || a === "-h" || a === "--version" || a === "-V");
|
|
@@ -94,6 +97,24 @@ async function printNetworkCapability(name, opts) {
|
|
|
94
97
|
if (opts.json) console.log(JSON.stringify(network, null, 2));
|
|
95
98
|
else console.log(formatNetworkCapability(network));
|
|
96
99
|
}
|
|
100
|
+
function addAmlAddressRiskCommand(parent, networksCommand) {
|
|
101
|
+
parent.addCommand(createCliCommand("aml-address-risk").description("Screen an address for AML risk, exchange behavior, and optional comparison with another address").requiredOption("--address <address>", "Full blockchain address to screen").requiredOption("--network <network>", `Network to query. Run \`${networksCommand}\` for supported networks.`).option("--compare-address <address>", "Optional second address to compare against the screened address").action(async (opts) => {
|
|
102
|
+
try {
|
|
103
|
+
await withGraphMcpClient("chain-insights-cli-aml-address-risk", async (client) => {
|
|
104
|
+
const { addressRisk } = await import("./public-tools-CpOLkME5.mjs");
|
|
105
|
+
const result = await addressRisk(client, {
|
|
106
|
+
address: opts.address,
|
|
107
|
+
network: opts.network,
|
|
108
|
+
compareAddress: opts.compareAddress
|
|
109
|
+
});
|
|
110
|
+
console.log(result.summaryText);
|
|
111
|
+
});
|
|
112
|
+
} catch (err) {
|
|
113
|
+
console.error(err.message);
|
|
114
|
+
process.exit(1);
|
|
115
|
+
}
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
97
118
|
program.command("networks").description("Show supported network status and dataset overview").option("--json", "Print raw capability JSON").action(async (opts) => {
|
|
98
119
|
try {
|
|
99
120
|
await printNetworkOverview(opts);
|
|
@@ -143,7 +164,7 @@ program.command("update").description("Check npmjs for a newer Chain Insights re
|
|
|
143
164
|
process.exit(1);
|
|
144
165
|
}
|
|
145
166
|
});
|
|
146
|
-
program.command("debug").description("Configure Chain Insights Graph debug mode").addCommand(
|
|
167
|
+
program.command("debug").description("Configure Chain Insights Graph debug mode").addCommand(createCliCommand("on").description("Enable Chain Insights Graph debug mode without x402 payments").requiredOption("--token <token>", "Debug bearer token").option("--endpoint <url>", "Chain Insights Graph endpoint").action(async (opts) => {
|
|
147
168
|
try {
|
|
148
169
|
const { saveConfig } = await import("./config-DbbPiGk0.mjs").then((n) => n.t);
|
|
149
170
|
await saveConfig({
|
|
@@ -158,7 +179,7 @@ program.command("debug").description("Configure Chain Insights Graph debug mode"
|
|
|
158
179
|
console.error(err.message);
|
|
159
180
|
process.exit(1);
|
|
160
181
|
}
|
|
161
|
-
})).addCommand(
|
|
182
|
+
})).addCommand(createCliCommand("off").description("Disable Chain Insights Graph debug mode and use paid x402 calls").action(async () => {
|
|
162
183
|
try {
|
|
163
184
|
const { saveConfig } = await import("./config-DbbPiGk0.mjs").then((n) => n.t);
|
|
164
185
|
await saveConfig({
|
|
@@ -171,7 +192,7 @@ program.command("debug").description("Configure Chain Insights Graph debug mode"
|
|
|
171
192
|
console.error(err.message);
|
|
172
193
|
process.exit(1);
|
|
173
194
|
}
|
|
174
|
-
})).addCommand(
|
|
195
|
+
})).addCommand(createCliCommand("status").description("Show Chain Insights Graph payment/debug mode").action(async () => {
|
|
175
196
|
try {
|
|
176
197
|
const { loadConfig } = await import("./config-DbbPiGk0.mjs").then((n) => n.t);
|
|
177
198
|
const config = await loadConfig();
|
|
@@ -184,7 +205,7 @@ program.command("debug").description("Configure Chain Insights Graph debug mode"
|
|
|
184
205
|
process.exit(1);
|
|
185
206
|
}
|
|
186
207
|
}));
|
|
187
|
-
program.command("access-key").description("Configure Chain Insights Graph test access key mode").addCommand(
|
|
208
|
+
program.command("access-key").description("Configure Chain Insights Graph test access key mode").addCommand(createCliCommand("set").description("Use a Chain Insights Graph test access key without x402 payments").argument("<key>", "Test access key").option("--endpoint <url>", "Chain Insights Graph endpoint").action(async (key, opts) => {
|
|
188
209
|
try {
|
|
189
210
|
const normalizedKey = key.trim();
|
|
190
211
|
if (!normalizedKey) throw new Error("Test access key is required");
|
|
@@ -201,7 +222,7 @@ program.command("access-key").description("Configure Chain Insights Graph test a
|
|
|
201
222
|
console.error(err.message);
|
|
202
223
|
process.exit(1);
|
|
203
224
|
}
|
|
204
|
-
})).addCommand(
|
|
225
|
+
})).addCommand(createCliCommand("clear").description("Remove the Chain Insights Graph test access key and use paid x402 calls").action(async () => {
|
|
205
226
|
try {
|
|
206
227
|
const { saveConfig } = await import("./config-DbbPiGk0.mjs").then((n) => n.t);
|
|
207
228
|
await saveConfig({
|
|
@@ -214,7 +235,7 @@ program.command("access-key").description("Configure Chain Insights Graph test a
|
|
|
214
235
|
console.error(err.message);
|
|
215
236
|
process.exit(1);
|
|
216
237
|
}
|
|
217
|
-
})).addCommand(
|
|
238
|
+
})).addCommand(createCliCommand("status").description("Show Chain Insights Graph test access key status").action(async () => {
|
|
218
239
|
try {
|
|
219
240
|
const { loadConfig } = await import("./config-DbbPiGk0.mjs").then((n) => n.t);
|
|
220
241
|
const config = await loadConfig();
|
|
@@ -226,14 +247,14 @@ program.command("access-key").description("Configure Chain Insights Graph test a
|
|
|
226
247
|
process.exit(1);
|
|
227
248
|
}
|
|
228
249
|
}));
|
|
229
|
-
program.command("setup").description("Configure external MCP clients").addCommand(
|
|
250
|
+
program.command("setup").description("Configure external MCP clients").addCommand(createCliCommand("claude-code").alias("claude").description("Install Claude Code skills and register the MCP proxy").action(() => {
|
|
230
251
|
runInstaller("--claude");
|
|
231
|
-
})).addCommand(
|
|
252
|
+
})).addCommand(createCliCommand("codex").description("Install Codex skills and register the MCP proxy").action(() => {
|
|
232
253
|
runInstaller("--codex");
|
|
233
|
-
})).addCommand(
|
|
254
|
+
})).addCommand(createCliCommand("hermes").description("Install Hermes skills and register the MCP proxy").action(() => {
|
|
234
255
|
runInstaller("--hermes");
|
|
235
256
|
}));
|
|
236
|
-
program.command("config").description("Read or write configuration values").addCommand(
|
|
257
|
+
program.command("config").description("Read or write configuration values").addCommand(createCliCommand("get").description("Read one Chain Insights configuration value").argument("<key>", "Config key to read").action(async (key) => {
|
|
237
258
|
const { loadConfig } = await import("./config-DbbPiGk0.mjs").then((n) => n.t);
|
|
238
259
|
const { CONFIG_KEYS } = await import("./schema-B0OuHW_l.mjs").then((n) => n.r);
|
|
239
260
|
if (!CONFIG_KEYS.includes(key)) {
|
|
@@ -242,7 +263,7 @@ program.command("config").description("Read or write configuration values").addC
|
|
|
242
263
|
}
|
|
243
264
|
const value = (await loadConfig())[key];
|
|
244
265
|
console.log(value ?? "");
|
|
245
|
-
})).addCommand(
|
|
266
|
+
})).addCommand(createCliCommand("set").description("Write one Chain Insights configuration value").argument("<key>", "Config key to write").argument("<value>", "Value to set").action(async (key, value) => {
|
|
246
267
|
if (key === "walletPrivateKey") {
|
|
247
268
|
try {
|
|
248
269
|
const { setWalletPrivateKey } = await import("./wallet-COcm4oIb.mjs").then((n) => n.s);
|
|
@@ -269,7 +290,7 @@ program.command("config").description("Read or write configuration values").addC
|
|
|
269
290
|
const displayed = key.toLowerCase().includes("token") ? "[redacted]" : coerced;
|
|
270
291
|
console.log(`Set ${key} = ${displayed}`);
|
|
271
292
|
}));
|
|
272
|
-
program.command("wallet").description("Manage the local Base USDC payment wallet").addCommand(
|
|
293
|
+
program.command("wallet").description("Manage the local Base USDC payment wallet").addCommand(createCliCommand("create").description("Generate a new local Base payment wallet").action(async () => {
|
|
273
294
|
try {
|
|
274
295
|
const { isWalletConfigured, setWalletPrivateKey, walletPath } = await import("./wallet-COcm4oIb.mjs").then((n) => n.s);
|
|
275
296
|
const { createInterface } = await import("node:readline/promises");
|
|
@@ -298,7 +319,7 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
|
|
|
298
319
|
console.error(err.message);
|
|
299
320
|
process.exit(1);
|
|
300
321
|
}
|
|
301
|
-
})).addCommand(
|
|
322
|
+
})).addCommand(createCliCommand("import").description("Import a Base payment wallet").argument("<private-key>", "0x-prefixed EVM private key").option("--force", "Replace an existing wallet (the previous key is backed up next to wallet.json)").action(async (privateKey, opts) => {
|
|
302
323
|
try {
|
|
303
324
|
const { setWalletPrivateKey, isWalletConfigured } = await import("./wallet-COcm4oIb.mjs").then((n) => n.s);
|
|
304
325
|
const replacing = opts.force === true && await isWalletConfigured();
|
|
@@ -312,7 +333,7 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
|
|
|
312
333
|
console.error(err.message);
|
|
313
334
|
process.exit(1);
|
|
314
335
|
}
|
|
315
|
-
})).addCommand(
|
|
336
|
+
})).addCommand(createCliCommand("address").description("Print the local payment wallet address").action(async () => {
|
|
316
337
|
try {
|
|
317
338
|
const { getWalletAccount } = await import("./tools-BRQAPF2R.mjs").then((n) => n.p);
|
|
318
339
|
const account = await getWalletAccount();
|
|
@@ -321,7 +342,7 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
|
|
|
321
342
|
console.error(err.message);
|
|
322
343
|
process.exit(1);
|
|
323
344
|
}
|
|
324
|
-
})).addCommand(
|
|
345
|
+
})).addCommand(createCliCommand("balance").description("Show the local payment wallet Base USDC balance").action(async () => {
|
|
325
346
|
try {
|
|
326
347
|
const { getWalletBalanceText } = await import("./tools-BRQAPF2R.mjs").then((n) => n.p);
|
|
327
348
|
console.log(await getWalletBalanceText());
|
|
@@ -329,7 +350,7 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
|
|
|
329
350
|
console.error(err.message);
|
|
330
351
|
process.exit(1);
|
|
331
352
|
}
|
|
332
|
-
})).addCommand(
|
|
353
|
+
})).addCommand(createCliCommand("ready").description("Check and prepare the wallet for paid Chain Insights Graph calls").option("--check-only", "Only check readiness; do not submit the one-time payment setup").addOption(new Option("--no-approve", "Deprecated alias for --check-only").hideHelp()).option("--payment-usdc <amount>", "USDC setup cap to prepare for paid calls", "1").addOption(new Option("--approval-usdc <amount>", "Deprecated alias for --payment-usdc").hideHelp()).option("--json", "Print machine-readable readiness metadata").action(async (opts) => {
|
|
333
354
|
try {
|
|
334
355
|
const { formatWalletReadiness, parsePaymentApprovalUnits, prepareWalletForPaidCalls } = await import("./tools-BRQAPF2R.mjs").then((n) => n.p);
|
|
335
356
|
const result = await prepareWalletForPaidCalls({
|
|
@@ -345,7 +366,7 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
|
|
|
345
366
|
console.error(err.message);
|
|
346
367
|
process.exit(1);
|
|
347
368
|
}
|
|
348
|
-
})).addCommand(
|
|
369
|
+
})).addCommand(createCliCommand("topup").description("Open a local browser page to top up the payment wallet").option("--no-open", "Print the top-up URL without opening a browser").option("--json", "Print machine-readable top-up metadata").action(async (opts) => {
|
|
349
370
|
try {
|
|
350
371
|
const { buildTopupInfo, getWalletAccount } = await import("./tools-BRQAPF2R.mjs").then((n) => n.p);
|
|
351
372
|
const { startTopupServer } = await import("./topup-server-BLdF1SFQ.mjs").then((n) => n.r);
|
|
@@ -369,18 +390,19 @@ program.command("wallet").description("Manage the local Base USDC payment wallet
|
|
|
369
390
|
process.exit(1);
|
|
370
391
|
}
|
|
371
392
|
}));
|
|
372
|
-
program
|
|
393
|
+
addAmlAddressRiskCommand(program, "cia networks");
|
|
394
|
+
const mcpCommand = program.command("mcp").description("Interact with the Chain Insights MCP endpoint").allowExcessArguments(false).addCommand(createCliCommand("networks").description("List the detailed Chain Insights capability matrix and tool support").option("--json", "Print raw capability JSON").action(async (opts) => {
|
|
373
395
|
try {
|
|
374
396
|
await printNetworkCapabilities(opts);
|
|
375
397
|
} catch (err) {
|
|
376
398
|
console.error(err.message);
|
|
377
399
|
process.exit(1);
|
|
378
400
|
}
|
|
379
|
-
})).addCommand(
|
|
401
|
+
})).addCommand(createCliCommand("tools").description("List remote GraphRAG MCP tools (cached for 24 hours)").option("--refresh", "Force refresh schema cache").action(async (opts) => {
|
|
380
402
|
try {
|
|
381
403
|
const { loadSchema, saveSchema } = await import("./schema-cache-DJdU4MIP.mjs");
|
|
382
404
|
const { formatToolsTable } = await import("./format-DB2IH2U5.mjs");
|
|
383
|
-
const { visibleRemoteTools } = await import("./tool-visibility-
|
|
405
|
+
const { visibleRemoteTools } = await import("./tool-visibility-wDMzmHU-.mjs").then((n) => n.i);
|
|
384
406
|
const { loadConfig } = await import("./config-DbbPiGk0.mjs").then((n) => n.t);
|
|
385
407
|
const { createConfiguredGraphMcpFetch, resolveGraphMcpEndpoint } = await import("./client-CHYskPnG.mjs").then((n) => n.r);
|
|
386
408
|
const config = await loadConfig();
|
|
@@ -407,25 +429,12 @@ program.command("mcp").description("Interact with the Chain Insights MCP endpoin
|
|
|
407
429
|
console.error(err.message);
|
|
408
430
|
process.exit(1);
|
|
409
431
|
}
|
|
410
|
-
}))
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
const { addressRisk } = await import("./public-tools-CpOLkME5.mjs");
|
|
414
|
-
const result = await addressRisk(client, {
|
|
415
|
-
address: opts.address,
|
|
416
|
-
network: opts.network,
|
|
417
|
-
compareAddress: opts.compareAddress
|
|
418
|
-
});
|
|
419
|
-
console.log(result.summaryText);
|
|
420
|
-
});
|
|
421
|
-
} catch (err) {
|
|
422
|
-
console.error(err.message);
|
|
423
|
-
process.exit(1);
|
|
424
|
-
}
|
|
425
|
-
})).addCommand(new Command("call").description("Call an MCP tool directly (debug)").argument("<tool>", "Tool name to call").argument("[args...]", "Key=value arguments (e.g. address=0x1234... network=robinhood)").action(async (tool, rawArgs) => {
|
|
432
|
+
}));
|
|
433
|
+
addAmlAddressRiskCommand(mcpCommand, "cia mcp networks");
|
|
434
|
+
mcpCommand.addCommand(createCliCommand("call").description("Call an MCP tool directly (debug)").argument("<tool>", "Tool name to call").argument("[args...]", "Key=value arguments (e.g. address=0x1234... network=robinhood)").action(async (tool, rawArgs) => {
|
|
426
435
|
try {
|
|
427
436
|
const { parseMcpCallArgs } = await import("./call-args-ysbB_xdA.mjs");
|
|
428
|
-
const { assertPublicMcpToolName, validatePublicMcpToolArguments } = await import("./tool-visibility-
|
|
437
|
+
const { assertPublicMcpToolName, validatePublicMcpToolArguments } = await import("./tool-visibility-wDMzmHU-.mjs").then((n) => n.i);
|
|
429
438
|
const args = parseMcpCallArgs(rawArgs);
|
|
430
439
|
assertPublicMcpToolName(tool);
|
|
431
440
|
validatePublicMcpToolArguments(tool, args);
|
|
@@ -473,7 +482,8 @@ program.command("mcp").description("Interact with the Chain Insights MCP endpoin
|
|
|
473
482
|
}));
|
|
474
483
|
});
|
|
475
484
|
} catch (err) {
|
|
476
|
-
|
|
485
|
+
const { formatMcpCallError } = await import("./tool-visibility-wDMzmHU-.mjs").then((n) => n.i);
|
|
486
|
+
console.error(formatMcpCallError(tool, err));
|
|
477
487
|
process.exit(1);
|
|
478
488
|
}
|
|
479
489
|
}));
|
package/dist/cli.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.mjs","names":[],"sources":["../src/mcp/print-result.ts","../src/cli.ts"],"sourcesContent":["export interface McpTextResult {\n content?: Array<{ type: string; text?: string }>\n isError?: boolean\n}\n\n/**\n * Prints the text blocks of an MCP tool result to stdout. When the result is\n * flagged `isError`, throws with the tool's error text instead — MCP `callTool`\n * returns tool errors as ordinary results (it does not reject), so callers must\n * surface them as failures (non-zero exit) rather than printing to stdout and\n * exiting 0.\n */\nexport function printMcpTextContent(result: McpTextResult): void {\n const texts = (result.content ?? [])\n .filter((item) => item.type === 'text')\n .map((item) => item.text ?? '')\n\n if (result.isError) {\n throw new Error(texts.join('\\n').trim() || 'MCP tool returned an error')\n }\n\n for (const text of texts) console.log(text)\n}\n","import { Command, Option } from 'commander'\nimport { execFileSync } from 'node:child_process'\nimport { fileURLToPath } from 'node:url'\nimport path from 'node:path'\nimport { PACKAGE_INFO, PACKAGE_VERSION } from './version.js'\nimport { printMcpTextContent } from './mcp/print-result.js'\n\n// Resolve bin/install.cjs relative to this file's location in dist/\nconst __dirname = path.dirname(fileURLToPath(import.meta.url))\nconst installerPath = path.resolve(__dirname, '..', 'bin', 'install.cjs')\n\nconst program = new Command()\n\nprogram\n .name('cia')\n .description('AML investigation toolkit for blockchain analysis')\n .version(PACKAGE_INFO.version)\n .option('--claude', 'Install Claude Code skills globally to ~/.claude/skills/')\n .option('--codex', 'Install Codex skills globally to ~/.codex/skills/ and register MCP')\n .option(\n '--hermes',\n 'Install Hermes skills globally to ~/.hermes/skills/chain-insights/ and register MCP'\n )\n\n// Handle installer flags when invoked with no subcommand (bare `chain-insights --claude`)\nconst rawArgs = process.argv.slice(2)\nconst installerFlags = rawArgs.filter(\n (a) => a === '--claude' || a === '--codex' || a === '--hermes'\n)\n// A help/version request must never trigger a global install side effect — let\n// commander handle it and print help/version instead.\nconst wantsHelpOrVersion = rawArgs.some(\n (a) => a === '--help' || a === '-h' || a === '--version' || a === '-V'\n)\nif (installerFlags.length > 0 && !wantsHelpOrVersion && !rawArgs.some((a) => !a.startsWith('-'))) {\n try {\n execFileSync(process.execPath, [installerPath, ...installerFlags], { stdio: 'inherit' })\n } catch (err) {\n console.error('Installation failed:', (err as Error).message)\n process.exit(1)\n }\n process.exit(0)\n}\n\n// Legacy mcp aliases for retired graph tools are not commands; reject them\n// before Commander can mis-parse them. Members are built by concatenation so\n// retired names never appear as literal source strings.\nconst retiredMcpAliases = new Set([['trace', '-funds'].join(''), ['track', '-funds'].join('')])\nif (rawArgs[0] === 'mcp' && retiredMcpAliases.has(rawArgs[1] ?? '')) {\n console.error(`error: unknown command '${rawArgs[1]}'`)\n process.exit(1)\n}\n\nfunction runInstaller(flag: '--claude' | '--codex' | '--hermes'): void {\n try {\n execFileSync(process.execPath, [installerPath, flag], { stdio: 'inherit' })\n } catch (err) {\n console.error('Installation failed:', (err as Error).message)\n process.exit(1)\n }\n}\n\nasync function withGraphMcpClient<T>(\n name: string,\n fn: (\n client: import('@modelcontextprotocol/sdk/client/index.js').Client,\n config: Awaited<ReturnType<typeof import('./config/index.js').loadConfig>>\n ) => Promise<T>\n): Promise<T> {\n const { loadConfig } = await import('./config/index.js')\n const config = await loadConfig()\n const { createConfiguredGraphMcpFetch, resolveGraphMcpEndpoint } = await import('./mcp/client.js')\n const paymentFetch = await createConfiguredGraphMcpFetch(config)\n const { Client } = await import('@modelcontextprotocol/sdk/client/index.js')\n const { StreamableHTTPClientTransport } =\n await import('@modelcontextprotocol/sdk/client/streamableHttp.js')\n const client = new Client({ name, version: PACKAGE_VERSION })\n await client.connect(\n new StreamableHTTPClientTransport(new URL(resolveGraphMcpEndpoint(config)), {\n fetch: paymentFetch,\n })\n )\n // Every CLI command builds its own client, separate from the MCP proxy's\n // one, so unattended scheduled CLI runs also write to the action log.\n const { installActionLogging } = await import('./mcp/action-log.js')\n installActionLogging(client)\n try {\n return await fn(client, config)\n } finally {\n await client.close()\n }\n}\n\nasync function printNetworkCapabilities(opts: { json?: boolean }): Promise<void> {\n const { loadConfig } = await import('./config/index.js')\n const { fetchNetworkCapabilities, formatNetworkCapabilities } =\n await import('./mcp/capabilities.js')\n const document = await fetchNetworkCapabilities(await loadConfig())\n if (opts.json) {\n console.log(JSON.stringify(document, null, 2))\n } else {\n console.log(formatNetworkCapabilities(document))\n }\n}\n\nasync function printNetworkOverview(opts: { json?: boolean }): Promise<void> {\n const { loadConfig } = await import('./config/index.js')\n const { fetchNetworkCapabilities, formatNetworkOverview } = await import('./mcp/capabilities.js')\n const document = await fetchNetworkCapabilities(await loadConfig())\n if (opts.json) {\n console.log(JSON.stringify(document, null, 2))\n } else {\n console.log(formatNetworkOverview(document))\n }\n}\n\nasync function printNetworkCapability(name: string, opts: { json?: boolean }): Promise<void> {\n const { loadConfig } = await import('./config/index.js')\n const { fetchNetworkCapabilities, findNetworkCapability, formatNetworkCapability } =\n await import('./mcp/capabilities.js')\n const document = await fetchNetworkCapabilities(await loadConfig())\n const network = findNetworkCapability(document, name)\n if (!network) {\n const available = document.networks.map((candidate) => candidate.network).join(', ')\n const suffix = available ? ` Available networks: ${available}.` : ''\n throw new Error(\n `Network \"${name}\" is not supported.${suffix} Run \\`cia networks\\` to list supported networks.`\n )\n }\n if (opts.json) {\n console.log(JSON.stringify(network, null, 2))\n } else {\n console.log(formatNetworkCapability(network))\n }\n}\n\nprogram\n .command('networks')\n .description('Show supported network status and dataset overview')\n .option('--json', 'Print raw capability JSON')\n .action(async (opts: { json?: boolean }) => {\n try {\n await printNetworkOverview(opts)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n\nprogram\n .command('network')\n .description('Show details for one supported graph network')\n .argument('<name>', 'Network identifier or display name (for example: robinhood)')\n .option('--json', 'Print raw capability JSON for this network')\n .action(async (name: string, opts: { json?: boolean }) => {\n try {\n await printNetworkCapability(name, opts)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n\nprogram\n .command('status')\n .description('Show toolkit status and configuration')\n .action(async () => {\n const { loadConfig } = await import('./config/index.js')\n const config = await loadConfig()\n const graphMcpStatus =\n config.graphMcpMode === 'debug' && config.graphMcpAuthToken?.trim()\n ? 'bearer access mode'\n : `${config.graphMcpMode} mode`\n console.log('Config: ', config.dataDir)\n console.log('Chain Insights Graph:', graphMcpStatus)\n console.log('Graph endpoint:', config.graphMcpEndpoint)\n })\n\nprogram\n .command('update')\n .description('Check npmjs for a newer Chain Insights release and update this CLI')\n .option('--check', 'Only check for a newer release')\n .option('--dry-run', 'Print the update command without running it')\n .action(async (opts: { check?: boolean; dryRun?: boolean }) => {\n try {\n const { checkForUpdate, runPackageUpdate } = await import('./update.js')\n const result = await checkForUpdate()\n if (result.error) {\n throw new Error(`Could not check npmjs for updates: ${result.error}`)\n }\n if (!result.updateAvailable || !result.latestVersion) {\n console.log(`Chain Insights is up to date (${result.currentVersion}).`)\n return\n }\n\n console.log(\n `Chain Insights ${result.latestVersion} is available (current ${result.currentVersion}).`\n )\n if (opts.check) {\n console.log(`Run: ${result.updateCommand}`)\n return\n }\n if (opts.dryRun) {\n console.log(`Would run: ${result.updateCommand}`)\n return\n }\n\n console.log(`Running: ${result.updateCommand}`)\n runPackageUpdate(result.packageName)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n\nprogram\n .command('debug')\n .description('Configure Chain Insights Graph debug mode')\n .addCommand(\n new Command('on')\n .description('Enable Chain Insights Graph debug mode without x402 payments')\n .requiredOption('--token <token>', 'Debug bearer token')\n .option('--endpoint <url>', 'Chain Insights Graph endpoint')\n .action(async (opts: { token: string; endpoint?: string }) => {\n try {\n const { saveConfig } = await import('./config/index.js')\n await saveConfig({\n graphMcpMode: 'debug',\n graphMcpAuthToken: opts.token,\n ...(opts.endpoint ? { graphMcpEndpoint: opts.endpoint } : {}),\n })\n console.log('Chain Insights Graph debug mode enabled')\n if (opts.endpoint) console.log(`Graph endpoint: ${opts.endpoint}`)\n console.log('Payments: disabled for Chain Insights Graph calls')\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('off')\n .description('Disable Chain Insights Graph debug mode and use paid x402 calls')\n .action(async () => {\n try {\n const { saveConfig } = await import('./config/index.js')\n await saveConfig({ graphMcpMode: 'paid', graphMcpAuthToken: '' })\n console.log('Chain Insights Graph debug mode disabled')\n console.log('Payments: enabled for Chain Insights Graph calls')\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('status')\n .description('Show Chain Insights Graph payment/debug mode')\n .action(async () => {\n try {\n const { loadConfig } = await import('./config/index.js')\n const config = await loadConfig()\n console.log(`Chain Insights Graph mode: ${config.graphMcpMode}`)\n console.log(`Graph endpoint: ${config.graphMcpEndpoint}`)\n console.log(\n `Debug token: ${config.graphMcpAuthToken?.trim() ? 'configured' : 'not configured'}`\n )\n console.log(`Payments: ${config.graphMcpMode === 'debug' ? 'disabled' : 'enabled'}`)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n\nprogram\n .command('access-key')\n .description('Configure Chain Insights Graph test access key mode')\n .addCommand(\n new Command('set')\n .description('Use a Chain Insights Graph test access key without x402 payments')\n .argument('<key>', 'Test access key')\n .option('--endpoint <url>', 'Chain Insights Graph endpoint')\n .action(async (key: string, opts: { endpoint?: string }) => {\n try {\n const normalizedKey = key.trim()\n if (!normalizedKey) throw new Error('Test access key is required')\n const { saveConfig } = await import('./config/index.js')\n await saveConfig({\n graphMcpMode: 'debug',\n graphMcpAuthToken: normalizedKey,\n ...(opts.endpoint ? { graphMcpEndpoint: opts.endpoint } : {}),\n })\n console.log('Chain Insights Graph test access key configured')\n if (opts.endpoint) console.log(`Graph endpoint: ${opts.endpoint}`)\n console.log('Payments: disabled when the server accepts this key')\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('clear')\n .description('Remove the Chain Insights Graph test access key and use paid x402 calls')\n .action(async () => {\n try {\n const { saveConfig } = await import('./config/index.js')\n await saveConfig({ graphMcpMode: 'paid', graphMcpAuthToken: '' })\n console.log('Chain Insights Graph test access key cleared')\n console.log('Payments: enabled for Chain Insights Graph calls')\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('status')\n .description('Show Chain Insights Graph test access key status')\n .action(async () => {\n try {\n const { loadConfig } = await import('./config/index.js')\n const config = await loadConfig()\n console.log(`Graph endpoint: ${config.graphMcpEndpoint}`)\n console.log(\n `Access key: ${config.graphMcpAuthToken?.trim() ? 'configured' : 'not configured'}`\n )\n console.log(\n `Payments: ${config.graphMcpAuthToken?.trim() ? 'disabled when accepted by server' : 'enabled'}`\n )\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n\nprogram\n .command('setup')\n .description('Configure external MCP clients')\n .addCommand(\n new Command('claude-code')\n .alias('claude')\n .description('Install Claude Code skills and register the MCP proxy')\n .action(() => {\n runInstaller('--claude')\n })\n )\n .addCommand(\n new Command('codex')\n .description('Install Codex skills and register the MCP proxy')\n .action(() => {\n runInstaller('--codex')\n })\n )\n .addCommand(\n new Command('hermes')\n .description('Install Hermes skills and register the MCP proxy')\n .action(() => {\n runInstaller('--hermes')\n })\n )\n\nprogram\n .command('config')\n .description('Read or write configuration values')\n .addCommand(\n new Command('get').argument('<key>', 'Config key to read').action(async (key: string) => {\n const { loadConfig } = await import('./config/index.js')\n const { CONFIG_KEYS } = await import('./config/schema.js')\n if (!CONFIG_KEYS.includes(key as (typeof CONFIG_KEYS)[number])) {\n console.error(`Unknown config key: ${key}`)\n process.exit(1)\n }\n const config = await loadConfig()\n const value = (config as Record<string, unknown>)[key]\n console.log(value ?? '')\n })\n )\n .addCommand(\n new Command('set')\n .argument('<key>', 'Config key to write')\n .argument('<value>', 'Value to set')\n .action(async (key: string, value: string) => {\n // D-01: walletPrivateKey is intercepted before saveConfig — the raw private key\n // must NEVER be written to config.json.\n if (key === 'walletPrivateKey') {\n try {\n const { setWalletPrivateKey } = await import('./wallet/index.js')\n const address = await setWalletPrivateKey(value)\n console.log('Wallet private key encrypted and stored in ~/.chain-insights/wallet.json')\n console.log(`Wallet address: ${address}`)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n return // MUST return — walletPrivateKey must never reach saveConfig or config.json\n }\n const { loadConfig, saveConfig } = await import('./config/index.js')\n const { CONFIG_KEYS, DEFAULT_CONFIG } = await import('./config/schema.js')\n const current = await loadConfig()\n if (!CONFIG_KEYS.includes(key as (typeof CONFIG_KEYS)[number])) {\n console.error(`Unknown config key: ${key}`)\n process.exit(1)\n }\n const existing = (current as Record<string, unknown>)[key]\n const defaultValue = (DEFAULT_CONFIG as Record<string, unknown>)[key]\n const coerced =\n typeof existing === 'number' || typeof defaultValue === 'number' ? Number(value) : value\n await saveConfig({ [key]: coerced } as Parameters<typeof saveConfig>[0])\n const displayed = key.toLowerCase().includes('token') ? '[redacted]' : coerced\n console.log(`Set ${key} = ${displayed}`)\n })\n )\n\nprogram\n .command('wallet')\n .description('Manage the local Base USDC payment wallet')\n .addCommand(\n new Command('create')\n .description('Generate a new local Base payment wallet')\n .action(async () => {\n try {\n const { isWalletConfigured, setWalletPrivateKey, walletPath } =\n await import('./wallet/index.js')\n const { createInterface } = await import('node:readline/promises')\n const { formatWalletBackupWarning, generateWalletPrivateKey, isWalletBackupConfirmed } =\n await import('./wallet/create.js')\n\n if (await isWalletConfigured()) {\n throw new Error(\n 'A payment wallet already exists. Run `cia wallet address` to view it or use `cia wallet import <private-key> --force` to replace it.'\n )\n }\n\n const privateKey = generateWalletPrivateKey()\n const color = process.stderr.isTTY === true && process.env['NO_COLOR'] === undefined\n process.stderr.write(`${formatWalletBackupWarning(privateKey, { color })}\\n`)\n const prompt = createInterface({ input: process.stdin, output: process.stderr })\n let answer: string\n try {\n answer = await prompt.question('> ')\n } finally {\n prompt.close()\n }\n process.stderr.write('\\n')\n if (!isWalletBackupConfirmed(answer)) {\n throw new Error('Wallet creation cancelled. The wallet was not saved.')\n }\n\n const address = await setWalletPrivateKey(privateKey)\n console.log(`Wallet created: ${address}`)\n console.log(`Encrypted local copy: ${walletPath()}`)\n console.log('Next: cia wallet ready')\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('import')\n .description('Import a Base payment wallet')\n .argument('<private-key>', '0x-prefixed EVM private key')\n .option(\n '--force',\n 'Replace an existing wallet (the previous key is backed up next to wallet.json)'\n )\n .action(async (privateKey: string, opts: { force?: boolean }) => {\n try {\n const { setWalletPrivateKey, isWalletConfigured } = await import('./wallet/index.js')\n const replacing = opts.force === true && (await isWalletConfigured())\n const address = await setWalletPrivateKey(privateKey, { force: opts.force })\n if (replacing) {\n console.log('Previous wallet key backed up next to ~/.chain-insights/wallet.json')\n }\n console.log(`Wallet imported: ${address}`)\n console.log(\n 'Keep your original private key backed up securely; it cannot be recovered from the encrypted local copy.'\n )\n console.log('Encrypted local copy: ~/.chain-insights/wallet.json')\n console.log('Next: cia wallet ready')\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('address')\n .description('Print the local payment wallet address')\n .action(async () => {\n try {\n const { getWalletAccount } = await import('./wallet/tools.js')\n const account = await getWalletAccount()\n console.log(account.address)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('balance')\n .description('Show the local payment wallet Base USDC balance')\n .action(async () => {\n try {\n const { getWalletBalanceText } = await import('./wallet/tools.js')\n console.log(await getWalletBalanceText())\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('ready')\n .description('Check and prepare the wallet for paid Chain Insights Graph calls')\n .option('--check-only', 'Only check readiness; do not submit the one-time payment setup')\n .addOption(new Option('--no-approve', 'Deprecated alias for --check-only').hideHelp())\n .option('--payment-usdc <amount>', 'USDC setup cap to prepare for paid calls', '1')\n .addOption(\n new Option('--approval-usdc <amount>', 'Deprecated alias for --payment-usdc').hideHelp()\n )\n .option('--json', 'Print machine-readable readiness metadata')\n .action(\n async (opts: {\n checkOnly?: boolean\n approve?: boolean\n paymentUsdc?: string\n approvalUsdc?: string\n json?: boolean\n }) => {\n try {\n const { formatWalletReadiness, parsePaymentApprovalUnits, prepareWalletForPaidCalls } =\n await import('./wallet/tools.js')\n const minimumApprovalUnits = parsePaymentApprovalUnits(\n opts.paymentUsdc ?? opts.approvalUsdc ?? '1'\n )\n const result = await prepareWalletForPaidCalls({\n minimumApprovalUnits,\n approve: opts.checkOnly ? false : opts.approve !== false,\n })\n\n if (opts.json) {\n console.log(\n JSON.stringify(\n result,\n (_key, value) => (typeof value === 'bigint' ? value.toString() : value),\n 2\n )\n )\n return\n }\n\n console.log(formatWalletReadiness(result.readiness, result.approval))\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n }\n )\n )\n .addCommand(\n new Command('topup')\n .description('Open a local browser page to top up the payment wallet')\n .option('--no-open', 'Print the top-up URL without opening a browser')\n .option('--json', 'Print machine-readable top-up metadata')\n .action(async (opts: { open?: boolean; json?: boolean }) => {\n try {\n const { buildTopupInfo, getWalletAccount } = await import('./wallet/tools.js')\n const { startTopupServer } = await import('./wallet/topup-server.js')\n const account = await getWalletAccount()\n const url = await startTopupServer(account)\n const info = buildTopupInfo(account.address, url)\n\n if (opts.json) {\n console.log(JSON.stringify(info, null, 2))\n } else {\n console.log(`Top-up URL: ${url}`)\n console.log(`Wallet: ${account.address}`)\n console.log('Network: Base')\n console.log('Token: USDC')\n console.log('Press Ctrl+C to stop the top-up server.')\n }\n\n if (opts.open !== false) {\n const open = (await import('open')).default\n await open(url)\n }\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n\nprogram\n .command('mcp')\n .description('Interact with the Chain Insights MCP endpoint')\n .allowExcessArguments(false)\n .addCommand(\n new Command('networks')\n .description('List the detailed Chain Insights capability matrix and tool support')\n .option('--json', 'Print raw capability JSON')\n .action(async (opts: { json?: boolean }) => {\n try {\n await printNetworkCapabilities(opts)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('tools')\n .description('List remote GraphRAG MCP tools (cached for 24 hours)')\n .option('--refresh', 'Force refresh schema cache')\n .action(async (opts: { refresh?: boolean }) => {\n try {\n const { loadSchema, saveSchema } = await import('./mcp/schema-cache.js')\n const { formatToolsTable } = await import('./mcp/format.js')\n const { visibleRemoteTools } = await import('./mcp/tool-visibility.js')\n const { loadConfig } = await import('./config/index.js')\n const { createConfiguredGraphMcpFetch, resolveGraphMcpEndpoint } =\n await import('./mcp/client.js')\n const config = await loadConfig()\n const graphMcpEndpoint = resolveGraphMcpEndpoint(config)\n let tools = opts.refresh ? null : await loadSchema(graphMcpEndpoint)\n if (!tools) {\n const paymentFetch = await createConfiguredGraphMcpFetch(config)\n const { Client } = await import('@modelcontextprotocol/sdk/client/index.js')\n const { StreamableHTTPClientTransport } =\n await import('@modelcontextprotocol/sdk/client/streamableHttp.js')\n const client = new Client({ name: 'chain-insights-cli', version: PACKAGE_VERSION })\n await client.connect(\n new StreamableHTTPClientTransport(new URL(graphMcpEndpoint), { fetch: paymentFetch })\n )\n try {\n const result = await client.listTools()\n tools = result.tools as Array<{ name: string; description?: string }>\n await saveSchema(tools, graphMcpEndpoint)\n } finally {\n await client.close()\n }\n }\n console.log(formatToolsTable(visibleRemoteTools(tools)))\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('aml-address-risk')\n .description(\n 'Screen an address for AML risk, exchange behavior, and optional comparison with another address'\n )\n .requiredOption('--address <address>', 'Full blockchain address to screen')\n .requiredOption(\n '--network <network>',\n 'Network to query. Run `cia mcp networks` for supported networks.'\n )\n .option(\n '--compare-address <address>',\n 'Optional second address to compare against the screened address'\n )\n .action(async (opts: { address: string; network: string; compareAddress?: string }) => {\n try {\n await withGraphMcpClient('chain-insights-cli-aml-address-risk', async (client) => {\n const { addressRisk } = await import('./investigation/public-tools.js')\n const result = await addressRisk(client, {\n address: opts.address,\n network: opts.network,\n compareAddress: opts.compareAddress,\n })\n console.log(result.summaryText)\n })\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n new Command('call')\n .description('Call an MCP tool directly (debug)')\n .argument('<tool>', 'Tool name to call')\n .argument('[args...]', 'Key=value arguments (e.g. address=0x1234... network=robinhood)')\n .action(async (tool: string, rawArgs: string[]) => {\n try {\n const { parseMcpCallArgs } = await import('./mcp/call-args.js')\n const { assertPublicMcpToolName, validatePublicMcpToolArguments } =\n await import('./mcp/tool-visibility.js')\n const args = parseMcpCallArgs(rawArgs)\n assertPublicMcpToolName(tool)\n validatePublicMcpToolArguments(tool, args)\n\n if (tool === 'wallet_balance') {\n const { getWalletBalanceText } = await import('./wallet/tools.js')\n console.log(await getWalletBalanceText())\n return\n }\n\n if (tool === 'meta_network_capabilities') {\n await printNetworkCapabilities({ json: true })\n return\n }\n\n if (tool === 'meta_help') {\n console.log(\n 'Chain Insights tools: aml_*, graph_query, graph_query_batch, meta_*, and wallet_balance.'\n )\n return\n }\n\n await withGraphMcpClient('chain-insights-cli-call', async (client, config) => {\n if (tool === 'meta_usage_status') {\n try {\n const result = await client.callTool({ name: 'usage_status', arguments: {} })\n printMcpTextContent(result as { content?: Array<{ type: string; text?: string }> })\n } catch (err) {\n const {\n isMissingUsageStatusToolError,\n primitiveBackendUsageStatus,\n usageStatusText,\n } = await import('./mcp/usage-status.js')\n if (!isMissingUsageStatusToolError(err)) throw err\n const { resolveGraphMcpEndpoint } = await import('./mcp/client.js')\n console.log(\n usageStatusText(primitiveBackendUsageStatus(resolveGraphMcpEndpoint(config)))\n )\n }\n return\n }\n if (tool === 'aml_address_risk') {\n const { addressRisk } = await import('./investigation/public-tools.js')\n const result = await addressRisk(client, {\n address: String(args['address'] ?? ''),\n network: String(args['network'] ?? ''),\n compareAddress:\n args['compare_address'] === undefined\n ? undefined\n : String(args['compare_address']),\n })\n console.log(result.summaryText)\n return\n }\n const result = await client.callTool({ name: tool, arguments: args })\n printMcpTextContent(result as { content?: Array<{ type: string; text?: string }> })\n })\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n\n// parseAsync (not parse) so a rejected async action surfaces as a clean\n// one-line error and a non-zero exit, instead of an unhandled-rejection stack\n// trace. Commands with their own try/catch still exit(1) before this fires.\nprogram.parseAsync(process.argv).catch((err) => {\n console.error((err as Error).message)\n process.exit(1)\n})\n"],"mappings":";;;;;;;;;;;;;AAYA,SAAgB,oBAAoB,QAA6B;CAC/D,MAAM,SAAS,OAAO,WAAW,CAAC,EAAA,CAC/B,QAAQ,SAAS,KAAK,SAAS,MAAM,CAAC,CACtC,KAAK,SAAS,KAAK,QAAQ,EAAE;CAEhC,IAAI,OAAO,SACT,MAAM,IAAI,MAAM,MAAM,KAAK,IAAI,CAAC,CAAC,KAAK,KAAK,4BAA4B;CAGzE,KAAK,MAAM,QAAQ,OAAO,QAAQ,IAAI,IAAI;AAC5C;;;ACdA,MAAM,YAAY,KAAK,QAAQ,cAAc,YAAY,GAAG,CAAC;AAC7D,MAAM,gBAAgB,KAAK,QAAQ,WAAW,MAAM,OAAO,aAAa;AAExE,MAAM,UAAU,IAAI,QAAQ;AAE5B,QACG,KAAK,KAAK,CAAC,CACX,YAAY,mDAAmD,CAAC,CAChE,QAAQ,aAAa,OAAO,CAAC,CAC7B,OAAO,YAAY,0DAA0D,CAAC,CAC9E,OAAO,WAAW,oEAAoE,CAAC,CACvF,OACC,YACA,qFACF;AAGF,MAAM,U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S,OAAO,KAAK,cAAc,EAAE;KACrC,SAAS,OAAO,KAAK,cAAc,EAAE;KACrC,gBACE,KAAK,uBAAuB,KAAA,IACxB,KAAA,IACA,OAAO,KAAK,kBAAkB;IACtC,CAAC;IACD,QAAQ,IAAI,OAAO,WAAW;IAC9B;GACF;GAEA,oBAAoB,MADC,OAAO,SAAS;IAAE,MAAM;IAAM,WAAW;GAAK,CAAC,CACc;EACpF,CAAC;CACH,SAAS,KAAK;EACZ,QAAQ,MAAO,IAAc,OAAO;EACpC,QAAQ,KAAK,CAAC;CAChB;AACF,CAAC,CACL;AAKF,QAAQ,WAAW,QAAQ,IAAI,CAAC,CAAC,OAAO,QAAQ;CAC9C,QAAQ,MAAO,IAAc,OAAO;CACpC,QAAQ,KAAK,CAAC;AAChB,CAAC"}
|
|
1
|
+
{"version":3,"file":"cli.mjs","names":[],"sources":["../src/mcp/print-result.ts","../src/cli.ts"],"sourcesContent":["export interface McpTextResult {\n content?: Array<{ type: string; text?: string }>\n isError?: boolean\n}\n\n/**\n * Prints the text blocks of an MCP tool result to stdout. When the result is\n * flagged `isError`, throws with the tool's error text instead — MCP `callTool`\n * returns tool errors as ordinary results (it does not reject), so callers must\n * surface them as failures (non-zero exit) rather than printing to stdout and\n * exiting 0.\n */\nexport function printMcpTextContent(result: McpTextResult): void {\n const texts = (result.content ?? [])\n .filter((item) => item.type === 'text')\n .map((item) => item.text ?? '')\n\n if (result.isError) {\n throw new Error(texts.join('\\n').trim() || 'MCP tool returned an error')\n }\n\n for (const text of texts) console.log(text)\n}\n","import { Command, Option } from 'commander'\nimport { execFileSync } from 'node:child_process'\nimport { fileURLToPath } from 'node:url'\nimport path from 'node:path'\nimport { PACKAGE_INFO, PACKAGE_VERSION } from './version.js'\nimport { printMcpTextContent } from './mcp/print-result.js'\n\n// Resolve bin/install.cjs relative to this file's location in dist/\nconst __dirname = path.dirname(fileURLToPath(import.meta.url))\nconst installerPath = path.resolve(__dirname, '..', 'bin', 'install.cjs')\n\nconst program = new Command()\n\nfunction createCliCommand(name: string): Command {\n return new Command(name).showHelpAfterError()\n}\n\nprogram\n .name('cia')\n .description('AML investigation toolkit for blockchain analysis')\n .version(PACKAGE_INFO.version)\n .showHelpAfterError()\n .option('--claude', 'Install Claude Code skills globally to ~/.claude/skills/')\n .option('--codex', 'Install Codex skills globally to ~/.codex/skills/ and register MCP')\n .option(\n '--hermes',\n 'Install Hermes skills globally to ~/.hermes/skills/chain-insights/ and register MCP'\n )\n\n// Handle installer flags when invoked with no subcommand (bare `chain-insights --claude`)\nconst rawArgs = process.argv.slice(2)\nconst installerFlags = rawArgs.filter(\n (a) => a === '--claude' || a === '--codex' || a === '--hermes'\n)\n// A help/version request must never trigger a global install side effect — let\n// commander handle it and print help/version instead.\nconst wantsHelpOrVersion = rawArgs.some(\n (a) => a === '--help' || a === '-h' || a === '--version' || a === '-V'\n)\nif (installerFlags.length > 0 && !wantsHelpOrVersion && !rawArgs.some((a) => !a.startsWith('-'))) {\n try {\n execFileSync(process.execPath, [installerPath, ...installerFlags], { stdio: 'inherit' })\n } catch (err) {\n console.error('Installation failed:', (err as Error).message)\n process.exit(1)\n }\n process.exit(0)\n}\n\n// Legacy mcp aliases for retired graph tools are not commands; reject them\n// before Commander can mis-parse them. Members are built by concatenation so\n// retired names never appear as literal source strings.\nconst retiredMcpAliases = new Set([['trace', '-funds'].join(''), ['track', '-funds'].join('')])\nif (rawArgs[0] === 'mcp' && retiredMcpAliases.has(rawArgs[1] ?? '')) {\n console.error(`error: unknown command '${rawArgs[1]}'`)\n process.exit(1)\n}\n\nfunction runInstaller(flag: '--claude' | '--codex' | '--hermes'): void {\n try {\n execFileSync(process.execPath, [installerPath, flag], { stdio: 'inherit' })\n } catch (err) {\n console.error('Installation failed:', (err as Error).message)\n process.exit(1)\n }\n}\n\nasync function withGraphMcpClient<T>(\n name: string,\n fn: (\n client: import('@modelcontextprotocol/sdk/client/index.js').Client,\n config: Awaited<ReturnType<typeof import('./config/index.js').loadConfig>>\n ) => Promise<T>\n): Promise<T> {\n const { loadConfig } = await import('./config/index.js')\n const config = await loadConfig()\n const { createConfiguredGraphMcpFetch, resolveGraphMcpEndpoint } = await import('./mcp/client.js')\n const paymentFetch = await createConfiguredGraphMcpFetch(config)\n const { Client } = await import('@modelcontextprotocol/sdk/client/index.js')\n const { StreamableHTTPClientTransport } =\n await import('@modelcontextprotocol/sdk/client/streamableHttp.js')\n const client = new Client({ name, version: PACKAGE_VERSION })\n await client.connect(\n new StreamableHTTPClientTransport(new URL(resolveGraphMcpEndpoint(config)), {\n fetch: paymentFetch,\n })\n )\n // Every CLI command builds its own client, separate from the MCP proxy's\n // one, so unattended scheduled CLI runs also write to the action log.\n const { installActionLogging } = await import('./mcp/action-log.js')\n installActionLogging(client)\n try {\n return await fn(client, config)\n } finally {\n await client.close()\n }\n}\n\nasync function printNetworkCapabilities(opts: { json?: boolean }): Promise<void> {\n const { loadConfig } = await import('./config/index.js')\n const { fetchNetworkCapabilities, formatNetworkCapabilities } =\n await import('./mcp/capabilities.js')\n const document = await fetchNetworkCapabilities(await loadConfig())\n if (opts.json) {\n console.log(JSON.stringify(document, null, 2))\n } else {\n console.log(formatNetworkCapabilities(document))\n }\n}\n\nasync function printNetworkOverview(opts: { json?: boolean }): Promise<void> {\n const { loadConfig } = await import('./config/index.js')\n const { fetchNetworkCapabilities, formatNetworkOverview } = await import('./mcp/capabilities.js')\n const document = await fetchNetworkCapabilities(await loadConfig())\n if (opts.json) {\n console.log(JSON.stringify(document, null, 2))\n } else {\n console.log(formatNetworkOverview(document))\n }\n}\n\nasync function printNetworkCapability(name: string, opts: { json?: boolean }): Promise<void> {\n const { loadConfig } = await import('./config/index.js')\n const { fetchNetworkCapabilities, findNetworkCapability, formatNetworkCapability } =\n await import('./mcp/capabilities.js')\n const document = await fetchNetworkCapabilities(await loadConfig())\n const network = findNetworkCapability(document, name)\n if (!network) {\n const available = document.networks.map((candidate) => candidate.network).join(', ')\n const suffix = available ? ` Available networks: ${available}.` : ''\n throw new Error(\n `Network \"${name}\" is not supported.${suffix} Run \\`cia networks\\` to list supported networks.`\n )\n }\n if (opts.json) {\n console.log(JSON.stringify(network, null, 2))\n } else {\n console.log(formatNetworkCapability(network))\n }\n}\n\nfunction addAmlAddressRiskCommand(parent: Command, networksCommand: string): void {\n parent.addCommand(\n createCliCommand('aml-address-risk')\n .description(\n 'Screen an address for AML risk, exchange behavior, and optional comparison with another address'\n )\n .requiredOption('--address <address>', 'Full blockchain address to screen')\n .requiredOption(\n '--network <network>',\n `Network to query. Run \\`${networksCommand}\\` for supported networks.`\n )\n .option(\n '--compare-address <address>',\n 'Optional second address to compare against the screened address'\n )\n .action(async (opts: { address: string; network: string; compareAddress?: string }) => {\n try {\n await withGraphMcpClient('chain-insights-cli-aml-address-risk', async (client) => {\n const { addressRisk } = await import('./investigation/public-tools.js')\n const result = await addressRisk(client, {\n address: opts.address,\n network: opts.network,\n compareAddress: opts.compareAddress,\n })\n console.log(result.summaryText)\n })\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n}\n\nprogram\n .command('networks')\n .description('Show supported network status and dataset overview')\n .option('--json', 'Print raw capability JSON')\n .action(async (opts: { json?: boolean }) => {\n try {\n await printNetworkOverview(opts)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n\nprogram\n .command('network')\n .description('Show details for one supported graph network')\n .argument('<name>', 'Network identifier or display name (for example: robinhood)')\n .option('--json', 'Print raw capability JSON for this network')\n .action(async (name: string, opts: { json?: boolean }) => {\n try {\n await printNetworkCapability(name, opts)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n\nprogram\n .command('status')\n .description('Show toolkit status and configuration')\n .action(async () => {\n const { loadConfig } = await import('./config/index.js')\n const config = await loadConfig()\n const graphMcpStatus =\n config.graphMcpMode === 'debug' && config.graphMcpAuthToken?.trim()\n ? 'bearer access mode'\n : `${config.graphMcpMode} mode`\n console.log('Config: ', config.dataDir)\n console.log('Chain Insights Graph:', graphMcpStatus)\n console.log('Graph endpoint:', config.graphMcpEndpoint)\n })\n\nprogram\n .command('update')\n .description('Check npmjs for a newer Chain Insights release and update this CLI')\n .option('--check', 'Only check for a newer release')\n .option('--dry-run', 'Print the update command without running it')\n .action(async (opts: { check?: boolean; dryRun?: boolean }) => {\n try {\n const { checkForUpdate, runPackageUpdate } = await import('./update.js')\n const result = await checkForUpdate()\n if (result.error) {\n throw new Error(`Could not check npmjs for updates: ${result.error}`)\n }\n if (!result.updateAvailable || !result.latestVersion) {\n console.log(`Chain Insights is up to date (${result.currentVersion}).`)\n return\n }\n\n console.log(\n `Chain Insights ${result.latestVersion} is available (current ${result.currentVersion}).`\n )\n if (opts.check) {\n console.log(`Run: ${result.updateCommand}`)\n return\n }\n if (opts.dryRun) {\n console.log(`Would run: ${result.updateCommand}`)\n return\n }\n\n console.log(`Running: ${result.updateCommand}`)\n runPackageUpdate(result.packageName)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n\nprogram\n .command('debug')\n .description('Configure Chain Insights Graph debug mode')\n .addCommand(\n createCliCommand('on')\n .description('Enable Chain Insights Graph debug mode without x402 payments')\n .requiredOption('--token <token>', 'Debug bearer token')\n .option('--endpoint <url>', 'Chain Insights Graph endpoint')\n .action(async (opts: { token: string; endpoint?: string }) => {\n try {\n const { saveConfig } = await import('./config/index.js')\n await saveConfig({\n graphMcpMode: 'debug',\n graphMcpAuthToken: opts.token,\n ...(opts.endpoint ? { graphMcpEndpoint: opts.endpoint } : {}),\n })\n console.log('Chain Insights Graph debug mode enabled')\n if (opts.endpoint) console.log(`Graph endpoint: ${opts.endpoint}`)\n console.log('Payments: disabled for Chain Insights Graph calls')\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n createCliCommand('off')\n .description('Disable Chain Insights Graph debug mode and use paid x402 calls')\n .action(async () => {\n try {\n const { saveConfig } = await import('./config/index.js')\n await saveConfig({ graphMcpMode: 'paid', graphMcpAuthToken: '' })\n console.log('Chain Insights Graph debug mode disabled')\n console.log('Payments: enabled for Chain Insights Graph calls')\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n createCliCommand('status')\n .description('Show Chain Insights Graph payment/debug mode')\n .action(async () => {\n try {\n const { loadConfig } = await import('./config/index.js')\n const config = await loadConfig()\n console.log(`Chain Insights Graph mode: ${config.graphMcpMode}`)\n console.log(`Graph endpoint: ${config.graphMcpEndpoint}`)\n console.log(\n `Debug token: ${config.graphMcpAuthToken?.trim() ? 'configured' : 'not configured'}`\n )\n console.log(`Payments: ${config.graphMcpMode === 'debug' ? 'disabled' : 'enabled'}`)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n\nprogram\n .command('access-key')\n .description('Configure Chain Insights Graph test access key mode')\n .addCommand(\n createCliCommand('set')\n .description('Use a Chain Insights Graph test access key without x402 payments')\n .argument('<key>', 'Test access key')\n .option('--endpoint <url>', 'Chain Insights Graph endpoint')\n .action(async (key: string, opts: { endpoint?: string }) => {\n try {\n const normalizedKey = key.trim()\n if (!normalizedKey) throw new Error('Test access key is required')\n const { saveConfig } = await import('./config/index.js')\n await saveConfig({\n graphMcpMode: 'debug',\n graphMcpAuthToken: normalizedKey,\n ...(opts.endpoint ? { graphMcpEndpoint: opts.endpoint } : {}),\n })\n console.log('Chain Insights Graph test access key configured')\n if (opts.endpoint) console.log(`Graph endpoint: ${opts.endpoint}`)\n console.log('Payments: disabled when the server accepts this key')\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n createCliCommand('clear')\n .description('Remove the Chain Insights Graph test access key and use paid x402 calls')\n .action(async () => {\n try {\n const { saveConfig } = await import('./config/index.js')\n await saveConfig({ graphMcpMode: 'paid', graphMcpAuthToken: '' })\n console.log('Chain Insights Graph test access key cleared')\n console.log('Payments: enabled for Chain Insights Graph calls')\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n createCliCommand('status')\n .description('Show Chain Insights Graph test access key status')\n .action(async () => {\n try {\n const { loadConfig } = await import('./config/index.js')\n const config = await loadConfig()\n console.log(`Graph endpoint: ${config.graphMcpEndpoint}`)\n console.log(\n `Access key: ${config.graphMcpAuthToken?.trim() ? 'configured' : 'not configured'}`\n )\n console.log(\n `Payments: ${config.graphMcpAuthToken?.trim() ? 'disabled when accepted by server' : 'enabled'}`\n )\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n\nprogram\n .command('setup')\n .description('Configure external MCP clients')\n .addCommand(\n createCliCommand('claude-code')\n .alias('claude')\n .description('Install Claude Code skills and register the MCP proxy')\n .action(() => {\n runInstaller('--claude')\n })\n )\n .addCommand(\n createCliCommand('codex')\n .description('Install Codex skills and register the MCP proxy')\n .action(() => {\n runInstaller('--codex')\n })\n )\n .addCommand(\n createCliCommand('hermes')\n .description('Install Hermes skills and register the MCP proxy')\n .action(() => {\n runInstaller('--hermes')\n })\n )\n\nprogram\n .command('config')\n .description('Read or write configuration values')\n .addCommand(\n createCliCommand('get')\n .description('Read one Chain Insights configuration value')\n .argument('<key>', 'Config key to read')\n .action(async (key: string) => {\n const { loadConfig } = await import('./config/index.js')\n const { CONFIG_KEYS } = await import('./config/schema.js')\n if (!CONFIG_KEYS.includes(key as (typeof CONFIG_KEYS)[number])) {\n console.error(`Unknown config key: ${key}`)\n process.exit(1)\n }\n const config = await loadConfig()\n const value = (config as Record<string, unknown>)[key]\n console.log(value ?? '')\n })\n )\n .addCommand(\n createCliCommand('set')\n .description('Write one Chain Insights configuration value')\n .argument('<key>', 'Config key to write')\n .argument('<value>', 'Value to set')\n .action(async (key: string, value: string) => {\n // D-01: walletPrivateKey is intercepted before saveConfig — the raw private key\n // must NEVER be written to config.json.\n if (key === 'walletPrivateKey') {\n try {\n const { setWalletPrivateKey } = await import('./wallet/index.js')\n const address = await setWalletPrivateKey(value)\n console.log('Wallet private key encrypted and stored in ~/.chain-insights/wallet.json')\n console.log(`Wallet address: ${address}`)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n return // MUST return — walletPrivateKey must never reach saveConfig or config.json\n }\n const { loadConfig, saveConfig } = await import('./config/index.js')\n const { CONFIG_KEYS, DEFAULT_CONFIG } = await import('./config/schema.js')\n const current = await loadConfig()\n if (!CONFIG_KEYS.includes(key as (typeof CONFIG_KEYS)[number])) {\n console.error(`Unknown config key: ${key}`)\n process.exit(1)\n }\n const existing = (current as Record<string, unknown>)[key]\n const defaultValue = (DEFAULT_CONFIG as Record<string, unknown>)[key]\n const coerced =\n typeof existing === 'number' || typeof defaultValue === 'number' ? Number(value) : value\n await saveConfig({ [key]: coerced } as Parameters<typeof saveConfig>[0])\n const displayed = key.toLowerCase().includes('token') ? '[redacted]' : coerced\n console.log(`Set ${key} = ${displayed}`)\n })\n )\n\nprogram\n .command('wallet')\n .description('Manage the local Base USDC payment wallet')\n .addCommand(\n createCliCommand('create')\n .description('Generate a new local Base payment wallet')\n .action(async () => {\n try {\n const { isWalletConfigured, setWalletPrivateKey, walletPath } =\n await import('./wallet/index.js')\n const { createInterface } = await import('node:readline/promises')\n const { formatWalletBackupWarning, generateWalletPrivateKey, isWalletBackupConfirmed } =\n await import('./wallet/create.js')\n\n if (await isWalletConfigured()) {\n throw new Error(\n 'A payment wallet already exists. Run `cia wallet address` to view it or use `cia wallet import <private-key> --force` to replace it.'\n )\n }\n\n const privateKey = generateWalletPrivateKey()\n const color = process.stderr.isTTY === true && process.env['NO_COLOR'] === undefined\n process.stderr.write(`${formatWalletBackupWarning(privateKey, { color })}\\n`)\n const prompt = createInterface({ input: process.stdin, output: process.stderr })\n let answer: string\n try {\n answer = await prompt.question('> ')\n } finally {\n prompt.close()\n }\n process.stderr.write('\\n')\n if (!isWalletBackupConfirmed(answer)) {\n throw new Error('Wallet creation cancelled. The wallet was not saved.')\n }\n\n const address = await setWalletPrivateKey(privateKey)\n console.log(`Wallet created: ${address}`)\n console.log(`Encrypted local copy: ${walletPath()}`)\n console.log('Next: cia wallet ready')\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n createCliCommand('import')\n .description('Import a Base payment wallet')\n .argument('<private-key>', '0x-prefixed EVM private key')\n .option(\n '--force',\n 'Replace an existing wallet (the previous key is backed up next to wallet.json)'\n )\n .action(async (privateKey: string, opts: { force?: boolean }) => {\n try {\n const { setWalletPrivateKey, isWalletConfigured } = await import('./wallet/index.js')\n const replacing = opts.force === true && (await isWalletConfigured())\n const address = await setWalletPrivateKey(privateKey, { force: opts.force })\n if (replacing) {\n console.log('Previous wallet key backed up next to ~/.chain-insights/wallet.json')\n }\n console.log(`Wallet imported: ${address}`)\n console.log(\n 'Keep your original private key backed up securely; it cannot be recovered from the encrypted local copy.'\n )\n console.log('Encrypted local copy: ~/.chain-insights/wallet.json')\n console.log('Next: cia wallet ready')\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n createCliCommand('address')\n .description('Print the local payment wallet address')\n .action(async () => {\n try {\n const { getWalletAccount } = await import('./wallet/tools.js')\n const account = await getWalletAccount()\n console.log(account.address)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n createCliCommand('balance')\n .description('Show the local payment wallet Base USDC balance')\n .action(async () => {\n try {\n const { getWalletBalanceText } = await import('./wallet/tools.js')\n console.log(await getWalletBalanceText())\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n createCliCommand('ready')\n .description('Check and prepare the wallet for paid Chain Insights Graph calls')\n .option('--check-only', 'Only check readiness; do not submit the one-time payment setup')\n .addOption(new Option('--no-approve', 'Deprecated alias for --check-only').hideHelp())\n .option('--payment-usdc <amount>', 'USDC setup cap to prepare for paid calls', '1')\n .addOption(\n new Option('--approval-usdc <amount>', 'Deprecated alias for --payment-usdc').hideHelp()\n )\n .option('--json', 'Print machine-readable readiness metadata')\n .action(\n async (opts: {\n checkOnly?: boolean\n approve?: boolean\n paymentUsdc?: string\n approvalUsdc?: string\n json?: boolean\n }) => {\n try {\n const { formatWalletReadiness, parsePaymentApprovalUnits, prepareWalletForPaidCalls } =\n await import('./wallet/tools.js')\n const minimumApprovalUnits = parsePaymentApprovalUnits(\n opts.paymentUsdc ?? opts.approvalUsdc ?? '1'\n )\n const result = await prepareWalletForPaidCalls({\n minimumApprovalUnits,\n approve: opts.checkOnly ? false : opts.approve !== false,\n })\n\n if (opts.json) {\n console.log(\n JSON.stringify(\n result,\n (_key, value) => (typeof value === 'bigint' ? value.toString() : value),\n 2\n )\n )\n return\n }\n\n console.log(formatWalletReadiness(result.readiness, result.approval))\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n }\n )\n )\n .addCommand(\n createCliCommand('topup')\n .description('Open a local browser page to top up the payment wallet')\n .option('--no-open', 'Print the top-up URL without opening a browser')\n .option('--json', 'Print machine-readable top-up metadata')\n .action(async (opts: { open?: boolean; json?: boolean }) => {\n try {\n const { buildTopupInfo, getWalletAccount } = await import('./wallet/tools.js')\n const { startTopupServer } = await import('./wallet/topup-server.js')\n const account = await getWalletAccount()\n const url = await startTopupServer(account)\n const info = buildTopupInfo(account.address, url)\n\n if (opts.json) {\n console.log(JSON.stringify(info, null, 2))\n } else {\n console.log(`Top-up URL: ${url}`)\n console.log(`Wallet: ${account.address}`)\n console.log('Network: Base')\n console.log('Token: USDC')\n console.log('Press Ctrl+C to stop the top-up server.')\n }\n\n if (opts.open !== false) {\n const open = (await import('open')).default\n await open(url)\n }\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n\naddAmlAddressRiskCommand(program, 'cia networks')\n\nconst mcpCommand = program\n .command('mcp')\n .description('Interact with the Chain Insights MCP endpoint')\n .allowExcessArguments(false)\n .addCommand(\n createCliCommand('networks')\n .description('List the detailed Chain Insights capability matrix and tool support')\n .option('--json', 'Print raw capability JSON')\n .action(async (opts: { json?: boolean }) => {\n try {\n await printNetworkCapabilities(opts)\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n .addCommand(\n createCliCommand('tools')\n .description('List remote GraphRAG MCP tools (cached for 24 hours)')\n .option('--refresh', 'Force refresh schema cache')\n .action(async (opts: { refresh?: boolean }) => {\n try {\n const { loadSchema, saveSchema } = await import('./mcp/schema-cache.js')\n const { formatToolsTable } = await import('./mcp/format.js')\n const { visibleRemoteTools } = await import('./mcp/tool-visibility.js')\n const { loadConfig } = await import('./config/index.js')\n const { createConfiguredGraphMcpFetch, resolveGraphMcpEndpoint } =\n await import('./mcp/client.js')\n const config = await loadConfig()\n const graphMcpEndpoint = resolveGraphMcpEndpoint(config)\n let tools = opts.refresh ? null : await loadSchema(graphMcpEndpoint)\n if (!tools) {\n const paymentFetch = await createConfiguredGraphMcpFetch(config)\n const { Client } = await import('@modelcontextprotocol/sdk/client/index.js')\n const { StreamableHTTPClientTransport } =\n await import('@modelcontextprotocol/sdk/client/streamableHttp.js')\n const client = new Client({ name: 'chain-insights-cli', version: PACKAGE_VERSION })\n await client.connect(\n new StreamableHTTPClientTransport(new URL(graphMcpEndpoint), { fetch: paymentFetch })\n )\n try {\n const result = await client.listTools()\n tools = result.tools as Array<{ name: string; description?: string }>\n await saveSchema(tools, graphMcpEndpoint)\n } finally {\n await client.close()\n }\n }\n console.log(formatToolsTable(visibleRemoteTools(tools)))\n } catch (err) {\n console.error((err as Error).message)\n process.exit(1)\n }\n })\n )\n\naddAmlAddressRiskCommand(mcpCommand, 'cia mcp networks')\n\nmcpCommand.addCommand(\n createCliCommand('call')\n .description('Call an MCP tool directly (debug)')\n .argument('<tool>', 'Tool name to call')\n .argument('[args...]', 'Key=value arguments (e.g. address=0x1234... network=robinhood)')\n .action(async (tool: string, rawArgs: string[]) => {\n try {\n const { parseMcpCallArgs } = await import('./mcp/call-args.js')\n const { assertPublicMcpToolName, validatePublicMcpToolArguments } =\n await import('./mcp/tool-visibility.js')\n const args = parseMcpCallArgs(rawArgs)\n assertPublicMcpToolName(tool)\n validatePublicMcpToolArguments(tool, args)\n\n if (tool === 'wallet_balance') {\n const { getWalletBalanceText } = await import('./wallet/tools.js')\n console.log(await getWalletBalanceText())\n return\n }\n\n if (tool === 'meta_network_capabilities') {\n await printNetworkCapabilities({ json: true })\n return\n }\n\n if (tool === 'meta_help') {\n console.log(\n 'Chain Insights tools: aml_*, graph_query, graph_query_batch, meta_*, and wallet_balance.'\n )\n return\n }\n\n await withGraphMcpClient('chain-insights-cli-call', async (client, config) => {\n if (tool === 'meta_usage_status') {\n try {\n const result = await client.callTool({ name: 'usage_status', arguments: {} })\n printMcpTextContent(result as { content?: Array<{ type: string; text?: string }> })\n } catch (err) {\n const {\n isMissingUsageStatusToolError,\n primitiveBackendUsageStatus,\n usageStatusText,\n } = await import('./mcp/usage-status.js')\n if (!isMissingUsageStatusToolError(err)) throw err\n const { resolveGraphMcpEndpoint } = await import('./mcp/client.js')\n console.log(\n usageStatusText(primitiveBackendUsageStatus(resolveGraphMcpEndpoint(config)))\n )\n }\n return\n }\n if (tool === 'aml_address_risk') {\n const { addressRisk } = await import('./investigation/public-tools.js')\n const result = await addressRisk(client, {\n address: String(args['address'] ?? ''),\n network: String(args['network'] ?? ''),\n compareAddress:\n args['compare_address'] === undefined ? undefined : String(args['compare_address']),\n })\n console.log(result.summaryText)\n return\n }\n const result = await client.callTool({ name: tool, arguments: args })\n printMcpTextContent(result as { content?: Array<{ type: string; text?: string }> })\n })\n } catch (err) {\n const { formatMcpCallError } = await import('./mcp/tool-visibility.js')\n console.error(formatMcpCallError(tool, err))\n process.exit(1)\n }\n })\n)\n\n// parseAsync (not parse) so a rejected async action surfaces as a clean\n// one-line error and a non-zero exit, instead of an unhandled-rejection stack\n// trace. Commands with their own try/catch still exit(1) before this fires.\nprogram.parseAsync(process.argv).catch((err) => {\n console.error((err as Error).message)\n process.exit(1)\n})\n"],"mappings":";;;;;;;;;;;;;AAYA,SAAgB,oBAAoB,QAA6B;CAC/D,MAAM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AK,CAAC;CAChB;AACF,CAAC,CACL;AAKA,QAAQ,WAAW,QAAQ,IAAI,CAAC,CAAC,OAAO,QAAQ;CAC9C,QAAQ,MAAO,IAAc,OAAO;CACpC,QAAQ,KAAK,CAAC;AAChB,CAAC"}
|
package/dist/mcp-proxy.cjs
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
|
|
3
3
|
const require_version = require("./version-CO9Or_YV.cjs");
|
|
4
4
|
const require_client = require("./client-Ypw9BNbn.cjs");
|
|
5
|
-
const require_tool_visibility = require("./tool-visibility-
|
|
5
|
+
const require_tool_visibility = require("./tool-visibility-DA4pOuJt.cjs");
|
|
6
6
|
const require_usage_status = require("./usage-status-BdwwgYsu.cjs");
|
|
7
7
|
const require_capabilities = require("./capabilities-CjpGnrVg.cjs");
|
|
8
8
|
const require_action_log = require("./action-log-HniMMF7f.cjs");
|
package/dist/mcp-proxy.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as PACKAGE_VERSION } from "./version-BA3J8hu4.mjs";
|
|
2
2
|
import { t as PaymentRequiredError } from "./client-CHYskPnG.mjs";
|
|
3
|
-
import { n as PUBLIC_MCP_TOOL_ALLOWED_ARGS, r as PUBLIC_MCP_TOOL_REQUIRED_ARGS, t as HIDDEN_REMOTE_TOOL_NAMES } from "./tool-visibility-
|
|
3
|
+
import { n as PUBLIC_MCP_TOOL_ALLOWED_ARGS, r as PUBLIC_MCP_TOOL_REQUIRED_ARGS, t as HIDDEN_REMOTE_TOOL_NAMES } from "./tool-visibility-wDMzmHU-.mjs";
|
|
4
4
|
import { t as primitiveBackendUsageStatus } from "./usage-status-CHiOPA-2.mjs";
|
|
5
5
|
import { n as mirrorGraphNetworkCapabilities } from "./capabilities-CY3Ok5ls.mjs";
|
|
6
6
|
import { r as appendActionLog, t as actionLogSignalsFromResult } from "./action-log-diTHyMbV.mjs";
|
|
@@ -4,6 +4,7 @@ var tool_visibility_exports = /* @__PURE__ */ require("./rolldown-runtime-C0BPl7
|
|
|
4
4
|
PUBLIC_MCP_TOOL_ALLOWED_ARGS: () => PUBLIC_MCP_TOOL_ALLOWED_ARGS,
|
|
5
5
|
PUBLIC_MCP_TOOL_REQUIRED_ARGS: () => PUBLIC_MCP_TOOL_REQUIRED_ARGS,
|
|
6
6
|
assertPublicMcpToolName: () => assertPublicMcpToolName,
|
|
7
|
+
formatMcpCallError: () => formatMcpCallError,
|
|
7
8
|
isHiddenRemoteToolName: () => isHiddenRemoteToolName,
|
|
8
9
|
validatePublicMcpToolArguments: () => validatePublicMcpToolArguments,
|
|
9
10
|
visibleRemoteTools: () => visibleRemoteTools
|
|
@@ -59,6 +60,11 @@ function assertPublicMcpToolName(name) {
|
|
|
59
60
|
if (!isHiddenRemoteToolName(name)) return;
|
|
60
61
|
throw new Error(`MCP tool '${name}' is not exposed by Chain Insights.${name === "address_risk" ? " Use aml_address_risk instead." : name === "network_capabilities" ? " Use meta_network_capabilities instead." : name === "usage_status" ? " Use meta_usage_status instead." : name === "balance" ? " Use wallet_balance instead." : name === "help" ? " Use meta_help instead." : ""}`);
|
|
61
62
|
}
|
|
63
|
+
function formatMcpCallError(tool, err) {
|
|
64
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
65
|
+
if (/\bunknown tool\b|\btool\b.*\bnot found\b/i.test(message)) return `Unknown MCP tool "${tool}". Run \`cia mcp tools --refresh\` to list available tools.`;
|
|
66
|
+
return message;
|
|
67
|
+
}
|
|
62
68
|
function validatePublicMcpToolArguments(name, args) {
|
|
63
69
|
const allowedArgs = PUBLIC_MCP_TOOL_ALLOWED_ARGS[name];
|
|
64
70
|
if (!allowedArgs) return;
|
|
@@ -5,6 +5,7 @@ var tool_visibility_exports = /* @__PURE__ */ __exportAll({
|
|
|
5
5
|
PUBLIC_MCP_TOOL_ALLOWED_ARGS: () => PUBLIC_MCP_TOOL_ALLOWED_ARGS,
|
|
6
6
|
PUBLIC_MCP_TOOL_REQUIRED_ARGS: () => PUBLIC_MCP_TOOL_REQUIRED_ARGS,
|
|
7
7
|
assertPublicMcpToolName: () => assertPublicMcpToolName,
|
|
8
|
+
formatMcpCallError: () => formatMcpCallError,
|
|
8
9
|
isHiddenRemoteToolName: () => isHiddenRemoteToolName,
|
|
9
10
|
validatePublicMcpToolArguments: () => validatePublicMcpToolArguments,
|
|
10
11
|
visibleRemoteTools: () => visibleRemoteTools
|
|
@@ -60,6 +61,11 @@ function assertPublicMcpToolName(name) {
|
|
|
60
61
|
if (!isHiddenRemoteToolName(name)) return;
|
|
61
62
|
throw new Error(`MCP tool '${name}' is not exposed by Chain Insights.${name === "address_risk" ? " Use aml_address_risk instead." : name === "network_capabilities" ? " Use meta_network_capabilities instead." : name === "usage_status" ? " Use meta_usage_status instead." : name === "balance" ? " Use wallet_balance instead." : name === "help" ? " Use meta_help instead." : ""}`);
|
|
62
63
|
}
|
|
64
|
+
function formatMcpCallError(tool, err) {
|
|
65
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
66
|
+
if (/\bunknown tool\b|\btool\b.*\bnot found\b/i.test(message)) return `Unknown MCP tool "${tool}". Run \`cia mcp tools --refresh\` to list available tools.`;
|
|
67
|
+
return message;
|
|
68
|
+
}
|
|
63
69
|
function validatePublicMcpToolArguments(name, args) {
|
|
64
70
|
const allowedArgs = PUBLIC_MCP_TOOL_ALLOWED_ARGS[name];
|
|
65
71
|
if (!allowedArgs) return;
|
|
@@ -70,4 +76,4 @@ function validatePublicMcpToolArguments(name, args) {
|
|
|
70
76
|
//#endregion
|
|
71
77
|
export { tool_visibility_exports as i, PUBLIC_MCP_TOOL_ALLOWED_ARGS as n, PUBLIC_MCP_TOOL_REQUIRED_ARGS as r, HIDDEN_REMOTE_TOOL_NAMES as t };
|
|
72
78
|
|
|
73
|
-
//# sourceMappingURL=tool-visibility-
|
|
79
|
+
//# sourceMappingURL=tool-visibility-wDMzmHU-.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-visibility-
|
|
1
|
+
{"version":3,"file":"tool-visibility-wDMzmHU-.mjs","names":[],"sources":["../src/mcp/tool-visibility.ts"],"sourcesContent":["export const HIDDEN_REMOTE_TOOL_NAMES = new Set([\n 'topup',\n 'address_risk',\n 'trace_victim_funds',\n 'trace_suspect_funds',\n 'trace_deposit_sources',\n 'trace_funds',\n 'track_funds',\n // Retired AML trace tools: never exposed publicly. Built by concatenation\n // so the retired names do not appear as literals in this file.\n ['aml_trace_victim', '_funds'].join(''),\n ['aml_trace_suspect', '_funds'].join(''),\n ['aml_trace_deposit', '_sources'].join(''),\n 'network_capabilities',\n 'usage_status',\n 'balance',\n 'help',\n 'money_flows_between_exchanges',\n 'address_connection_risk',\n])\n\nexport const PUBLIC_MCP_TOOL_REQUIRED_ARGS: Record<string, string[]> = {\n aml_address_risk: ['address', 'network'],\n graph_query: ['query', 'network'],\n graph_query_batch: ['network', 'queries'],\n}\n\n// normalizeRemoteToolArguments FILTERS pass-through arguments to this list, so\n// an argument that is missing here is silently STRIPPED and the caller gets a\n// default-bounded result with no error and no warning. `time_scope` shipped\n// broken for exactly this reason. Every tunable search bound below\n// (per_address_limit, row_limit) must therefore be listed the moment it\n// appears on a tool schema, and is covered end-to-end through the proxy in\n// tests/mcp-proxy.test.ts.\nexport const PUBLIC_MCP_TOOL_ALLOWED_ARGS: Record<string, string[]> = {\n aml_address_risk: ['address', 'network', 'compare_address'],\n // `time_scope` narrows a `USE topology` query to a temporal-shard subset\n graph_query: ['query', 'network', 'time_scope'],\n graph_query_batch: ['network', 'queries', 'per_query_timeout_seconds', 'time_scope'],\n}\n\nexport function isHiddenRemoteToolName(name: string): boolean {\n return HIDDEN_REMOTE_TOOL_NAMES.has(name)\n}\n\nexport function visibleRemoteTools<T extends { name: string }>(tools: T[]): T[] {\n return tools.filter((tool) => !isHiddenRemoteToolName(tool.name))\n}\n\nexport function assertPublicMcpToolName(name: string): void {\n if (!isHiddenRemoteToolName(name)) return\n const replacement =\n name === 'address_risk'\n ? ' Use aml_address_risk instead.'\n : name === 'network_capabilities'\n ? ' Use meta_network_capabilities instead.'\n : name === 'usage_status'\n ? ' Use meta_usage_status instead.'\n : name === 'balance'\n ? ' Use wallet_balance instead.'\n : name === 'help'\n ? ' Use meta_help instead.'\n : ''\n throw new Error(`MCP tool '${name}' is not exposed by Chain Insights.${replacement}`)\n}\n\nexport function formatMcpCallError(tool: string, err: unknown): string {\n const message = err instanceof Error ? err.message : String(err)\n if (/\\bunknown tool\\b|\\btool\\b.*\\bnot found\\b/i.test(message)) {\n return `Unknown MCP tool \"${tool}\". Run \\`cia mcp tools --refresh\\` to list available tools.`\n }\n return message\n}\n\nexport function validatePublicMcpToolArguments(name: string, args: Record<string, unknown>): void {\n const allowedArgs = PUBLIC_MCP_TOOL_ALLOWED_ARGS[name]\n if (!allowedArgs) return\n\n const unsupportedArgs = Object.keys(args).filter((argName) => !allowedArgs.includes(argName))\n if (unsupportedArgs.length === 0) return\n\n throw new Error(\n [\n `Unsupported argument${unsupportedArgs.length === 1 ? '' : 's'} for ${name}: ${unsupportedArgs.join(', ')}.`,\n `Allowed arguments: ${allowedArgs.join(', ')}.`,\n ].join(' ')\n )\n}\n"],"mappings":";;;;;;;;;;;;AAAA,MAAa,2CAA2B,IAAI,IAAI;CAC9C;CACA;CACA;CACA;CACA;CACA;CACA;CAGA,CAAC,oBAAoB,QAAQ,CAAC,CAAC,KAAK,EAAE;CACtC,CAAC,qBAAqB,QAAQ,CAAC,CAAC,KAAK,EAAE;CACvC,CAAC,qBAAqB,UAAU,CAAC,CAAC,KAAK,EAAE;CACzC;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAa,gCAA0D;CACrE,kBAAkB,CAAC,WAAW,SAAS;CACvC,aAAa,CAAC,SAAS,SAAS;CAChC,mBAAmB,CAAC,WAAW,SAAS;AAC1C;AASA,MAAa,+BAAyD;CACpE,kBAAkB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