denpex-mcp 0.2.35 → 0.2.37

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 (3) hide show
  1. package/README.md +170 -170
  2. package/dist/index.js +5630 -5326
  3. package/package.json +65 -65
package/README.md CHANGED
@@ -1,170 +1,170 @@
1
- # Denpex MCP server
2
-
3
- Log files up to 100 MB are read in bounded chunks and reduced to diagnostic evidence before cloud submission. Binary files and invalid UTF-8 are rejected. Keep the original log: evidence selection can omit context.
4
-
5
- Diagnose GPU/ML training failures. CUDA OOM, NCCL timeouts, Xid faults, NaN loss,
6
- checkpoint corruption, **without leaving your AI tool**. Ask Claude Desktop, Cursor,
7
- or Claude Code to *"diagnose the crash in `./logs/train.err`"* and Denpex reads the log
8
- straight off disk and hands back the root cause and the fix.
9
-
10
- - 🩺 **Root cause + escalating fix** (primary → fallback → emergency), verification command, and prevention.
11
- - 🧭 **Find the culprit rank** in a distributed/NCCL hang, and route GPU Xid faults to the right node action, offline, instantly.
12
- - 📚 **Bundled failure encyclopedia** (500+ documented classes) searchable by error code or symptom.
13
- - 🔒 **Zero-egress mode** (`DENPEX_LOCAL=1`): diagnose entirely on-host, nothing leaves the machine. Plus client-side PII scrubbing even in cloud mode.
14
-
15
- ---
16
-
17
- ## Quick start (60 seconds)
18
-
19
- ### 1. Get an API key (optional but recommended)
20
-
21
- Sign in at **[denpex.com/dashboard](https://denpex.com/dashboard) → API Keys** and create a key (`dpx_…`).
22
- The key unlocks authenticated cloud diagnosis, your diagnosis history, quota, and fleet
23
- incidents. *Without a key, the first `diagnose_crash` cloud run is frictionless and uses
24
- the same canonical anonymous engine as the homepage. Later new anonymous diagnoses need
25
- the browser check at [denpex.com](https://denpex.com/#instant-diagnosis), which MCP cannot
26
- complete, or an API key. Anonymous clarifications reuse the server-issued, log-bound
27
- refinement token automatically (or accept it explicitly after an MCP restart), so
28
- answering Denpex does not spend another diagnosis and cannot be forged with a public
29
- boolean header. Set `DENPEX_LOCAL=1` explicitly for zero-egress;
30
- `lookup_failure` and `analyze_cascade` remain available from the bundled offline data.*
31
-
32
- ### 2. Add it to your client
33
-
34
- <details open>
35
- <summary><b>Claude Desktop</b></summary>
36
-
37
- Edit `claude_desktop_config.json`
38
- (macOS: `~/Library/Application Support/Claude/`, Windows: `%APPDATA%\Claude\`):
39
-
40
- ```json
41
- {
42
- "mcpServers": {
43
- "denpex": {
44
- "command": "npx",
45
- "args": ["-y", "denpex-mcp"],
46
- "env": { "DENPEX_API_KEY": "dpx_your_key_here" }
47
- }
48
- }
49
- }
50
- ```
51
- Restart Claude Desktop.
52
- </details>
53
-
54
- <details>
55
- <summary><b>Cursor</b></summary>
56
-
57
- Create `.cursor/mcp.json` in your project (or `~/.cursor/mcp.json` globally):
58
-
59
- ```json
60
- {
61
- "mcpServers": {
62
- "denpex": {
63
- "command": "npx",
64
- "args": ["-y", "denpex-mcp"],
65
- "env": { "DENPEX_API_KEY": "dpx_your_key_here" }
66
- }
67
- }
68
- }
69
- ```
70
- </details>
71
-
72
- <details>
73
- <summary><b>Claude Code</b></summary>
74
-
75
- ```bash
76
- claude mcp add denpex -e DENPEX_API_KEY=dpx_your_key_here -- npx -y denpex-mcp
77
- ```
78
- </details>
79
-
80
- ### 3. Use it
81
-
82
- > "My training job crashed, diagnose the log at `./logs/rank0.err`."
83
- > "What does Xid 79 mean?"
84
- > "This 64-GPU run is hung. Which rank failed first?" *(→ `analyze_cascade`)*
85
-
86
- Or pick the **`diagnose-training-crash`** prompt your client surfaces.
87
-
88
- ---
89
-
90
- ## Offline / air-gapped mode
91
-
92
- Diagnose entirely on-host, no network, no logs leaving the cluster. Ideal for VPCs,
93
- secure data centers, and privacy-sensitive labs. Add `DENPEX_LOCAL=1`:
94
-
95
- ```json
96
- { "mcpServers": { "denpex": {
97
- "command": "npx", "args": ["-y", "denpex-mcp"],
98
- "env": { "DENPEX_LOCAL": "1" }
99
- } } }
100
- ```
101
-
102
- The package bundles the same canonical deterministic diagnosis pipeline used by the hosted
103
- wrapper: 10,700+ patterns, causal detectors and contradiction gates, Xid routing, cross-rank
104
- cascade localization, and the 500+ class encyclopedia. It returns the initiating rank/node
105
- when the evidence identifies one. Only the hosted LLM fallback and live-research enrichment
106
- are unavailable offline.
107
-
108
- ---
109
-
110
- ## Tools
111
-
112
- | Tool | What it does | Needs |
113
- |------|--------------|-------|
114
- | `diagnose_crash` | Root cause + escalating fix from `logs` / `file` / `dir`. Also accepts `telemetry` (dmesg / nvidia-smi / ibstat), `codeContext`, `topologyMap`, typed `operatorAnswers`, and (after an anonymous MCP restart) the prior `refinementToken`. | canonical cloud by default; explicit offline mode |
115
- | `lookup_failure` | Search the bundled encyclopedia (500+ classes) by code/keyword/symptom. | works offline |
116
- | `analyze_cascade` | Find the culprit rank in a distributed hang; route Xid faults. | works offline |
117
- | `submit_fix_outcome` | Report whether a fix worked. **This is what makes the next diagnosis better.** | API key |
118
- | `check_quota` | Your plan and remaining diagnoses this month. | API key |
119
- | `recent_diagnoses` | Recall your recent diagnoses and their fixes. | API key |
120
- | `ask_followup` | Conversational follow-up on a diagnosis. | Team plan / trial |
121
- | `check_versions` | Flag known-bad CUDA/PyTorch/NCCL/driver combos. | Team plan / trial |
122
- | `compare_runs` | "It worked yesterday", isolate what changed between a good run and a bad one. | Team plan / trial |
123
- | `diff_environments` | Diff torch/CUDA/NCCL/driver versions and env vars between two runs. | Team plan / trial |
124
- | `validate_checkpoint` | Find the newest checkpoint that is actually safe to resume from. | Team plan / trial |
125
- | `preflight_check` | "Is this cluster safe to launch on?", blockers before you burn GPU-hours. | Scale plan |
126
- | `node_health` | Score every monitored node, worst first. | Scale plan |
127
- | `predict_failures` | Nodes trending toward a failure that has not happened yet. | Scale plan |
128
- | `list_incidents` | Incidents Denpex's monitor caught & escalated on your fleet. | Scale plan |
129
-
130
- Gated tools degrade gracefully, they tell you exactly which plan unlocks them and which
131
- tools work on your current plan. The failure encyclopedia is also exposed as resources at
132
- `denpex://failures/{slug}`.
133
-
134
- **Structured output.** Every tool above returns `structuredContent` alongside its
135
- markdown, validated against a declared output schema, so an agent branches on
136
- `confidenceBand === "low"` or iterates `rankedHypotheses` instead of regexing prose.
137
- Two fields deserve attention when you write the agent loop:
138
-
139
- - **`confidence: null`** does not mean zero. It means the engine measured this band's
140
- historical accuracy and declined to state a number. Treat the verdict as a lead. Do
141
- not substitute the raw score.
142
- - **`unfalsified: true`** identifies only the explicitly enabled reduced compatibility
143
- fallback, where the canonical contradiction graph did not run. Normal cloud and
144
- `DENPEX_LOCAL=1` diagnosis both use the canonical engine and set it to false.
145
-
146
- ---
147
-
148
- ## Environment variables
149
-
150
- | Variable | Default | Purpose |
151
- |----------|---------|---------|
152
- | `DENPEX_API_KEY` |, | Your `dpx_…` key. Enables cloud tools. |
153
- | `DENPEX_API_URL` | `https://api.denpex.com` | Override the API base (self-host / staging). |
154
- | `DENPEX_LOCAL` | `0` | `1` → diagnose entirely on-host (zero egress). |
155
- | `DENPEX_PRIVACY` | `off` | `mask` / `strict` → scrub PII from logs **before** they leave the machine. |
156
-
157
- ---
158
-
159
- ## Develop
160
-
161
- ```bash
162
- npm install
163
- npm run build # regenerates the canonical engine + corpus, then bundles dist/index.js
164
- npm test # 111 unit + protocol-integration tests
165
- npm run inspector # interactive protocol inspector (MCP Inspector)
166
- ```
167
-
168
- The offline corpus (`src/data/denpex_patterns.json`) and canonical engine
169
- (`src/offline/canonical-engine.mjs`) are generated from the repo's single source of truth
170
- during `npm run build`, never hand-edit either artifact.
1
+ # Denpex MCP server
2
+
3
+ Log files up to 100 MB are read in bounded chunks and reduced to diagnostic evidence before cloud submission. Binary files and invalid UTF-8 are rejected. Keep the original log: evidence selection can omit context.
4
+
5
+ Diagnose GPU/ML training failures. CUDA OOM, NCCL timeouts, Xid faults, NaN loss,
6
+ checkpoint corruption, **without leaving your AI tool**. Ask Claude Desktop, Cursor,
7
+ or Claude Code to *"diagnose the crash in `./logs/train.err`"* and Denpex reads the log
8
+ straight off disk and hands back the root cause and the fix.
9
+
10
+ - 🩺 **Root cause + escalating fix** (primary → fallback → emergency), verification command, and prevention.
11
+ - 🧭 **Find the culprit rank** in a distributed/NCCL hang, and route GPU Xid faults to the right node action, offline, instantly.
12
+ - 📚 **Bundled failure encyclopedia** (500+ documented classes) searchable by error code or symptom.
13
+ - 🔒 **Zero-egress mode** (`DENPEX_LOCAL=1`): diagnose entirely on-host, nothing leaves the machine. Plus client-side PII scrubbing even in cloud mode.
14
+
15
+ ---
16
+
17
+ ## Quick start (60 seconds)
18
+
19
+ ### 1. Get an API key (optional but recommended)
20
+
21
+ Sign in at **[denpex.com/dashboard](https://denpex.com/dashboard) → API Keys** and create a key (`dpx_…`).
22
+ The key unlocks authenticated cloud diagnosis, your diagnosis history, quota, and fleet
23
+ incidents. *Without a key, the first `diagnose_crash` cloud run is frictionless and uses
24
+ the same canonical anonymous engine as the homepage. Later new anonymous diagnoses need
25
+ the browser check at [denpex.com](https://denpex.com/#instant-diagnosis), which MCP cannot
26
+ complete, or an API key. Anonymous clarifications reuse the server-issued, log-bound
27
+ refinement token automatically (or accept it explicitly after an MCP restart), so
28
+ answering Denpex does not spend another diagnosis and cannot be forged with a public
29
+ boolean header. Set `DENPEX_LOCAL=1` explicitly for zero-egress;
30
+ `lookup_failure` and `analyze_cascade` remain available from the bundled offline data.*
31
+
32
+ ### 2. Add it to your client
33
+
34
+ <details open>
35
+ <summary><b>Claude Desktop</b></summary>
36
+
37
+ Edit `claude_desktop_config.json`
38
+ (macOS: `~/Library/Application Support/Claude/`, Windows: `%APPDATA%\Claude\`):
39
+
40
+ ```json
41
+ {
42
+ "mcpServers": {
43
+ "denpex": {
44
+ "command": "npx",
45
+ "args": ["-y", "denpex-mcp"],
46
+ "env": { "DENPEX_API_KEY": "dpx_your_key_here" }
47
+ }
48
+ }
49
+ }
50
+ ```
51
+ Restart Claude Desktop.
52
+ </details>
53
+
54
+ <details>
55
+ <summary><b>Cursor</b></summary>
56
+
57
+ Create `.cursor/mcp.json` in your project (or `~/.cursor/mcp.json` globally):
58
+
59
+ ```json
60
+ {
61
+ "mcpServers": {
62
+ "denpex": {
63
+ "command": "npx",
64
+ "args": ["-y", "denpex-mcp"],
65
+ "env": { "DENPEX_API_KEY": "dpx_your_key_here" }
66
+ }
67
+ }
68
+ }
69
+ ```
70
+ </details>
71
+
72
+ <details>
73
+ <summary><b>Claude Code</b></summary>
74
+
75
+ ```bash
76
+ claude mcp add denpex -e DENPEX_API_KEY=dpx_your_key_here -- npx -y denpex-mcp
77
+ ```
78
+ </details>
79
+
80
+ ### 3. Use it
81
+
82
+ > "My training job crashed, diagnose the log at `./logs/rank0.err`."
83
+ > "What does Xid 79 mean?"
84
+ > "This 64-GPU run is hung. Which rank failed first?" *(→ `analyze_cascade`)*
85
+
86
+ Or pick the **`diagnose-training-crash`** prompt your client surfaces.
87
+
88
+ ---
89
+
90
+ ## Offline / air-gapped mode
91
+
92
+ Diagnose entirely on-host, no network, no logs leaving the cluster. Ideal for VPCs,
93
+ secure data centers, and privacy-sensitive labs. Add `DENPEX_LOCAL=1`:
94
+
95
+ ```json
96
+ { "mcpServers": { "denpex": {
97
+ "command": "npx", "args": ["-y", "denpex-mcp"],
98
+ "env": { "DENPEX_LOCAL": "1" }
99
+ } } }
100
+ ```
101
+
102
+ The package bundles the same canonical deterministic diagnosis pipeline used by the hosted
103
+ wrapper: 10,700+ patterns, causal detectors and contradiction gates, Xid routing, cross-rank
104
+ cascade localization, and the 500+ class encyclopedia. It returns the initiating rank/node
105
+ when the evidence identifies one. Only the hosted LLM fallback and live-research enrichment
106
+ are unavailable offline.
107
+
108
+ ---
109
+
110
+ ## Tools
111
+
112
+ | Tool | What it does | Needs |
113
+ |------|--------------|-------|
114
+ | `diagnose_crash` | Root cause + escalating fix from `logs` / `file` / `dir`. Also accepts `telemetry` (dmesg / nvidia-smi / ibstat), `codeContext`, `topologyMap`, typed `operatorAnswers`, and (after an anonymous MCP restart) the prior `refinementToken`. | canonical cloud by default; explicit offline mode |
115
+ | `lookup_failure` | Search the bundled encyclopedia (500+ classes) by code/keyword/symptom. | works offline |
116
+ | `analyze_cascade` | Find the culprit rank in a distributed hang; route Xid faults. | works offline |
117
+ | `submit_fix_outcome` | Report whether a fix worked. **This is what makes the next diagnosis better.** | API key |
118
+ | `check_quota` | Your plan and remaining diagnoses this month. | API key |
119
+ | `recent_diagnoses` | Recall your recent diagnoses and their fixes. | API key |
120
+ | `ask_followup` | Conversational follow-up on a diagnosis. | Team plan / trial |
121
+ | `check_versions` | Flag known-bad CUDA/PyTorch/NCCL/driver combos. | Team plan / trial |
122
+ | `compare_runs` | "It worked yesterday", isolate what changed between a good run and a bad one. | Team plan / trial |
123
+ | `diff_environments` | Diff torch/CUDA/NCCL/driver versions and env vars between two runs. | Team plan / trial |
124
+ | `validate_checkpoint` | Find the newest checkpoint that is actually safe to resume from. | Team plan / trial |
125
+ | `preflight_check` | "Is this cluster safe to launch on?", blockers before you burn GPU-hours. | Scale plan |
126
+ | `node_health` | Score every monitored node, worst first. | Scale plan |
127
+ | `predict_failures` | Nodes trending toward a failure that has not happened yet. | Scale plan |
128
+ | `list_incidents` | Incidents Denpex's monitor caught & escalated on your fleet. | Scale plan |
129
+
130
+ Gated tools degrade gracefully, they tell you exactly which plan unlocks them and which
131
+ tools work on your current plan. The failure encyclopedia is also exposed as resources at
132
+ `denpex://failures/{slug}`.
133
+
134
+ **Structured output.** Every tool above returns `structuredContent` alongside its
135
+ markdown, validated against a declared output schema, so an agent branches on
136
+ `confidenceBand === "low"` or iterates `rankedHypotheses` instead of regexing prose.
137
+ Two fields deserve attention when you write the agent loop:
138
+
139
+ - **`confidence: null`** does not mean zero. It means the engine measured this band's
140
+ historical accuracy and declined to state a number. Treat the verdict as a lead. Do
141
+ not substitute the raw score.
142
+ - **`unfalsified: true`** identifies only the explicitly enabled reduced compatibility
143
+ fallback, where the canonical contradiction graph did not run. Normal cloud and
144
+ `DENPEX_LOCAL=1` diagnosis both use the canonical engine and set it to false.
145
+
146
+ ---
147
+
148
+ ## Environment variables
149
+
150
+ | Variable | Default | Purpose |
151
+ |----------|---------|---------|
152
+ | `DENPEX_API_KEY` |, | Your `dpx_…` key. Enables cloud tools. |
153
+ | `DENPEX_API_URL` | `https://api.denpex.com` | Override the API base (self-host / staging). |
154
+ | `DENPEX_LOCAL` | `0` | `1` → diagnose entirely on-host (zero egress). |
155
+ | `DENPEX_PRIVACY` | `off` | `mask` / `strict` → scrub PII from logs **before** they leave the machine. |
156
+
157
+ ---
158
+
159
+ ## Develop
160
+
161
+ ```bash
162
+ npm install
163
+ npm run build # regenerates the canonical engine + corpus, then bundles dist/index.js
164
+ npm test # 111 unit + protocol-integration tests
165
+ npm run inspector # interactive protocol inspector (MCP Inspector)
166
+ ```
167
+
168
+ The offline corpus (`src/data/denpex_patterns.json`) and canonical engine
169
+ (`src/offline/canonical-engine.mjs`) are generated from the repo's single source of truth
170
+ during `npm run build`, never hand-edit either artifact.