denpex-mcp 0.1.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 (3) hide show
  1. package/README.md +140 -0
  2. package/dist/index.js +1023 -0
  3. package/package.json +57 -0
package/README.md ADDED
@@ -0,0 +1,140 @@
1
+ # Denpex MCP server
2
+
3
+ Diagnose GPU/ML training failures — CUDA OOM, NCCL timeouts, Xid faults, NaN loss,
4
+ checkpoint corruption — **without leaving your AI tool**. Ask Claude Desktop, Cursor,
5
+ or Claude Code to *"diagnose the crash in `./logs/train.err`"* and Denpex reads the log
6
+ straight off disk and hands back the root cause and the fix.
7
+
8
+ - 🩺 **Root cause + escalating fix** (primary → fallback → emergency), verification command, and prevention.
9
+ - 🧭 **Find the culprit rank** in a distributed/NCCL hang, and route GPU Xid faults to the right node action — offline, instantly.
10
+ - 📚 **312-class failure encyclopedia** searchable by error code or symptom.
11
+ - 🔒 **Zero-egress mode** (`DENPEX_LOCAL=1`): diagnose entirely on-host, nothing leaves the machine. Plus client-side PII scrubbing even in cloud mode.
12
+
13
+ ---
14
+
15
+ ## Quick start (60 seconds)
16
+
17
+ ### 1. Get an API key (optional but recommended)
18
+
19
+ Sign in at **[denpex.com/dashboard](https://denpex.com/dashboard) → API Keys** and create a key (`dpx_…`).
20
+ The key unlocks the cloud LLM fallback on novel errors, your diagnosis history, quota, and
21
+ fleet incidents. *Without a key, `diagnose_crash`, `lookup_failure`, and `analyze_cascade`
22
+ still work fully offline.*
23
+
24
+ ### 2. Add it to your client
25
+
26
+ <details open>
27
+ <summary><b>Claude Desktop</b></summary>
28
+
29
+ Edit `claude_desktop_config.json`
30
+ (macOS: `~/Library/Application Support/Claude/`, Windows: `%APPDATA%\Claude\`):
31
+
32
+ ```json
33
+ {
34
+ "mcpServers": {
35
+ "denpex": {
36
+ "command": "npx",
37
+ "args": ["-y", "denpex-mcp"],
38
+ "env": { "DENPEX_API_KEY": "dpx_your_key_here" }
39
+ }
40
+ }
41
+ }
42
+ ```
43
+ Restart Claude Desktop.
44
+ </details>
45
+
46
+ <details>
47
+ <summary><b>Cursor</b></summary>
48
+
49
+ Create `.cursor/mcp.json` in your project (or `~/.cursor/mcp.json` globally):
50
+
51
+ ```json
52
+ {
53
+ "mcpServers": {
54
+ "denpex": {
55
+ "command": "npx",
56
+ "args": ["-y", "denpex-mcp"],
57
+ "env": { "DENPEX_API_KEY": "dpx_your_key_here" }
58
+ }
59
+ }
60
+ }
61
+ ```
62
+ </details>
63
+
64
+ <details>
65
+ <summary><b>Claude Code</b></summary>
66
+
67
+ ```bash
68
+ claude mcp add denpex -e DENPEX_API_KEY=dpx_your_key_here -- npx -y denpex-mcp
69
+ ```
70
+ </details>
71
+
72
+ ### 3. Use it
73
+
74
+ > "My training job crashed — diagnose the log at `./logs/rank0.err`."
75
+ > "What does Xid 79 mean?"
76
+ > "This 64-GPU run is hung. Which rank failed first?" *(→ `analyze_cascade`)*
77
+
78
+ Or pick the **`diagnose-training-crash`** prompt your client surfaces.
79
+
80
+ ---
81
+
82
+ ## Offline / air-gapped mode
83
+
84
+ Diagnose entirely on-host — no network, no logs leaving the cluster. Ideal for VPCs,
85
+ secure data centers, and privacy-sensitive labs. Add `DENPEX_LOCAL=1`:
86
+
87
+ ```json
88
+ { "mcpServers": { "denpex": {
89
+ "command": "npx", "args": ["-y", "denpex-mcp"],
90
+ "env": { "DENPEX_LOCAL": "1" }
91
+ } } }
92
+ ```
93
+
94
+ The bundled engine (31 fast patterns + the 312-class encyclopedia + Xid routing + cascade
95
+ localization) covers the overwhelming majority of real failures. The LLM fallback for novel
96
+ errors is cloud-only and simply unavailable offline.
97
+
98
+ ---
99
+
100
+ ## Tools
101
+
102
+ | Tool | What it does | Needs |
103
+ |------|--------------|-------|
104
+ | `diagnose_crash` | Root cause + escalating fix from `logs` / `file` / `dir`. | works offline |
105
+ | `lookup_failure` | Search the 312-class encyclopedia by code/keyword/symptom. | works offline |
106
+ | `analyze_cascade` | Find the culprit rank in a distributed hang; route Xid faults. | works offline |
107
+ | `check_quota` | Your plan and remaining diagnoses this month. | API key |
108
+ | `recent_diagnoses` | Recall your recent diagnoses and their fixes. | API key |
109
+ | `ask_followup` | Conversational follow-up on a diagnosis. | Team plan / trial |
110
+ | `check_versions` | Flag known-bad CUDA/PyTorch/NCCL/driver combos. | Team plan / trial |
111
+ | `list_incidents` | Incidents Denpex's monitor caught & escalated on your fleet. | Scale plan |
112
+
113
+ Gated tools degrade gracefully — they tell you exactly which plan unlocks them and which
114
+ tools work on your current plan. The failure encyclopedia is also exposed as resources at
115
+ `denpex://failures/{slug}`.
116
+
117
+ ---
118
+
119
+ ## Environment variables
120
+
121
+ | Variable | Default | Purpose |
122
+ |----------|---------|---------|
123
+ | `DENPEX_API_KEY` | — | Your `dpx_…` key. Enables cloud tools. |
124
+ | `DENPEX_API_URL` | `https://api.denpex.com` | Override the API base (self-host / staging). |
125
+ | `DENPEX_LOCAL` | `0` | `1` → diagnose entirely on-host (zero egress). |
126
+ | `DENPEX_PRIVACY` | `off` | `mask` / `strict` → scrub PII from logs **before** they leave the machine. |
127
+
128
+ ---
129
+
130
+ ## Develop
131
+
132
+ ```bash
133
+ npm install
134
+ npm run build # regenerates the offline corpus, then bundles dist/index.js
135
+ npm test # 48 unit + protocol-integration tests
136
+ npm run inspector # interactive protocol inspector (MCP Inspector)
137
+ ```
138
+
139
+ The offline corpus (`src/data/denpex_patterns.json`) is generated from the repo's single
140
+ source of truth via `npm run bundle:patterns` — never hand-edit it.