chain-insights 0.22.2 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -50
- package/dist/cli.cjs +21 -83
- package/dist/cli.mjs +21 -83
- package/dist/cli.mjs.map +1 -1
- package/dist/{config-BVFf3v8-.cjs → config-B542AM4w.cjs} +2 -3
- package/dist/{config-CnNMdt4M.mjs → config-DbbPiGk0.mjs} +2 -3
- package/dist/{config-CnNMdt4M.mjs.map → config-DbbPiGk0.mjs.map} +1 -1
- package/dist/html-generator-BCDtYcGs.mjs +16 -0
- package/dist/{html-generator-D2BDzLED.mjs.map → html-generator-BCDtYcGs.mjs.map} +1 -1
- package/dist/html-generator-DFwMRWN3.cjs +16 -0
- package/dist/index.cjs +2 -8
- package/dist/index.d.cts +1 -99
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -99
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -6
- package/dist/mcp-proxy.cjs +35 -156
- package/dist/mcp-proxy.d.cts.map +1 -1
- package/dist/mcp-proxy.d.mts.map +1 -1
- package/dist/mcp-proxy.mjs +35 -156
- package/dist/mcp-proxy.mjs.map +1 -1
- package/dist/{public-tools-BFs_7U_Z.cjs → public-tools-Bou25cki.cjs} +153 -5
- package/dist/{public-tools-BjqZGGAC.mjs → public-tools-CpOLkME5.mjs} +152 -4
- package/dist/public-tools-CpOLkME5.mjs.map +1 -0
- package/dist/{schema-DOJA2nNi.mjs → schema-B0OuHW_l.mjs} +64 -5
- package/dist/schema-B0OuHW_l.mjs.map +1 -0
- package/dist/{schema-BpeV3xDV.cjs → schema-CtFWYoJz.cjs} +72 -7
- package/dist/{tool-visibility-DZBAP62b.cjs → tool-visibility-C8F9Yoxy.cjs} +1 -2
- package/dist/{tool-visibility-C0ALejXI.mjs → tool-visibility-CXbwfKhv.mjs} +2 -3
- package/dist/tool-visibility-CXbwfKhv.mjs.map +1 -0
- package/dist/{topup-server-rqI7bqem.mjs → topup-server-BLdF1SFQ.mjs} +2 -2
- package/dist/topup-server-BLdF1SFQ.mjs.map +1 -0
- package/dist/{topup-server-DAqmAuu1.cjs → topup-server-YN3iHrHW.cjs} +1 -1
- package/dist/{update-CJUfGCxs.mjs → update-MsoEFbhn.mjs} +2 -36
- package/dist/{update-CJUfGCxs.mjs.map → update-MsoEFbhn.mjs.map} +1 -1
- package/dist/{update-BJoXYucO.cjs → update-RKd0UW90.cjs} +0 -35
- package/docs/architecture.md +16 -46
- package/docs/contributing.md +0 -3
- package/docs/development.md +3 -5
- package/docs/graph-tools.md +4 -29
- package/docs/mcp-proxy.md +10 -36
- package/docs/stability.md +0 -12
- package/package.json +3 -4
- package/skills/chain-insights-address-risk/SKILL.md +0 -1
- package/dist/app-7NRCqx_Q.mjs +0 -140
- package/dist/app-7NRCqx_Q.mjs.map +0 -1
- package/dist/app-l9JE6bt3.cjs +0 -145
- package/dist/artifact-server-CH-asxF5.cjs +0 -47
- package/dist/artifact-server-DoxJr0z8.mjs +0 -49
- package/dist/artifact-server-DoxJr0z8.mjs.map +0 -1
- package/dist/graph-normalizer-B2Q2lgVy.cjs +0 -130
- package/dist/graph-normalizer-BA3Rbd6l.mjs +0 -127
- package/dist/graph-normalizer-BA3Rbd6l.mjs.map +0 -1
- package/dist/graph-reports-B6yoYbPq.mjs +0 -63
- package/dist/graph-reports-B6yoYbPq.mjs.map +0 -1
- package/dist/graph-reports-_gqzxvvs.cjs +0 -64
- package/dist/html-generator-B9f_GIi2.cjs +0 -86
- package/dist/html-generator-D2BDzLED.mjs +0 -70
- package/dist/init-Djhml4ih.mjs +0 -319
- package/dist/init-Djhml4ih.mjs.map +0 -1
- package/dist/init-DvrKxK15.cjs +0 -319
- package/dist/limits-D3Mn-gig.mjs +0 -94
- package/dist/limits-D3Mn-gig.mjs.map +0 -1
- package/dist/limits-km3pmmL3.cjs +0 -115
- package/dist/mcp-endpoint-BIWrUOFG.cjs +0 -56
- package/dist/mcp-endpoint-DbWtLcba.mjs +0 -41
- package/dist/mcp-endpoint-DbWtLcba.mjs.map +0 -1
- package/dist/output-root-BK4pdjyz.mjs +0 -36
- package/dist/output-root-BK4pdjyz.mjs.map +0 -1
- package/dist/output-root-BewoQaTx.cjs +0 -46
- package/dist/public-tools-BjqZGGAC.mjs.map +0 -1
- package/dist/resolve-port-CbaEoODz.cjs +0 -18
- package/dist/resolve-port-DxPK7Ipx.mjs +0 -20
- package/dist/resolve-port-DxPK7Ipx.mjs.map +0 -1
- package/dist/schema-DOJA2nNi.mjs.map +0 -1
- package/dist/server-CmvzYu7v.cjs +0 -55
- package/dist/server-mDSRgk1X.mjs +0 -46
- package/dist/server-mDSRgk1X.mjs.map +0 -1
- package/dist/templates/graph.html +0 -1450
- package/dist/tool-visibility-C0ALejXI.mjs.map +0 -1
- package/dist/topup-server-rqI7bqem.mjs.map +0 -1
- package/dist/viz-BJ_kyRjI.cjs +0 -217
- package/dist/viz-Uh_EF-qB.mjs +0 -206
- package/dist/viz-Uh_EF-qB.mjs.map +0 -1
- package/docs/images/graph-mcp-iframe.png +0 -0
- package/docs/images/graph-visualization.png +0 -0
- package/docs/images/quickstart-demo.svg +0 -1
- package/docs/investigation-workspaces.md +0 -108
- package/docs/search-limits.md +0 -73
package/dist/mcp-proxy.mjs
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import { n as PACKAGE_VERSION } from "./version-BA3J8hu4.mjs";
|
|
2
2
|
import { t as PaymentRequiredError } from "./client-D4aM4bzP.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-CXbwfKhv.mjs";
|
|
4
4
|
import { t as primitiveBackendUsageStatus } from "./usage-status-CHiOPA-2.mjs";
|
|
5
5
|
import { n as mirrorGraphNetworkCapabilities } from "./capabilities-BZI6qROg.mjs";
|
|
6
6
|
import { r as appendActionLog, t as actionLogSignalsFromResult } from "./action-log-diTHyMbV.mjs";
|
|
7
|
-
import { fileURLToPath } from "node:url";
|
|
8
7
|
import path from "node:path";
|
|
9
|
-
import { readFileSync } from "node:fs";
|
|
10
8
|
import { appendFile, mkdir } from "node:fs/promises";
|
|
11
9
|
import * as z from "zod";
|
|
12
10
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
13
11
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
14
12
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
15
13
|
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
16
|
-
import { RESOURCE_MIME_TYPE, registerAppResource, registerAppTool } from "@modelcontextprotocol/ext-apps/server";
|
|
17
14
|
//#region src/mcp/proxy.ts
|
|
18
15
|
const LOCAL_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
19
16
|
"meta_network_capabilities",
|
|
@@ -21,19 +18,17 @@ const LOCAL_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
|
21
18
|
"meta_help",
|
|
22
19
|
"wallet_balance"
|
|
23
20
|
]);
|
|
24
|
-
const GRAPH_RESOURCE_URI = "ui://chain-insights/graph";
|
|
25
|
-
const GRAPH_APP_TOOL_NAMES = /* @__PURE__ */ new Set(["aml_address_risk"]);
|
|
26
21
|
const GRAPH_ARRAY_KEYS = [
|
|
27
22
|
"nodes",
|
|
28
23
|
"edges",
|
|
29
24
|
"flows",
|
|
30
25
|
"edge_anchors"
|
|
31
26
|
];
|
|
32
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
33
27
|
function resolveMcpProxyMode(env = process.env) {
|
|
34
28
|
const raw = env["CHAIN_INSIGHTS_MCP_PROXY_MODE"]?.trim().toLowerCase();
|
|
35
|
-
if (!raw || raw === "
|
|
36
|
-
if (raw === "
|
|
29
|
+
if (!raw || raw === "stateless") return "stateless";
|
|
30
|
+
if (raw === "workspace") return "workspace";
|
|
31
|
+
if (raw === "no-workspace" || raw === "workspace-less") return "stateless";
|
|
37
32
|
throw new Error(`CHAIN_INSIGHTS_MCP_PROXY_MODE must be workspace or stateless; got "${raw}"`);
|
|
38
33
|
}
|
|
39
34
|
const KNOWN_PUBLIC_TOOL_DESCRIPTIONS = {
|
|
@@ -51,11 +46,9 @@ const EMPTY_INPUT_SCHEMA = z.strictObject({});
|
|
|
51
46
|
const REMOTE_GRAPH_TOOL_REQUEST_TIMEOUT_MS = 9e5;
|
|
52
47
|
const CHAIN_INSIGHTS_WORKFLOW = [
|
|
53
48
|
"Workflow:",
|
|
54
|
-
"1.
|
|
55
|
-
"2.
|
|
56
|
-
"3.
|
|
57
|
-
"4. Persisted outputs belong in the initialized workspace under reports/, reports/graphs/, reports/tables/, artifacts/, entities/, sessions/, and published/.",
|
|
58
|
-
"5. For local review, inspect the generated Markdown and graph/table artifacts directly in the workspace."
|
|
49
|
+
"1. Do not call investigation tools until required arguments are known. Network is required; use meta_network_capabilities to check supported networks and available tools, or ask the user if missing.",
|
|
50
|
+
"2. Use aml_address_risk for single-address enrichment. Use graph_query(_batch) for graph-level questions that aml_address_risk does not answer.",
|
|
51
|
+
"3. Preserve tool summaries and structured facts as returned. Keep full blockchain addresses intact."
|
|
59
52
|
].join("\n");
|
|
60
53
|
const GRAPH_SCHEMA_HINTS = [
|
|
61
54
|
"Graph query hints:",
|
|
@@ -76,67 +69,25 @@ const GRAPH_SCHEMA_HINTS = [
|
|
|
76
69
|
"- All graph_query calls are read-only. Never use CREATE, INSERT, MERGE, SET, DELETE, REMOVE, DROP, DETACH, ADD, CONNECT, DISCONNECT, ALTER, TRUNCATE, GRANT, or REVOKE.",
|
|
77
70
|
"- Use USE facts graph patterns for fact and enrichment reads. Do not query internal table namespaces directly."
|
|
78
71
|
].join("\n");
|
|
79
|
-
const GRAPH_REPORT_HINTS = [
|
|
80
|
-
"Graph visualization behavior:",
|
|
81
|
-
"- Graph-backed tools return the investigator report as text content and keep raw graph data out of LLM-visible structuredContent.",
|
|
82
|
-
"- Chain Insights prepares the graph view automatically from local workspace report files when graph metadata is available.",
|
|
83
|
-
"- If the graph view cannot load a report, retry the graph-backed tool call so Chain Insights can recreate the local graph report."
|
|
84
|
-
].join("\n");
|
|
85
72
|
const SERVER_INSTRUCTIONS = [
|
|
86
|
-
"Chain Insights is
|
|
73
|
+
"Chain Insights is an AML and graph-analysis MCP server for AI agents.",
|
|
87
74
|
CHAIN_INSIGHTS_WORKFLOW,
|
|
88
|
-
GRAPH_REPORT_HINTS,
|
|
89
75
|
GRAPH_SCHEMA_HINTS,
|
|
90
76
|
"Presentation rules: preserve tool summaries as returned; never truncate blockchain addresses or identity_resolution audit mappings."
|
|
91
77
|
].join("\n\n");
|
|
92
78
|
const STATELESS_SERVER_INSTRUCTIONS = [
|
|
93
79
|
"Chain Insights is running as a stateless AML proxy for a host application.",
|
|
94
|
-
"Do not use local workspace persistence, wallet, or graph report workflows in this mode.",
|
|
95
80
|
"Use meta_network_capabilities first when network support is unknown, then call aml_address_risk, graph_query, or graph_query_batch as needed.",
|
|
81
|
+
"Use wallet_balance to inspect the local payment wallet when payment setup is needed.",
|
|
96
82
|
GRAPH_SCHEMA_HINTS,
|
|
97
83
|
"Presentation rules: preserve tool summaries as returned; never truncate blockchain addresses or identity_resolution audit mappings."
|
|
98
84
|
].join("\n\n");
|
|
99
|
-
function readGraphAppHtml() {
|
|
100
|
-
const candidates = [
|
|
101
|
-
path.resolve(__dirname, "templates", "graph.html"),
|
|
102
|
-
path.resolve(__dirname, "..", "templates", "graph.html"),
|
|
103
|
-
path.resolve(__dirname, "..", "viz", "templates", "graph.html")
|
|
104
|
-
];
|
|
105
|
-
for (const candidate of candidates) try {
|
|
106
|
-
return readFileSync(candidate, "utf8");
|
|
107
|
-
} catch (err) {
|
|
108
|
-
if (err.code !== "ENOENT") throw err;
|
|
109
|
-
}
|
|
110
|
-
throw new Error(`Chain Insights Graph app template not found. Tried: ${candidates.join(", ")}`);
|
|
111
|
-
}
|
|
112
|
-
function graphArtifactOrigins(config) {
|
|
113
|
-
return [`http://127.0.0.1:${config.serverPort}`, `http://localhost:${config.serverPort}`];
|
|
114
|
-
}
|
|
115
|
-
function hasGraphApp(tool) {
|
|
116
|
-
const configuredUri = tool._meta?.ui;
|
|
117
|
-
if (configuredUri && typeof configuredUri === "object" && "resourceUri" in configuredUri && configuredUri.resourceUri === GRAPH_RESOURCE_URI) return true;
|
|
118
|
-
if (tool._meta?.["ui/resourceUri"] === GRAPH_RESOURCE_URI) return true;
|
|
119
|
-
if (GRAPH_APP_TOOL_NAMES.has(tool.name)) return true;
|
|
120
|
-
return JSON.stringify(tool.outputSchema ?? {}).includes("\"app_data\"");
|
|
121
|
-
}
|
|
122
|
-
function graphToolMeta(tool) {
|
|
123
|
-
const meta = { ...tool._meta ?? {} };
|
|
124
|
-
const ui = meta.ui && typeof meta.ui === "object" && !Array.isArray(meta.ui) ? { ...meta.ui } : {};
|
|
125
|
-
return {
|
|
126
|
-
...meta,
|
|
127
|
-
ui: {
|
|
128
|
-
...ui,
|
|
129
|
-
resourceUri: GRAPH_RESOURCE_URI
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
85
|
function knownPublicToolInputSchema(toolName) {
|
|
134
86
|
switch (toolName) {
|
|
135
87
|
case "aml_address_risk": return {
|
|
136
88
|
address: z.string().min(1).describe("Blockchain address to screen."),
|
|
137
89
|
network: NETWORK_SCHEMA,
|
|
138
|
-
compare_address: z.string().optional().describe("Optional address to compare against the screened address.")
|
|
139
|
-
include_attachments: z.boolean().optional().describe("Include graph app report metadata")
|
|
90
|
+
compare_address: z.string().optional().describe("Optional address to compare against the screened address.")
|
|
140
91
|
};
|
|
141
92
|
case "graph_query": return {
|
|
142
93
|
query: z.string().min(1).describe("Read-only GQL/Cypher query. Use USE topology for topology (address/FLOWS_TO/LINKED graph, unified recent+historical, plus the node risk_score/risk_level verdict) and USE facts for bounded TRANSFER rows and enrichment."),
|
|
@@ -435,14 +386,9 @@ function registerLocalPrompts(server) {
|
|
|
435
386
|
}, async () => promptResult("Use Chain Insights wallet_balance. Show the wallet address, payment network, token, and amount exactly as returned.", "Wallet balance"));
|
|
436
387
|
server.registerPrompt("meta-help", {
|
|
437
388
|
title: "Chain Insights Help",
|
|
438
|
-
description: "Show available Chain Insights tools and
|
|
389
|
+
description: "Show available Chain Insights tools and workflow guidance.",
|
|
439
390
|
argsSchema: {}
|
|
440
|
-
}, async () => promptResult("Use Chain Insights meta_help. Summarize the available tools and
|
|
441
|
-
}
|
|
442
|
-
function hasGraphArrayFields(value) {
|
|
443
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
444
|
-
const record = value;
|
|
445
|
-
return GRAPH_ARRAY_KEYS.some((key) => Array.isArray(record[key]));
|
|
391
|
+
}, async () => promptResult("Use Chain Insights meta_help. Summarize the available tools and workflow guidance without inventing capabilities.", "Chain Insights help"));
|
|
446
392
|
}
|
|
447
393
|
function sanitizeStructuredContentForGraphPayload(structuredContent) {
|
|
448
394
|
if (!structuredContent) return void 0;
|
|
@@ -458,67 +404,27 @@ function sanitizeStructuredValue(value) {
|
|
|
458
404
|
}
|
|
459
405
|
return sanitized;
|
|
460
406
|
}
|
|
461
|
-
function
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
if (
|
|
470
|
-
|
|
407
|
+
function sanitizeRemoteMeta(metaValue) {
|
|
408
|
+
if (!metaValue || typeof metaValue !== "object" || Array.isArray(metaValue)) return void 0;
|
|
409
|
+
const meta = { ...metaValue };
|
|
410
|
+
delete meta.ui;
|
|
411
|
+
delete meta["ui/resourceUri"];
|
|
412
|
+
const chainInsights = meta.chainInsights;
|
|
413
|
+
if (chainInsights && typeof chainInsights === "object" && !Array.isArray(chainInsights)) {
|
|
414
|
+
const { graph: _graph, ...withoutGraph } = chainInsights;
|
|
415
|
+
if (Object.keys(withoutGraph).length > 0) meta.chainInsights = withoutGraph;
|
|
416
|
+
else delete meta.chainInsights;
|
|
471
417
|
}
|
|
472
|
-
|
|
473
|
-
if (!data || typeof data !== "object" || Array.isArray(data)) throw new Error("Invalid remote graph payload");
|
|
474
|
-
return data;
|
|
418
|
+
return Object.keys(meta).length > 0 ? meta : void 0;
|
|
475
419
|
}
|
|
476
|
-
|
|
477
|
-
const graphPayload = getRemoteGraphPayload(result);
|
|
478
|
-
const meta = { ...result._meta ?? {} };
|
|
479
|
-
if (graphPayload && includeAttachments) {
|
|
480
|
-
const { writeGraphReport } = await import("./graph-reports-B6yoYbPq.mjs");
|
|
481
|
-
const { ensureArtifactServer } = await import("./artifact-server-DoxJr0z8.mjs");
|
|
482
|
-
const report = await writeGraphReport(graphPayload, {
|
|
483
|
-
serverPort: config.serverPort,
|
|
484
|
-
slug: toolName || "remote-graph"
|
|
485
|
-
});
|
|
486
|
-
await ensureArtifactServer(config.serverPort);
|
|
487
|
-
meta.chainInsights = {
|
|
488
|
-
...meta.chainInsights ?? {},
|
|
489
|
-
graph: {
|
|
490
|
-
schema: report.schema,
|
|
491
|
-
url: report.url
|
|
492
|
-
}
|
|
493
|
-
};
|
|
494
|
-
}
|
|
420
|
+
function normalizeRemoteToolResult(result) {
|
|
495
421
|
return {
|
|
496
422
|
content: result.content ?? [],
|
|
497
423
|
structuredContent: sanitizeStructuredContentForGraphPayload(result.structuredContent),
|
|
498
|
-
_meta:
|
|
424
|
+
_meta: sanitizeRemoteMeta(result._meta),
|
|
499
425
|
isError: result.isError
|
|
500
426
|
};
|
|
501
427
|
}
|
|
502
|
-
function shouldIncludeAttachments(args, workspaceArtifactsEnabled) {
|
|
503
|
-
return workspaceArtifactsEnabled && args["include_attachments"] !== false;
|
|
504
|
-
}
|
|
505
|
-
async function writeLocalGraphMeta(graphData, config, slug, includeAttachments) {
|
|
506
|
-
if (!includeAttachments) return void 0;
|
|
507
|
-
const { writeGraphReport } = await import("./graph-reports-B6yoYbPq.mjs");
|
|
508
|
-
const { ensureArtifactServer } = await import("./artifact-server-DoxJr0z8.mjs");
|
|
509
|
-
const report = await writeGraphReport(graphData, {
|
|
510
|
-
serverPort: config.serverPort,
|
|
511
|
-
slug
|
|
512
|
-
});
|
|
513
|
-
await ensureArtifactServer(config.serverPort);
|
|
514
|
-
return {
|
|
515
|
-
schema: report.schema,
|
|
516
|
-
url: report.url
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
function graphMetaResult(graph) {
|
|
520
|
-
return graph ? { chainInsights: { graph } } : void 0;
|
|
521
|
-
}
|
|
522
428
|
function cleanNetworkCapabilities(value) {
|
|
523
429
|
const structuredContent = isRecord(value) ? value.structuredContent : void 0;
|
|
524
430
|
const facts = isRecord(structuredContent) ? structuredContent.facts : void 0;
|
|
@@ -549,7 +455,7 @@ function jsonTextResult(structuredContent) {
|
|
|
549
455
|
* All diagnostic output goes to console.error() or process.stderr.write().
|
|
550
456
|
*/
|
|
551
457
|
async function createProxy() {
|
|
552
|
-
const { loadConfig } = await import("./config-
|
|
458
|
+
const { loadConfig } = await import("./config-DbbPiGk0.mjs").then((n) => n.t);
|
|
553
459
|
const { activeDataDir, findActiveWorkspace } = await import("./active-BQopLul8.mjs").then((n) => n.t);
|
|
554
460
|
const { createConfiguredGraphMcpFetch, resolveGraphMcpEndpoint } = await import("./client-D4aM4bzP.mjs").then((n) => n.r);
|
|
555
461
|
const { loadSchema, saveSchema } = await import("./schema-cache-DJdU4MIP.mjs");
|
|
@@ -728,7 +634,7 @@ async function createProxy() {
|
|
|
728
634
|
};
|
|
729
635
|
}
|
|
730
636
|
});
|
|
731
|
-
|
|
637
|
+
server.registerTool("wallet_balance", {
|
|
732
638
|
title: "Wallet Balance",
|
|
733
639
|
description: KNOWN_PUBLIC_TOOL_DESCRIPTIONS.wallet_balance,
|
|
734
640
|
inputSchema: EMPTY_INPUT_SCHEMA,
|
|
@@ -760,38 +666,21 @@ async function createProxy() {
|
|
|
760
666
|
};
|
|
761
667
|
}
|
|
762
668
|
});
|
|
763
|
-
|
|
764
|
-
description: "Interactive fund-flow and pattern graph for Chain Insights investigation reports.",
|
|
765
|
-
_meta: { ui: { csp: {
|
|
766
|
-
resourceDomains: graphArtifactOrigins(config),
|
|
767
|
-
connectDomains: graphArtifactOrigins(config)
|
|
768
|
-
} } }
|
|
769
|
-
}, async () => ({ contents: [{
|
|
770
|
-
uri: GRAPH_RESOURCE_URI,
|
|
771
|
-
mimeType: RESOURCE_MIME_TYPE,
|
|
772
|
-
text: readGraphAppHtml(),
|
|
773
|
-
_meta: { ui: { csp: {
|
|
774
|
-
resourceDomains: graphArtifactOrigins(config),
|
|
775
|
-
connectDomains: graphArtifactOrigins(config)
|
|
776
|
-
} } }
|
|
777
|
-
}] }));
|
|
778
|
-
if (!remoteToolNames.has("aml_address_risk")) registerAppTool(server, "aml_address_risk", {
|
|
669
|
+
if (!remoteToolNames.has("aml_address_risk")) server.registerTool("aml_address_risk", {
|
|
779
670
|
title: "Address Risk",
|
|
780
671
|
description: KNOWN_PUBLIC_TOOL_DESCRIPTIONS.aml_address_risk,
|
|
781
672
|
inputSchema: {
|
|
782
673
|
address: z.string().min(1).describe("Blockchain address to screen"),
|
|
783
674
|
network: NETWORK_SCHEMA,
|
|
784
|
-
compare_address: z.string().optional().describe("Optional address to compare against the screened address")
|
|
785
|
-
include_attachments: z.boolean().optional().describe("Include graph app report metadata")
|
|
675
|
+
compare_address: z.string().optional().describe("Optional address to compare against the screened address")
|
|
786
676
|
},
|
|
787
|
-
_meta: { ui: { resourceUri: GRAPH_RESOURCE_URI } },
|
|
788
677
|
annotations: {
|
|
789
678
|
readOnlyHint: true,
|
|
790
679
|
destructiveHint: false,
|
|
791
680
|
idempotentHint: true,
|
|
792
681
|
openWorldHint: true
|
|
793
682
|
}
|
|
794
|
-
}, async ({ address, network, compare_address
|
|
683
|
+
}, async ({ address, network, compare_address }) => {
|
|
795
684
|
try {
|
|
796
685
|
if (!remoteConnected) return {
|
|
797
686
|
content: [{
|
|
@@ -800,21 +689,19 @@ async function createProxy() {
|
|
|
800
689
|
}],
|
|
801
690
|
isError: true
|
|
802
691
|
};
|
|
803
|
-
const { addressRisk } = await import("./public-tools-
|
|
692
|
+
const { addressRisk } = await import("./public-tools-CpOLkME5.mjs");
|
|
804
693
|
const result = await addressRisk(remoteClient, {
|
|
805
694
|
address,
|
|
806
695
|
network,
|
|
807
696
|
compareAddress: compare_address,
|
|
808
697
|
writeArtifacts: workspaceArtifactsEnabled
|
|
809
698
|
});
|
|
810
|
-
const graph = await writeLocalGraphMeta(result.graphData, config, `address-risk-${network}-${address}`, shouldIncludeAttachments({ include_attachments }, workspaceArtifactsEnabled));
|
|
811
699
|
return {
|
|
812
700
|
content: [{
|
|
813
701
|
type: "text",
|
|
814
702
|
text: result.summaryText
|
|
815
703
|
}],
|
|
816
704
|
structuredContent: result.structuredContent,
|
|
817
|
-
_meta: graphMetaResult(graph),
|
|
818
705
|
isError: false
|
|
819
706
|
};
|
|
820
707
|
} catch (err) {
|
|
@@ -848,7 +735,7 @@ async function createProxy() {
|
|
|
848
735
|
content: [{
|
|
849
736
|
type: "text",
|
|
850
737
|
text: workspaceArtifactsEnabled ? [
|
|
851
|
-
"Chain Insights helps AI agents run AML investigation workflows
|
|
738
|
+
"Chain Insights helps AI agents run AML investigation workflows.",
|
|
852
739
|
"",
|
|
853
740
|
CHAIN_INSIGHTS_WORKFLOW,
|
|
854
741
|
"",
|
|
@@ -861,14 +748,10 @@ async function createProxy() {
|
|
|
861
748
|
"",
|
|
862
749
|
"Wallet tools:",
|
|
863
750
|
"- wallet_balance: show the local payment wallet address, payment network, token, and amount.",
|
|
864
|
-
"- meta_help: show this overview."
|
|
865
|
-
"",
|
|
866
|
-
GRAPH_REPORT_HINTS
|
|
751
|
+
"- meta_help: show this overview."
|
|
867
752
|
].join("\n") : [
|
|
868
753
|
"Chain Insights stateless AML proxy for host applications.",
|
|
869
754
|
"",
|
|
870
|
-
"Local workspace persistence, wallet, and graph report attachment tools are disabled in this mode.",
|
|
871
|
-
"",
|
|
872
755
|
"Available graph-backed tools:",
|
|
873
756
|
"- meta_network_capabilities: inspect supported networks and available tools.",
|
|
874
757
|
"- meta_usage_status: check the caller public free graph_query quota.",
|
|
@@ -906,7 +789,7 @@ async function createProxy() {
|
|
|
906
789
|
arguments: normalizedArgs
|
|
907
790
|
};
|
|
908
791
|
const requestOptions = remoteToolRequestOptions(tool.name);
|
|
909
|
-
return
|
|
792
|
+
return normalizeRemoteToolResult(requestOptions ? await remoteClient.callTool(request, void 0, requestOptions) : await remoteClient.callTool(request));
|
|
910
793
|
} catch (err) {
|
|
911
794
|
if (err instanceof PaymentRequiredError) return {
|
|
912
795
|
content: [{
|
|
@@ -938,11 +821,7 @@ async function createProxy() {
|
|
|
938
821
|
inputSchema,
|
|
939
822
|
...knownPublicToolAnnotations(tool.name) ? { annotations: knownPublicToolAnnotations(tool.name) } : {}
|
|
940
823
|
};
|
|
941
|
-
|
|
942
|
-
...toolConfig,
|
|
943
|
-
_meta: graphToolMeta(tool)
|
|
944
|
-
}, handler);
|
|
945
|
-
else server.registerTool(tool.name, toolConfig, handler);
|
|
824
|
+
server.registerTool(tool.name, toolConfig, handler);
|
|
946
825
|
}
|
|
947
826
|
const transport = new StdioServerTransport();
|
|
948
827
|
await server.connect(transport);
|