NVIDIA GPU Diagnostics
A demand-driven NVIDIA GPU monitor for VS Code with a minimal dark dashboard, Linux CUDA crash forensics, GitHub Copilot analysis, and a standards-based MCP server.
Features
- Full-size dark dashboard in a VS Code editor tab for charts, process inspection, kernel logs, and AI analysis.
- Minimal visual design using restrained blue and amber accents, neutral panels, and VS Code-like controls.
- Realtime GPU temperature, core utilization, VRAM, power, TDP, and PCIe throughput from
nvidia-smi.
- Top five NVIDIA compute processes ranked by VRAM, with PID revalidation, a modal warning, graceful termination, and force fallback.
- Locally bundled Chart.js Canvas 2D VRAM waterfall with a numerical fallback if chart rendering is unavailable.
- Display switches for GPU identity, thermal rings, VRAM history, process list, PCIe throughput, power/TDP, and CUDA kernel logs.
- Linux
dmesg / journalctl -k parsing for NVIDIA Xid and OOM-killer events. No elevated command is attempted.
- User-initiated AI diagnosis through the stable VS Code Language Model API and the user's available GitHub Copilot models.
- Extension-contributed stdio MCP server with three read-only tools:
get_gpu_realtime_metrics
get_gpu_process_list
diagnose_cuda_crash
Demand-driven resource model
The extension activates without querying the GPU. Telemetry begins only after the editor dashboard reports that it is ready and visible. Hiding or closing the dashboard cancels the recursive poll timer. Process queries are cached for five seconds, OS calls use bounded timeouts, and overlapping metric requests share one in-flight promise.
The UI uses Canvas 2D and never creates a WebGL, CUDA, NVML native binding, or compute context. VS Code/Electron itself can still use normal compositor resources according to the user's VS Code configuration.
Requirements
- VS Code 1.125.0 or newer.
- An NVIDIA driver that provides
nvidia-smi on the extension host.
- GitHub Copilot Chat is optional and only required for the AI analysis button.
- Linux is required for Xid/OOM kernel-log parsing. Access depends on the host's existing
dmesg or journal permissions.
In Remote SSH, Dev Containers, or WSL, the extension runs as a workspace extension and therefore inspects the remote/workspace host GPU.
Commands
Open the Command Palette and run:
- GPU Diagnostics: Open GPU Dashboard
- GPU Diagnostics: Analyze VRAM & CUDA Health with Copilot
Select the GPU Diagnostics icon in the Activity Bar, then choose Open Dashboard to display the full dashboard in the editor area.
Settings
| Setting |
Default |
Purpose |
gpuCyberDiag.gpuIndex |
0 |
Zero-based NVIDIA GPU index. |
gpuCyberDiag.pollIntervalMs |
1500 |
Visible-panel poll interval, bounded to 1000–10000 ms. |
gpuCyberDiag.nvidiaSmiPath |
empty |
Optional absolute nvidia-smi path. |
gpuCyberDiag.languageModel.family |
empty |
Optional Copilot model family; empty selects the first available model. |
gpuCyberDiag.diagnostics.maxKernelLogLines |
1200 |
Recent kernel lines inspected, bounded to 100–5000. |
Language-model consent and quota
AI analysis is never automatic. vscode.lm.selectChatModels and sendRequest are reached only from the Analyze command or a dashboard click. VS Code displays its model-access consent flow, and the request consumes the user's configured Copilot allowance. The extension deliberately has no hard dependency on GitHub Copilot Chat, so all local telemetry and MCP features continue to work without it.
Model output is displayed as text rather than executable HTML. Process names and kernel text are labeled untrusted in the prompt to reduce prompt-injection risk.
MCP usage
After installation, VS Code discovers NVIDIA GPU & CUDA Diagnostics through the extension's MCP definition provider. Open the Chat tools picker to enable its tools. The MCP process starts on demand and exits when its stdio client closes; it does not create a background telemetry daemon.
For local development, the included .vscode/mcp.json launches dist/mcpServer.js. Run npm run compile before starting that server, then use MCP: List Servers to inspect logs or restart it.
Security notes
- Commands execute with
execFile, argument arrays, shell: false, output limits, and timeouts.
- A process can be terminated only if a fresh
nvidia-smi query still reports that PID on the selected GPU.
- The webview uses a restrictive nonce CSP. Telemetry is inserted through
textContent.
- Kernel diagnostics are read-only. The extension never invokes
sudo or changes system logging permissions.
- The MCP tools are read-only and marked with
readOnlyHint.
Development
- Install dependencies with
npm install.
- Build both bundles with
npm run compile.
- Press
F5 and choose Run GPU Cyber Dashboard. The Extension Development Host opens in a separate window and displays the dashboard automatically.
- Run
npm run package for a production bundle.
The extension bundle is dist/extension.js; the independent MCP stdio bundle is dist/mcpServer.js.
Publishing
See MARKETPLACE_PUBLISH_GUIDE.md for PAT creation, Publisher setup, VSIX validation, and Marketplace publication.
License
MIT