log10x-mcp 1.0.0 → 1.5.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.
Files changed (283) hide show
  1. package/README.md +220 -16
  2. package/build/index.js +655 -92
  3. package/build/index.js.map +1 -1
  4. package/build/lib/advisor/mode.d.ts +89 -0
  5. package/build/lib/advisor/mode.js +321 -0
  6. package/build/lib/advisor/mode.js.map +1 -0
  7. package/build/lib/advisor/render.d.ts +11 -0
  8. package/build/lib/advisor/render.js +184 -0
  9. package/build/lib/advisor/render.js.map +1 -0
  10. package/build/lib/advisor/reporter-forwarders.d.ts +113 -0
  11. package/build/lib/advisor/reporter-forwarders.js +806 -0
  12. package/build/lib/advisor/reporter-forwarders.js.map +1 -0
  13. package/build/lib/advisor/reporter.d.ts +73 -0
  14. package/build/lib/advisor/reporter.js +407 -0
  15. package/build/lib/advisor/reporter.js.map +1 -0
  16. package/build/lib/advisor/retriever.d.ts +51 -0
  17. package/build/lib/advisor/retriever.js +333 -0
  18. package/build/lib/advisor/retriever.js.map +1 -0
  19. package/build/lib/advisor/streamer.d.ts +51 -0
  20. package/build/lib/advisor/streamer.js +333 -0
  21. package/build/lib/advisor/streamer.js.map +1 -0
  22. package/build/lib/advisor/types.d.ts +141 -0
  23. package/build/lib/advisor/types.js +11 -0
  24. package/build/lib/advisor/types.js.map +1 -0
  25. package/build/lib/aggregator.d.ts +44 -0
  26. package/build/lib/aggregator.js +117 -0
  27. package/build/lib/aggregator.js.map +1 -0
  28. package/build/lib/ai-prettify.d.ts +51 -0
  29. package/build/lib/ai-prettify.js +130 -0
  30. package/build/lib/ai-prettify.js.map +1 -0
  31. package/build/lib/api.d.ts +90 -0
  32. package/build/lib/api.js +179 -14
  33. package/build/lib/api.js.map +1 -1
  34. package/build/lib/auth-api.d.ts +21 -0
  35. package/build/lib/auth-api.js +37 -0
  36. package/build/lib/auth-api.js.map +1 -0
  37. package/build/lib/cli-output-parser.d.ts +71 -0
  38. package/build/lib/cli-output-parser.js +253 -0
  39. package/build/lib/cli-output-parser.js.map +1 -0
  40. package/build/lib/concurrency.d.ts +26 -0
  41. package/build/lib/concurrency.js +74 -0
  42. package/build/lib/concurrency.js.map +1 -0
  43. package/build/lib/correlate.d.ts +71 -0
  44. package/build/lib/correlate.js +224 -0
  45. package/build/lib/correlate.js.map +1 -0
  46. package/build/lib/credentials.d.ts +30 -0
  47. package/build/lib/credentials.js +96 -0
  48. package/build/lib/credentials.js.map +1 -0
  49. package/build/lib/cross-pillar-correlate.d.ts +119 -0
  50. package/build/lib/cross-pillar-correlate.js +530 -0
  51. package/build/lib/cross-pillar-correlate.js.map +1 -0
  52. package/build/lib/customer-metrics.d.ts +292 -0
  53. package/build/lib/customer-metrics.js +811 -0
  54. package/build/lib/customer-metrics.js.map +1 -0
  55. package/build/lib/dev-cli.d.ts +68 -0
  56. package/build/lib/dev-cli.js +375 -0
  57. package/build/lib/dev-cli.js.map +1 -0
  58. package/build/lib/discovery/aws.d.ts +27 -0
  59. package/build/lib/discovery/aws.js +198 -0
  60. package/build/lib/discovery/aws.js.map +1 -0
  61. package/build/lib/discovery/forwarder-detect.d.ts +36 -0
  62. package/build/lib/discovery/forwarder-detect.js +76 -0
  63. package/build/lib/discovery/forwarder-detect.js.map +1 -0
  64. package/build/lib/discovery/kubectl.d.ts +27 -0
  65. package/build/lib/discovery/kubectl.js +246 -0
  66. package/build/lib/discovery/kubectl.js.map +1 -0
  67. package/build/lib/discovery/orchestrate.d.ts +22 -0
  68. package/build/lib/discovery/orchestrate.js +139 -0
  69. package/build/lib/discovery/orchestrate.js.map +1 -0
  70. package/build/lib/discovery/shell.d.ts +40 -0
  71. package/build/lib/discovery/shell.js +85 -0
  72. package/build/lib/discovery/shell.js.map +1 -0
  73. package/build/lib/discovery/snapshot-store.d.ts +21 -0
  74. package/build/lib/discovery/snapshot-store.js +115 -0
  75. package/build/lib/discovery/snapshot-store.js.map +1 -0
  76. package/build/lib/discovery/types.d.ts +172 -0
  77. package/build/lib/discovery/types.js +9 -0
  78. package/build/lib/discovery/types.js.map +1 -0
  79. package/build/lib/drift.d.ts +56 -0
  80. package/build/lib/drift.js +185 -0
  81. package/build/lib/drift.js.map +1 -0
  82. package/build/lib/environments.d.ts +109 -7
  83. package/build/lib/environments.js +262 -32
  84. package/build/lib/environments.js.map +1 -1
  85. package/build/lib/format.d.ts +36 -4
  86. package/build/lib/format.js +80 -15
  87. package/build/lib/format.js.map +1 -1
  88. package/build/lib/gh-cli.d.ts +6 -0
  89. package/build/lib/gh-cli.js +58 -0
  90. package/build/lib/gh-cli.js.map +1 -0
  91. package/build/lib/github-device-flow.d.ts +73 -0
  92. package/build/lib/github-device-flow.js +138 -0
  93. package/build/lib/github-device-flow.js.map +1 -0
  94. package/build/lib/inflection.d.ts +28 -0
  95. package/build/lib/inflection.js +118 -0
  96. package/build/lib/inflection.js.map +1 -0
  97. package/build/lib/investigation-cache.d.ts +34 -0
  98. package/build/lib/investigation-cache.js +61 -0
  99. package/build/lib/investigation-cache.js.map +1 -0
  100. package/build/lib/investigation-templates.d.ts +50 -0
  101. package/build/lib/investigation-templates.js +271 -0
  102. package/build/lib/investigation-templates.js.map +1 -0
  103. package/build/lib/join-discovery.d.ts +90 -0
  104. package/build/lib/join-discovery.js +296 -0
  105. package/build/lib/join-discovery.js.map +1 -0
  106. package/build/lib/log.d.ts +21 -0
  107. package/build/lib/log.js +63 -0
  108. package/build/lib/log.js.map +1 -0
  109. package/build/lib/metric-emitters.d.ts +43 -0
  110. package/build/lib/metric-emitters.js +195 -0
  111. package/build/lib/metric-emitters.js.map +1 -0
  112. package/build/lib/open-browser.d.ts +1 -0
  113. package/build/lib/open-browser.js +51 -0
  114. package/build/lib/open-browser.js.map +1 -0
  115. package/build/lib/paste-api.d.ts +34 -0
  116. package/build/lib/paste-api.js +53 -0
  117. package/build/lib/paste-api.js.map +1 -0
  118. package/build/lib/pattern-extraction.d.ts +62 -0
  119. package/build/lib/pattern-extraction.js +443 -0
  120. package/build/lib/pattern-extraction.js.map +1 -0
  121. package/build/lib/poc-report-renderer.d.ts +117 -0
  122. package/build/lib/poc-report-renderer.js +939 -0
  123. package/build/lib/poc-report-renderer.js.map +1 -0
  124. package/build/lib/promql.d.ts +21 -5
  125. package/build/lib/promql.js +43 -11
  126. package/build/lib/promql.js.map +1 -1
  127. package/build/lib/retriever-api.d.ts +184 -0
  128. package/build/lib/retriever-api.js +784 -0
  129. package/build/lib/retriever-api.js.map +1 -0
  130. package/build/lib/retriever-fidelity.d.ts +129 -0
  131. package/build/lib/retriever-fidelity.js +309 -0
  132. package/build/lib/retriever-fidelity.js.map +1 -0
  133. package/build/lib/siem/_retry.d.ts +41 -0
  134. package/build/lib/siem/_retry.js +141 -0
  135. package/build/lib/siem/_retry.js.map +1 -0
  136. package/build/lib/siem/azure-monitor.d.ts +11 -0
  137. package/build/lib/siem/azure-monitor.js +213 -0
  138. package/build/lib/siem/azure-monitor.js.map +1 -0
  139. package/build/lib/siem/clickhouse.d.ts +35 -0
  140. package/build/lib/siem/clickhouse.js +317 -0
  141. package/build/lib/siem/clickhouse.js.map +1 -0
  142. package/build/lib/siem/cloudwatch.d.ts +20 -0
  143. package/build/lib/siem/cloudwatch.js +273 -0
  144. package/build/lib/siem/cloudwatch.js.map +1 -0
  145. package/build/lib/siem/datadog.d.ts +13 -0
  146. package/build/lib/siem/datadog.js +239 -0
  147. package/build/lib/siem/datadog.js.map +1 -0
  148. package/build/lib/siem/elasticsearch.d.ts +9 -0
  149. package/build/lib/siem/elasticsearch.js +227 -0
  150. package/build/lib/siem/elasticsearch.js.map +1 -0
  151. package/build/lib/siem/gcp-logging.d.ts +12 -0
  152. package/build/lib/siem/gcp-logging.js +232 -0
  153. package/build/lib/siem/gcp-logging.js.map +1 -0
  154. package/build/lib/siem/index.d.ts +110 -0
  155. package/build/lib/siem/index.js +86 -0
  156. package/build/lib/siem/index.js.map +1 -0
  157. package/build/lib/siem/pricing.d.ts +14 -0
  158. package/build/lib/siem/pricing.js +47 -0
  159. package/build/lib/siem/pricing.js.map +1 -0
  160. package/build/lib/siem/splunk.d.ts +14 -0
  161. package/build/lib/siem/splunk.js +329 -0
  162. package/build/lib/siem/splunk.js.map +1 -0
  163. package/build/lib/siem/sumo.d.ts +15 -0
  164. package/build/lib/siem/sumo.js +348 -0
  165. package/build/lib/siem/sumo.js.map +1 -0
  166. package/build/lib/streamer-api.d.ts +184 -0
  167. package/build/lib/streamer-api.js +737 -0
  168. package/build/lib/streamer-api.js.map +1 -0
  169. package/build/lib/streamer-fidelity.d.ts +129 -0
  170. package/build/lib/streamer-fidelity.js +309 -0
  171. package/build/lib/streamer-fidelity.js.map +1 -0
  172. package/build/lib/thresholds.d.ts +31 -0
  173. package/build/lib/thresholds.js +59 -0
  174. package/build/lib/thresholds.js.map +1 -0
  175. package/build/lib/tool-errors.d.ts +13 -0
  176. package/build/lib/tool-errors.js +107 -0
  177. package/build/lib/tool-errors.js.map +1 -0
  178. package/build/lib/variable-concentration.d.ts +54 -0
  179. package/build/lib/variable-concentration.js +132 -0
  180. package/build/lib/variable-concentration.js.map +1 -0
  181. package/build/tools/advise-compact.d.ts +92 -0
  182. package/build/tools/advise-compact.js +558 -0
  183. package/build/tools/advise-compact.js.map +1 -0
  184. package/build/tools/advise-install.d.ts +65 -0
  185. package/build/tools/advise-install.js +214 -0
  186. package/build/tools/advise-install.js.map +1 -0
  187. package/build/tools/advise-reducer.d.ts +60 -0
  188. package/build/tools/advise-reducer.js +83 -0
  189. package/build/tools/advise-reducer.js.map +1 -0
  190. package/build/tools/advise-regulator.d.ts +60 -0
  191. package/build/tools/advise-regulator.js +83 -0
  192. package/build/tools/advise-regulator.js.map +1 -0
  193. package/build/tools/advise-reporter.d.ts +58 -0
  194. package/build/tools/advise-reporter.js +80 -0
  195. package/build/tools/advise-reporter.js.map +1 -0
  196. package/build/tools/advise-retriever.d.ts +66 -0
  197. package/build/tools/advise-retriever.js +83 -0
  198. package/build/tools/advise-retriever.js.map +1 -0
  199. package/build/tools/advise-streamer.d.ts +66 -0
  200. package/build/tools/advise-streamer.js +83 -0
  201. package/build/tools/advise-streamer.js.map +1 -0
  202. package/build/tools/backfill-metric.d.ts +49 -0
  203. package/build/tools/backfill-metric.js +178 -0
  204. package/build/tools/backfill-metric.js.map +1 -0
  205. package/build/tools/correlate-cross-pillar.d.ts +48 -0
  206. package/build/tools/correlate-cross-pillar.js +246 -0
  207. package/build/tools/correlate-cross-pillar.js.map +1 -0
  208. package/build/tools/cost-drivers.d.ts +2 -0
  209. package/build/tools/cost-drivers.js +46 -6
  210. package/build/tools/cost-drivers.js.map +1 -1
  211. package/build/tools/customer-metrics-query.d.ts +31 -0
  212. package/build/tools/customer-metrics-query.js +109 -0
  213. package/build/tools/customer-metrics-query.js.map +1 -0
  214. package/build/tools/dependency-check.js +5 -1
  215. package/build/tools/dependency-check.js.map +1 -1
  216. package/build/tools/discover-env.d.ts +63 -0
  217. package/build/tools/discover-env.js +206 -0
  218. package/build/tools/discover-env.js.map +1 -0
  219. package/build/tools/discover-join.d.ts +37 -0
  220. package/build/tools/discover-join.js +135 -0
  221. package/build/tools/discover-join.js.map +1 -0
  222. package/build/tools/discover-labels.d.ts +22 -0
  223. package/build/tools/discover-labels.js +74 -0
  224. package/build/tools/discover-labels.js.map +1 -0
  225. package/build/tools/doctor.d.ts +42 -0
  226. package/build/tools/doctor.js +840 -0
  227. package/build/tools/doctor.js.map +1 -0
  228. package/build/tools/event-lookup.js +41 -10
  229. package/build/tools/event-lookup.js.map +1 -1
  230. package/build/tools/exclusion-filter.js +16 -6
  231. package/build/tools/exclusion-filter.js.map +1 -1
  232. package/build/tools/extract-templates.d.ts +47 -0
  233. package/build/tools/extract-templates.js +151 -0
  234. package/build/tools/extract-templates.js.map +1 -0
  235. package/build/tools/investigate.d.ts +47 -0
  236. package/build/tools/investigate.js +780 -0
  237. package/build/tools/investigate.js.map +1 -0
  238. package/build/tools/list-by-label.d.ts +29 -0
  239. package/build/tools/list-by-label.js +109 -0
  240. package/build/tools/list-by-label.js.map +1 -0
  241. package/build/tools/login-status.d.ts +20 -0
  242. package/build/tools/login-status.js +72 -0
  243. package/build/tools/login-status.js.map +1 -0
  244. package/build/tools/poc-from-siem.d.ts +105 -0
  245. package/build/tools/poc-from-siem.js +570 -0
  246. package/build/tools/poc-from-siem.js.map +1 -0
  247. package/build/tools/resolve-batch.d.ts +35 -0
  248. package/build/tools/resolve-batch.js +431 -0
  249. package/build/tools/resolve-batch.js.map +1 -0
  250. package/build/tools/retriever-query.d.ts +41 -0
  251. package/build/tools/retriever-query.js +319 -0
  252. package/build/tools/retriever-query.js.map +1 -0
  253. package/build/tools/retriever-series.d.ts +38 -0
  254. package/build/tools/retriever-series.js +440 -0
  255. package/build/tools/retriever-series.js.map +1 -0
  256. package/build/tools/savings.d.ts +20 -2
  257. package/build/tools/savings.js +182 -28
  258. package/build/tools/savings.js.map +1 -1
  259. package/build/tools/services.d.ts +1 -1
  260. package/build/tools/services.js +10 -2
  261. package/build/tools/services.js.map +1 -1
  262. package/build/tools/signin.d.ts +41 -0
  263. package/build/tools/signin.js +185 -0
  264. package/build/tools/signin.js.map +1 -0
  265. package/build/tools/signout.d.ts +16 -0
  266. package/build/tools/signout.js +45 -0
  267. package/build/tools/signout.js.map +1 -0
  268. package/build/tools/streamer-query.d.ts +41 -0
  269. package/build/tools/streamer-query.js +319 -0
  270. package/build/tools/streamer-query.js.map +1 -0
  271. package/build/tools/streamer-series.d.ts +38 -0
  272. package/build/tools/streamer-series.js +440 -0
  273. package/build/tools/streamer-series.js.map +1 -0
  274. package/build/tools/top-patterns.d.ts +22 -0
  275. package/build/tools/top-patterns.js +118 -0
  276. package/build/tools/top-patterns.js.map +1 -0
  277. package/build/tools/translate-metric-to-patterns.d.ts +33 -0
  278. package/build/tools/translate-metric-to-patterns.js +42 -0
  279. package/build/tools/translate-metric-to-patterns.js.map +1 -0
  280. package/build/tools/trend.d.ts +2 -2
  281. package/build/tools/trend.js +28 -9
  282. package/build/tools/trend.js.map +1 -1
  283. package/package.json +13 -3
package/README.md CHANGED
@@ -1,22 +1,136 @@
1
1
  # Log10x MCP Server
2
2
 
3
- Per-pattern log cost attribution for AI assistants. Ask Claude (or any MCP-compatible AI) "why did our log costs spike this week?" and get an instant, dollar-ranked answer powered by pre-aggregated Prometheus metrics.
3
+ Observability memory for your logs, exposed to AI assistants. Ask Claude (or any MCP-compatible AI) *"why did our log costs spike this week?"*, *"triage these 3000 events"*, *"what's causing the payments-svc error spike"*, or *"pull all payment_retry events for acme-corp from Jan 15 through Apr 15"* — and get structured answers backed by stable per-pattern identity, not best-effort clustering.
4
4
 
5
5
  ## What it does
6
6
 
7
- Log10x pre-aggregates per-pattern byte metrics inline, before logs hit any SIEM. This MCP server exposes that data to AI assistants as a set of tools:
7
+ Log10x fingerprints every log line into a stable `templateHash` — a structural identity that stays constant across deploys, restarts, pod names, timestamps, and request IDs. That identity is the key to a per-pattern Prometheus time series (volume + cost) and, optionally, a Bloom-indexed S3 archive of the raw events. This MCP server exposes both surfaces to AI assistants as a set of tools:
8
8
 
9
- | Tool | Answers |
10
- |---|---|
11
- | `log10x_cost_drivers` | "Why did our log costs spike?" — dollar-ranked patterns with before→after deltas |
12
- | `log10x_event_lookup` | "What is this Payment Gateway pattern?" — cost breakdown + AI classification |
13
- | `log10x_savings` | "How much are we saving?" — per-app savings with annual projection |
14
- | `log10x_pattern_trend` | "When did this pattern start spiking?" — time series + sparkline |
15
- | `log10x_services` | "What services are we monitoring?" — volume + cost by service |
16
- | `log10x_exclusion_filter` | "How do I drop this in Datadog?" — config snippets for 14 vendors |
17
- | `log10x_dependency_check` | "Anything depending on this before I drop it?" — SIEM dependency scan |
9
+ ### Cost attribution and daily-habit tools
10
+
11
+ | Tool | Answers | Tier |
12
+ |---|---|---|
13
+ | `log10x_cost_drivers` | "Why did our log costs spike?" — dollar-ranked patterns with before→after deltas, keyed by stable templateHash (Datadog Log Patterns re-cluster per query and can't do this honestly) | Reporter |
14
+ | `log10x_event_lookup` | "What is this single log line?" — cost breakdown + AI classification | Reporter |
15
+ | `log10x_pattern_trend` | "When did this pattern start spiking?" — time series + sparkline | Reporter |
16
+ | `log10x_top_patterns` | "What's expensive right now?" — loudest patterns by current cost | Reporter |
17
+ | `log10x_list_by_label` | "Cost by namespace / severity / tenant?" — group-by ranking | Reporter |
18
+ | `log10x_services` | "What services are we monitoring?" — volume + cost by service | Reporter |
19
+ | `log10x_discover_labels` | "What labels can I filter on?" — label universe for the session | Reporter |
20
+ | `log10x_savings` | "How much are we saving?" — per-app savings with annual projection | Reporter |
21
+ | `log10x_dependency_check` | "Anything depending on this before I drop it?" — SIEM dependency scan | None |
22
+ | `log10x_exclusion_filter` | "How do I drop this in Datadog?" — config snippets for 14 vendors | None |
23
+
24
+ ### Investigation, triage, and archive tools (v1.3)
25
+
26
+ | Tool | Answers | Tier |
27
+ |---|---|---|
28
+ | `log10x_investigate` | "Why is this spiking?" — single-call root-cause: anchor resolution, trajectory shape detection (acute-spike vs drift), cross-pattern lag correlation, causal chain with stat/lag/chain confidence sub-scores, drift cohort analysis, two-stage Retriever fallback, verification commands. Surfaces log-only signals (pool saturation, cache evictions, retry amplification) that APM structurally cannot see. | Reporter |
29
+ | `log10x_resolve_batch` | "Triage these events" — paste a file / array / text dump of raw log lines and get per-pattern frequency, severity, variable concentration, and next-action suggestions. Runs via the Log10x paste endpoint; works at any tier including CLI-only. | None |
30
+ | `log10x_retriever_query` | "Get me the actual events" — direct retrieval from the Retriever archive by templateHash with JS filter expressions over event payloads. Queries the customer's own S3 via pre-computed Bloom filters. Answers forensic, audit, and out-of-retention retrieval. | Retriever |
31
+ | `log10x_backfill_metric` | "Create a new Datadog metric backfilled with 90 days of history" — pulls historical events from the Retriever, aggregates into a bucketed time series, emits to the destination TSDB with historical timestamps preserved. Datadog + Prometheus remote_write supported today. | Retriever |
32
+
33
+ All tools query `prometheus.log10x.com` (for Reporter-tier tools) over HTTPS, with the same `X-10X-Auth` header used by the rest of the Log10x stack. No log scanning; sub-second at any scale.
34
+
35
+ ## ROI examples — three real flows
36
+
37
+ These are real round-trips against the Log10x demo environment, captured during development. Every tool call below is verbatim what the model would produce; outputs are abbreviated for the README.
38
+
39
+ ### 1. "Why is checkout-svc cost up?" (`log10x_cost_drivers`)
40
+
41
+ **Prompt**: *"Why did checkout cost spike this week?"*
42
+
43
+ **Tool call**: `log10x_cost_drivers({ service: "cart", timeRange: "7d" })`
44
+
45
+ **Output** (abbreviated):
46
+
47
+ ```
48
+ cart — $137 → $38K/wk (4 cost drivers)
49
+
50
+ #1 cart cartstore ValkeyCartStore $51 → $13K/wk INFO 13.3B events
51
+ #2 shipping service Post shipping... $34 → $12K/wk CRIT 1.6B events
52
+ #3 GetCartAsync called with userId $34 → $8.7K/wk 8.7B events
53
+ #4 AddItemAsync called with... $18 → $4.6K/wk 4.2B events
54
+
55
+ 4 drivers = 49% of increase · 2442 other patterns
56
+
57
+ **Next actions**:
58
+ - call `log10x_investigate({ starting_point: 'cart_cartstore_ValkeyCartStore' })` to trace the cause of the $13K delta on this pattern.
59
+ - call `log10x_dependency_check({ pattern: '...' })` before muting or dropping — blast-radius safety.
60
+ ```
61
+
62
+ The next-action hints in the output literally tell the model what to do next. No prompt engineering required.
63
+
64
+ ### 2. "What's broken in payments-svc?" (`log10x_investigate`)
65
+
66
+ **Prompt**: *"Investigate kafka — there's an alert firing."*
67
+
68
+ **Tool call**: `log10x_investigate({ starting_point: "kafka", window: "1h" })`
69
+
70
+ **Output** (abbreviated 8-link causal chain):
71
+
72
+ ```
73
+ ## Investigation: kafka, last 1h
74
+
75
+ **Anchor**: cluster_metadata_Wrote_producer_snapshot... (resolved from service_name)
76
+ **Service**: kafka
77
+ **Inflection**: 2026-04-14T00:19:52Z UTC
78
+ **Shape**: acute spike
79
+ **Reporter tier**: edge
80
+
81
+ ### Most likely root cause
82
+
83
+ Pattern: cluster_metadata_dir_tmp_kafka_logs_Rolled_new_segment...
84
+ Confidence: 43% (stat:1.00 lag:0.43 chain:1.00)
85
+ Why: peaked 300s before the anchor, magnitude 1.4× baseline.
86
+
87
+ ### Causal chain
88
+
89
+ 1. cluster_metadata_dir_tmp_kafka_logs_Rolled... — peaked T-300s
90
+ 2. Successfully_wrote_snapshot_org_apache_kafka... — peaked T-300s
91
+ 3. opentelemetry_javaagent_shaded_instrumentation... — peaked T-300s
92
+ ... (8 links total, each with stat × lag × chain confidence sub-scores)
93
+
94
+ ### Suggested verification commands
95
+
96
+ gh api /repos/<owner>/kafka/commits?since=...&until=...
97
+ kubectl get events -n kafka --since=Xm
98
+ dog metric query "avg:trace.kafka.requests{*} by {resource_name}" --from ...
99
+ ```
100
+
101
+ The full causal chain comes back in one tool call. The model doesn't need to compose. The verification commands are pre-substituted with the inflection timestamp so the user can paste them directly.
102
+
103
+ ### 3. "Triage this Slack paste" (`log10x_resolve_batch`)
104
+
105
+ **Prompt**: *"My teammate dumped these 12 lines from order-processing-svc into Slack — what's happening?"*
106
+
107
+ **Tool call**: `log10x_resolve_batch({ source: "text", text: "..." })`
108
+
109
+ **Output** (abbreviated):
110
+
111
+ ```
112
+ ## Batch Triage
113
+
114
+ 12 events, resolved into 3 distinct patterns. Templater wall time: 6.4s. Execution: Log10x paste endpoint.
115
+
116
+ **Severity mix**: INFO: 7 · ERROR: 4 · WARN: 1
117
+
118
+ ### Top 3 patterns by interestingness
119
+
120
+ **#1 checkout_svc_tenant_acme_corp_order_status_failed_reason_payment_gateway** · 4 events (33% of batch) · interestingness 0.47
121
+ severity: ERROR
122
+
123
+ Variable concentration (top values within this batch):
124
+ - timestamp · 4 distinct · `1776067923000` 25%, `1776067925000` 25%, `1776067928000` 25%
125
+ - order · 4 distinct · `12347` 25%, `12349` 25%, `12352` 25%
126
+
127
+ **Next actions**:
128
+ - call `log10x_investigate({ starting_point: '...' })` for historical correlation (requires Reporter tier).
129
+ - call `log10x_retriever_query({ pattern: '...', filters: ["event.order === \"12347\""] })` to retrieve all historical events concentrated on order=12347 (requires Retriever tier).
130
+ - native Datadog follow-up: `dog log search '@order:"12347"' --from now-24h` — filters to the dominant variable concentration directly in the SIEM.
131
+ ```
18
132
 
19
- The server queries `prometheus.log10x.com` over HTTPS. No log scanning, sub-second at any scale.
133
+ Every pattern is ranked by an interestingness score (severity-weighted); the dominant variable is identified; ready-to-paste next-action commands are pre-constructed for both Log10x tools and the customer's SIEM. The model just needs to relay the output and ask which path the user wants to take.
20
134
 
21
135
  ## Install
22
136
 
@@ -65,23 +179,40 @@ Same pattern — add an `mcpServers` entry with `"command": "npx"`, `"args": ["-
65
179
 
66
180
  ## Multi-environment setup
67
181
 
68
- To query multiple Log10x environments from a single MCP client, use `LOG10X_ENVS` instead of the single-env variables:
182
+ To query multiple Log10x environments (prod, staging, etc.), register one MCP server per environment with a distinct name:
69
183
 
70
184
  ```json
71
185
  {
72
186
  "mcpServers": {
73
- "log10x": {
187
+ "log10x-prod": {
188
+ "command": "npx",
189
+ "args": ["-y", "log10x-mcp"],
190
+ "env": {
191
+ "LOG10X_API_KEY": "prod-api-key",
192
+ "LOG10X_ENV_ID": "prod-env-id"
193
+ }
194
+ },
195
+ "log10x-staging": {
74
196
  "command": "npx",
75
197
  "args": ["-y", "log10x-mcp"],
76
198
  "env": {
77
- "LOG10X_ENVS": "[{\"nickname\":\"prod\",\"apiKey\":\"...\",\"envId\":\"...\"},{\"nickname\":\"staging\",\"apiKey\":\"...\",\"envId\":\"...\"}]"
199
+ "LOG10X_API_KEY": "staging-api-key",
200
+ "LOG10X_ENV_ID": "staging-env-id"
78
201
  }
79
202
  }
80
203
  }
81
204
  }
82
205
  ```
83
206
 
84
- Then ask "check prod costs" or "what's spiking in staging?" the AI routes to the right environment via the `environment` parameter.
207
+ Ask "check prod costs" and your AI assistant routes to the `log10x-prod` server automatically. Each environment gets its own toolset namespaced by server name — no param juggling, no footguns.
208
+
209
+ ### Advanced: single-process multi-env (for 10+ environments)
210
+
211
+ If you need to query many environments from a single process, use `LOG10X_ENVS` with a JSON array of `{nickname, apiKey, envId}` objects. Queries accept an `environment` parameter to route by nickname. This is more complex but avoids spawning N subprocesses.
212
+
213
+ ```bash
214
+ LOG10X_ENVS='[{"nickname":"prod","apiKey":"...","envId":"..."},{"nickname":"staging","apiKey":"...","envId":"..."}]'
215
+ ```
85
216
 
86
217
  ## Usage
87
218
 
@@ -123,6 +254,8 @@ cart — $103 → $13K/wk (3 cost drivers)
123
254
 
124
255
  ## Environment variables
125
256
 
257
+ ### Reporter-tier (required for cost, trend, and investigate tools)
258
+
126
259
  | Variable | Required | Description |
127
260
  |---|---|---|
128
261
  | `LOG10X_API_KEY` | Yes (single-env) | Your Log10x API key |
@@ -130,8 +263,79 @@ cart — $103 → $13K/wk (3 cost drivers)
130
263
  | `LOG10X_ENVS` | Yes (multi-env) | JSON array of `{nickname, apiKey, envId}` |
131
264
  | `LOG10X_API_BASE` | No | API base URL (default: `https://prometheus.log10x.com`) |
132
265
 
266
+ ### Pasted-batch triage (`log10x_resolve_batch`)
267
+
268
+ | Variable | Required | Description |
269
+ |---|---|---|
270
+ | `LOG10X_PASTE_URL` | No | Override the Log10x paste endpoint (default: `https://meljpepqpd.execute-api.us-east-1.amazonaws.com/paste`). Body limit 100 KB. |
271
+
272
+ ### Retriever (`log10x_retriever_query`, `log10x_backfill_metric`)
273
+
274
+ | Variable | Required | Description |
275
+ |---|---|---|
276
+ | `__SAVE_LOG10X_RETRIEVER_URL__` | Yes (Retriever tier) | Base URL of the customer's deployed Retriever query endpoint (e.g., `https://retriever.<your-domain>`). When unset, Retriever-dependent tools return a graceful "not configured" message. |
277
+ | `LOG10X_RETRIEVER_AUTH_HEADER` | No | Override the auth header name (default: `X-10X-Auth`, same as the Prometheus gateway). |
278
+ | `LOG10X_RETRIEVER_AUTH_VALUE` | No | Override the auth header value. Default is `${apiKey}/${envId}` from the active environment. |
279
+ | `__SAVE_LOG10X_RETRIEVER_TARGET__` | No | Override the default target prefix under which retriever writes indexed objects (default: `app`). |
280
+ | `LOG10X_RETRIEVER_INDEX_SUBPATH` | No | Override the index subpath inside the bucket (default: `indexing-results`, matching the engine's indexContainer convention). |
281
+ | `LOG10X_RETRIEVER_POLL_MS` | No | Override the marker-stability poll interval (default: `1500` ms). |
282
+ | `LOG10X_RETRIEVER_TIMEOUT_MS` | No | Override the query timeout (default: `90000` ms). |
283
+
284
+ **Demo env retriever LB**: the otel-demo cluster has a pre-provisioned retriever LoadBalancer at `http://a2936089108bb492cb41d18cb5b75f8d-1298006809.us-east-1.elb.amazonaws.com`. Set `__SAVE_LOG10X_RETRIEVER_URL__` to that value for the demo. The demo bucket is `tenx-demo-cloud-retriever-351939435334/indexing-results/`.
285
+
286
+ **Known engine-side issues (GAPS G12)**: `log10x_retriever_query` has two unresolved engine-side bugs that `log10x_doctor` flags as `retriever_forensic_health` warnings: (1) it may return 0 events on windows where `log10x_pattern_trend` proves events exist, (2) it may crash with `MCP error -32000: Connection closed` when passed a canonical slash-underscore pattern name. Workarounds: use short/free-text pattern names, cross-check any zero result against `log10x_pattern_trend`, prefer `log10x_event_lookup` + `log10x_pattern_trend` for incident reconstruction where approximate timing is acceptable. See `docs/ENGINE_TICKETS.md` for the full engine-team ticket.
287
+
288
+ ### Metric backfill destinations (`log10x_backfill_metric`)
289
+
290
+ | Variable | Required | Description |
291
+ |---|---|---|
292
+ | `DATADOG_API_KEY` (or `DD_API_KEY`) | Yes (Datadog destination) | Datadog API key used to POST to `/api/v2/series`. |
293
+ | `DATADOG_SITE` | No | Datadog site (default: `datadoghq.com`, override for `datadoghq.eu`, `us5.datadoghq.com`, etc.) |
294
+ | `PROMETHEUS_REMOTE_WRITE_URL` | Yes (Prometheus destination) | URL of a Prometheus `remote_write`-compatible adapter. The MCP posts JSON; the adapter translates to the native protobuf/Snappy wire format. |
295
+
133
296
  The server fetches your analyzer cost ($/GB) from your Console profile at startup and refreshes it hourly. To change it, update the cost in your profile — the server picks up the new value within an hour.
134
297
 
298
+ ## Spawning sub-agents that use this MCP
299
+
300
+ If you script Claude Code sub-agents (`Agent` tool, OpenAI Agents SDK, custom orchestrators) to call log10x MCP tools, watch out for **deferred-tool bootstrapping**. The sub-agent's static tool list does not always include `mcp__log10x__*` — those tools are loaded on demand via `ToolSearch` (or the equivalent in your client). A sub-agent that reads its tool list and concludes "no MCP tools available" without first calling `ToolSearch({query: "log10x"})` will refuse the task instead of using the tools.
301
+
302
+ In testing across 17 sub-agent runs, **prompt framing was the deciding factor**:
303
+
304
+ | Framing | Bootstrap success |
305
+ |---|---|
306
+ | Action-oriented ("pull the events", "build the slide", "investigate this") | 9/9 |
307
+ | Honesty-oriented ("don't fabricate", "refuse if you can't verify") | 0/5 |
308
+
309
+ The honesty disposition fires too early — the agent applies "be honest about my limits" before trying to discover deferred tools. The fix is one line at the top of every sub-agent prompt:
310
+
311
+ ```
312
+ TOOL BOOTSTRAP: You have log10x MCP tools available, but they are
313
+ deferred-loaded. Before doing anything else, call
314
+ ToolSearch({query: "log10x", max_results: 20}) to load them.
315
+ After that you'll have mcp__log10x__log10x_* tools.
316
+ ```
317
+
318
+ This raised bootstrap success from ~76% to 100% in our test runs and is harmless when MCP tools are already in scope.
319
+
320
+ ## Development
321
+
322
+ Build:
323
+
324
+ ```bash
325
+ npm install
326
+ npm run build # tsc → build/index.js
327
+ ```
328
+
329
+ **Operational gotcha — restart after rebuild.** MCP clients (Claude Desktop, Claude Code, Cursor) typically launch the server as a long-running child process. Node caches loaded modules in memory, so the running process **will not pick up your `npm run build` output until it is killed and respawned**. After rebuilding, find and kill the stale processes:
330
+
331
+ ```bash
332
+ pgrep -fl "log10x-mcp/build/index.js" # show running servers + start times
333
+ ps -o pid=,lstart= -p $(pgrep -f log10x-mcp/build/index.js)
334
+ pkill -f "log10x-mcp/build/index.js" # client will respawn on next tool call
335
+ ```
336
+
337
+ If you ship a tool description change or a routing-hint update and the agent's behavior doesn't seem to reflect it, this is the most likely cause. Verify by `grep`-ing the raw tool output (most clients log it) for any string you added — if it's missing, the server is stale.
338
+
135
339
  ## Security
136
340
 
137
341
  - All API calls use your personal API key (never exposed in tool output)