chain-insights 0.2.31 → 0.2.32

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.
@@ -40,7 +40,10 @@ assumed to exist on the GraphRAG MCP endpoint.
40
40
  Agent installers ship two graph-query skills:
41
41
 
42
42
  - `chain-insights-cypher`: generic layer selection, schema capture, and
43
- portable read-only GQL/Cypher examples.
43
+ portable read-only GQL/Cypher examples. Its
44
+ `references/memgraph-examples.md` file includes staging-tested Memgraph-style
45
+ recipes, archive/facts reads, and fixed-hop traversal fallbacks for native
46
+ Memgraph deep traversal syntax that the hosted GraphRAG MCP path may reject.
44
47
  - `chain-insights-bittensor-cypher`: Bittensor-specific schema notes for SS58
45
48
  and EVM-pallet addresses under `network=bittensor`.
46
49
 
package/docs/mcp-proxy.md CHANGED
@@ -132,6 +132,11 @@ current caller's quota status. Public free access does not include
132
132
  usage and batches. Use explicit LIMIT and pagination in your query when you
133
133
  want bounded result sets.
134
134
 
135
+ For custom graph reads, install the shipped `chain-insights-cypher` skill. Its
136
+ Memgraph examples reference distinguishes staging-tested GraphRAG MCP query
137
+ patterns from direct Memgraph deep traversal syntax that needs a fixed-hop
138
+ `graph_query_batch` fallback through the hosted endpoint.
139
+
135
140
  Paid x402 mode:
136
141
 
137
142
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chain-insights",
3
- "version": "0.2.31",
3
+ "version": "0.2.32",
4
4
  "description": "AML investigation CLI and MCP proxy for blockchain risk, fund-flow tracing, case reports, and GraphRAG MCP access",
5
5
  "homepage": "https://chain-insights.ai",
6
6
  "repository": {
@@ -38,6 +38,14 @@ Observed against staging on 2026-05-29:
38
38
  - Source mappings include archive `STAKES_IN` and facts labels/features/neuron
39
39
  context, but staging returned generic backend errors for those sample reads;
40
40
  verify them with a fresh schema probe before relying on them.
41
+ - On 2026-05-29, staging accepted practical Memgraph-style reads such as
42
+ `WHERE STARTS WITH`, `WITH` aggregations, `CASE`, address-family counts, and
43
+ fixed-hop `FLOWS_TO` patterns. It rejected native Memgraph deep traversal
44
+ operators through the hosted GraphRAG MCP path, including `*BFS`,
45
+ `*WSHORTEST`, `*ALLSHORTEST`, `*KSHORTEST`, and variable-length relationship
46
+ syntax. Use the generic skill reference
47
+ `references/memgraph-examples.md` for tested examples and fixed-hop
48
+ fallbacks.
41
49
 
42
50
  ## Bittensor Shapes
43
51
 
@@ -124,6 +132,22 @@ cia mcp call graph_query \
124
132
  'query=USE live_topology MATCH (src:Address {address: "FULL_BITTENSOR_ADDRESS"})-[flow:FLOWS_TO]->(dst:Address) RETURN dst.address AS to_address, flow.amount_sum AS amount_sum, flow.amount_usd_sum AS amount_usd_sum, flow.tx_count AS tx_count, flow.last_seen_timestamp AS last_seen_timestamp ORDER BY flow.amount_usd_sum DESC LIMIT 50'
125
133
  ```
126
134
 
135
+ Find likely address completions from a prefix:
136
+
137
+ ```bash
138
+ cia mcp call graph_query \
139
+ network=bittensor \
140
+ 'query=USE live_topology MATCH (a:Address) WHERE a.address STARTS WITH "5Ggf" RETURN a.address AS address, a.address_type AS address_type, a.network AS network LIMIT 10'
141
+ ```
142
+
143
+ Show how the combined Bittensor network currently splits address families:
144
+
145
+ ```bash
146
+ cia mcp call graph_query \
147
+ network=bittensor \
148
+ 'query=USE live_topology MATCH (a:Address) RETURN a.address_type AS address_type, a.network AS source_network, count(a) AS addresses ORDER BY addresses DESC LIMIT 10'
149
+ ```
150
+
127
151
  Historical archive read for the same address:
128
152
 
129
153
  ```bash
@@ -21,6 +21,11 @@ skill exists, load it after this one.
21
21
  4. Use `graph_query_batch` for related schema, topology, and facts reads.
22
22
  5. Save material query output as workspace evidence before summarizing it.
23
23
 
24
+ For practical query recipes and Memgraph deep traversal fallbacks, read
25
+ `references/memgraph-examples.md`. It contains staging-tested examples for
26
+ `MATCH`, `WHERE`, `WITH`, aggregates, `CASE`, archive/facts projections, and
27
+ fixed-hop traversal batches.
28
+
24
29
  ## Layer Choice
25
30
 
26
31
  | Layer | Use for | Query style |
@@ -32,7 +37,9 @@ skill exists, load it after this one.
32
37
  Treat `archive_topology` and `facts` as mapped graph views, not full Memgraph.
33
38
  Avoid backend-specific functions such as `keys()`, `labels()`, `type()`,
34
39
  procedures, native BFS syntax, catalog operations, and variable-length path
35
- tricks unless the current endpoint has just accepted the exact pattern.
40
+ tricks unless the current endpoint has just accepted the exact pattern. When a
41
+ Memgraph deep traversal pattern fails, rewrite it as a bounded
42
+ `graph_query_batch` of explicit fixed-hop `FLOWS_TO` patterns.
36
43
 
37
44
  ## Common Schema
38
45
 
@@ -94,6 +101,8 @@ cia mcp call graph_query \
94
101
  'query=USE facts MATCH (a:Address {address: "FULL_ADDRESS"})-[:HAS_LABEL]->(label:AddressLabel) RETURN label.label AS label, label.entity_type AS entity_type, label.address_type AS address_type, label.source AS source LIMIT 25'
95
102
  ```
96
103
 
104
+ More examples: `references/memgraph-examples.md`.
105
+
97
106
  ## Hard Stops
98
107
 
99
108
  - No writes or catalog changes: no `CREATE`, `MERGE`, `SET`, `DELETE`,
@@ -0,0 +1,193 @@
1
+ # GraphRAG MCP Cypher Examples
2
+
3
+ Use these examples when an investigation needs practical graph-language reads
4
+ instead of only schema probes. They are adapted from Memgraph query and deep
5
+ path traversal features, then bounded to the Chain Insights GraphRAG MCP
6
+ surface.
7
+
8
+ Official Memgraph references:
9
+
10
+ - Querying: https://memgraph.com/docs/querying
11
+ - Deep path traversal: https://memgraph.com/docs/advanced-algorithms/deep-path-traversal
12
+
13
+ ## Staging Validation
14
+
15
+ Validated against hosted staging on 2026-05-29 with `network=bittensor` and
16
+ `per_query_timeout_seconds=5`.
17
+
18
+ Accepted through GraphRAG MCP:
19
+
20
+ - `MATCH`, directed relationship patterns, property equality, `WHERE`
21
+ - `STARTS WITH`
22
+ - `WITH`, `count`, `sum`
23
+ - `CASE`
24
+ - `ORDER BY`, explicit `LIMIT`
25
+ - fixed-hop patterns written as explicit relationships
26
+ - simple `archive_topology` counts and filtered projections
27
+ - `facts` `Address` projection
28
+
29
+ Rejected through the current hosted path with a generic backend error:
30
+
31
+ - variable-length relationship syntax such as `[:FLOWS_TO*1..2]`
32
+ - Memgraph native BFS syntax such as `*BFS` and `USING HOPS LIMIT`
33
+ - weighted/all/K shortest path operators: `*WSHORTEST`, `*ALLSHORTEST`,
34
+ `*KSHORTEST`
35
+ - `OPTIONAL MATCH`
36
+ - `UNION ALL`
37
+
38
+ Treat rejected syntax as direct-Memgraph reference material only unless the
39
+ current endpoint accepts the exact query. For Chain Insights agents, use the
40
+ fixed-hop `graph_query_batch` fallback below for traversal.
41
+
42
+ ## Live Topology Examples
43
+
44
+ Top outflows by amount:
45
+
46
+ ```bash
47
+ cia mcp call graph_query \
48
+ network=bittensor \
49
+ 'query=USE live_topology MATCH (src:Address)-[flow:FLOWS_TO]->(dst:Address) RETURN src.address AS from_address, dst.address AS to_address, flow.amount_sum AS amount_sum, flow.amount_usd_sum AS amount_usd_sum, flow.tx_count AS tx_count, flow.last_seen_timestamp AS last_seen_timestamp ORDER BY flow.amount_sum DESC LIMIT 25'
50
+ ```
51
+
52
+ Rank addresses by live out-degree and transferred amount:
53
+
54
+ ```bash
55
+ cia mcp call graph_query \
56
+ network=bittensor \
57
+ 'query=USE live_topology MATCH (src:Address)-[flow:FLOWS_TO]->(dst:Address) WITH src, count(dst) AS out_degree, sum(flow.amount_sum) AS total_amount RETURN src.address AS address, out_degree, total_amount ORDER BY out_degree DESC LIMIT 25'
58
+ ```
59
+
60
+ Bucket flows for quick triage:
61
+
62
+ ```bash
63
+ cia mcp call graph_query \
64
+ network=bittensor \
65
+ 'query=USE live_topology MATCH (src:Address)-[flow:FLOWS_TO]->(dst:Address) RETURN src.address AS from_address, dst.address AS to_address, CASE WHEN flow.amount_sum IS NULL THEN "unknown" WHEN flow.amount_sum >= 100 THEN "large" WHEN flow.amount_sum >= 10 THEN "medium" ELSE "small" END AS amount_bucket, flow.amount_sum AS amount_sum LIMIT 25'
66
+ ```
67
+
68
+ Prefix search for address completion:
69
+
70
+ ```bash
71
+ cia mcp call graph_query \
72
+ network=bittensor \
73
+ 'query=USE live_topology MATCH (a:Address) WHERE a.address STARTS WITH "5Ggf" RETURN a.address AS address, a.address_type AS address_type, a.network AS network LIMIT 10'
74
+ ```
75
+
76
+ Address-family census for a combined network:
77
+
78
+ ```bash
79
+ cia mcp call graph_query \
80
+ network=bittensor \
81
+ 'query=USE live_topology MATCH (a:Address) RETURN a.address_type AS address_type, a.network AS source_network, count(a) AS addresses ORDER BY addresses DESC LIMIT 10'
82
+ ```
83
+
84
+ Bittensor EVM-pallet flow under the same investigation network:
85
+
86
+ ```bash
87
+ cia mcp call graph_query \
88
+ network=bittensor \
89
+ 'query=USE live_topology MATCH (src:Address {address: "0x20d09f2881602eee806147ceee9275d33ff31df8"})-[flow:FLOWS_TO]->(dst:Address) RETURN src.address AS from_address, src.address_type AS from_type, src.network AS from_network, dst.address AS to_address, dst.address_type AS to_type, dst.network AS to_network, flow.amount_sum AS amount_sum LIMIT 10'
90
+ ```
91
+
92
+ ## Archive Topology Examples
93
+
94
+ Recent historical flows:
95
+
96
+ ```bash
97
+ cia mcp call graph_query \
98
+ network=bittensor \
99
+ 'query=USE archive_topology MATCH (src:Address)-[flow:FLOWS_TO]->(dst:Address) RETURN src.address AS from_address, dst.address AS to_address, flow.period_granularity AS period_granularity, flow.amount_sum AS amount_sum, flow.tx_count AS tx_count, flow.last_seen_timestamp AS last_seen_timestamp ORDER BY flow.last_seen_timestamp DESC LIMIT 25'
100
+ ```
101
+
102
+ Count archive flow edges by granularity:
103
+
104
+ ```bash
105
+ cia mcp call graph_query \
106
+ network=bittensor \
107
+ 'query=USE archive_topology MATCH (:Address)-[flow:FLOWS_TO]->(:Address) RETURN flow.period_granularity AS period_granularity, count(flow) AS flow_edges LIMIT 10'
108
+ ```
109
+
110
+ Filter daily archive flows:
111
+
112
+ ```bash
113
+ cia mcp call graph_query \
114
+ network=bittensor \
115
+ 'query=USE archive_topology MATCH (src:Address)-[flow:FLOWS_TO]->(dst:Address) WHERE flow.period_granularity = "daily" RETURN src.address AS from_address, dst.address AS to_address, flow.amount_sum AS amount_sum, flow.tx_count AS tx_count ORDER BY flow.amount_sum DESC LIMIT 25'
116
+ ```
117
+
118
+ Remember that archive numeric fields may arrive as strings.
119
+
120
+ ## Facts Examples
121
+
122
+ Facts `Address` projection:
123
+
124
+ ```bash
125
+ cia mcp call graph_query \
126
+ network=bittensor \
127
+ 'query=USE facts MATCH (a:Address) RETURN a.address AS address, a.labels AS labels, a.is_exchange AS is_exchange LIMIT 25'
128
+ ```
129
+
130
+ Only use richer fact labels or relationships after a fresh schema probe proves
131
+ the current network exposes them. On 2026-05-29, staging accepted facts
132
+ `Address` projection but rejected `Address` to `AddressLabel` relationship
133
+ samples.
134
+
135
+ ## Fixed-Hop Traversal Fallback
136
+
137
+ Memgraph deep traversal docs cover BFS, weighted shortest path, all shortest
138
+ paths, and K shortest paths. Through the current GraphRAG MCP path, those
139
+ native operators were rejected on staging. Use explicit fixed-hop batches for
140
+ Chain Insights traversal instead.
141
+
142
+ One-hop path:
143
+
144
+ ```bash
145
+ cia mcp call graph_query_batch \
146
+ network=bittensor \
147
+ per_query_timeout_seconds=5 \
148
+ 'queries=[{"id":"hop_1","query":"USE live_topology MATCH (src:Address {address: \"FULL_SOURCE_ADDRESS\"})-[r1:FLOWS_TO]->(dst:Address {address: \"FULL_TARGET_ADDRESS\"}) RETURN src.address AS from_address, dst.address AS to_address, 1 AS hops, r1.amount_sum AS amount_sum, r1.tx_count AS tx_count LIMIT 25"}]'
149
+ ```
150
+
151
+ Two-hop expansion with exchange-stopped intermediate nodes:
152
+
153
+ ```bash
154
+ cia mcp call graph_query_batch \
155
+ network=bittensor \
156
+ per_query_timeout_seconds=5 \
157
+ 'queries=[{"id":"hop_2","query":"USE live_topology MATCH (src:Address {address: \"FULL_SOURCE_ADDRESS\"})-[r1:FLOWS_TO]->(mid:Address)-[r2:FLOWS_TO]->(dst:Address) WHERE mid.is_exchange IS NULL RETURN src.address AS from_address, mid.address AS mid_address, dst.address AS to_address, 2 AS hops, r1.amount_sum AS first_amount, r2.amount_sum AS second_amount LIMIT 25"}]'
158
+ ```
159
+
160
+ Generate one query per depth when investigating a path. Keep each query
161
+ directed, stop expansion at exchange nodes, preserve full addresses, and use a
162
+ small `LIMIT` while exploring.
163
+
164
+ ## Direct Memgraph Reference Syntax
165
+
166
+ Use this syntax only in a direct Memgraph console or after the GraphRAG MCP
167
+ endpoint accepts the same pattern.
168
+
169
+ Native BFS:
170
+
171
+ ```cypher
172
+ MATCH path=(src:Address {address: "FULL_SOURCE_ADDRESS"})-[:FLOWS_TO *BFS]->(dst:Address {address: "FULL_TARGET_ADDRESS"})
173
+ RETURN path
174
+ LIMIT 5;
175
+ ```
176
+
177
+ Weighted shortest path:
178
+
179
+ ```cypher
180
+ MATCH path=(src:Address {address: "FULL_SOURCE_ADDRESS"})-[:FLOWS_TO *WSHORTEST (r, n | coalesce(r.amount_sum, 1)) total_weight]->(dst:Address {address: "FULL_TARGET_ADDRESS"})
181
+ RETURN path, total_weight
182
+ LIMIT 5;
183
+ ```
184
+
185
+ K shortest alternatives:
186
+
187
+ ```cypher
188
+ MATCH (src:Address {address: "FULL_SOURCE_ADDRESS"}), (dst:Address {address: "FULL_TARGET_ADDRESS"})
189
+ WITH src, dst
190
+ MATCH path=(src)-[:FLOWS_TO *KSHORTEST|3]->(dst)
191
+ RETURN path
192
+ LIMIT 3;
193
+ ```