Advanced debugging for Node.js and TypeScript applications with AI-powered features through the Model Context Protocol (MCP).
This package is now maintained in its own repository: https://github.com/Digital-Defiance/vscode-mcp-debugger
This repository is part of the AI Capabilitites Suite on GitHub.
- Smart Breakpoints: AI-suggested breakpoint locations based on code analysis
- Conditional Breakpoints: Break only when specific conditions are met
- Hang Detection: Automatically detect infinite loops and hanging processes
- Source Map Support: Debug TypeScript with full source map integration
- CPU Profiling: Identify performance bottlenecks
- Memory Profiling: Take heap snapshots and detect memory leaks
- Performance Timeline: Track execution events and timing
- GitHub Copilot Ready: Works seamlessly with GitHub Copilot
- MCP Protocol: Exposes debugging capabilities to AI agents
- Smart Suggestions: AI-powered debugging recommendations
- Jest: Debug Jest tests with breakpoints
- Mocha: Debug Mocha tests
- Vitest: Debug Vitest tests
- Open VS Code
- Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
- Search for "TypeScript MCP Debugger"
- Click Install
The extension requires the MCP debugger server to function. Install it globally:
npm install -g @ai-capabilities-suite/mcp-debugger-serverOr install it in your project:
npm install --save-dev @ai-capabilities-suite/mcp-debugger-servercode --install-extension ts-mcp-debugger-1.0.0.vsixOption A: Use Command Palette
- Open a JavaScript or TypeScript file
- Press
Ctrl+Shift+P(Cmd+Shift+P on Mac) - Type "MCP Debugger: Start Debug Session"
- Press Enter
Option B: Use Debug Configuration
- Open the Debug view (Ctrl+Shift+D / Cmd+Shift+D)
- Click "create a launch.json file"
- Select "MCP Node.js Debugger"
- Press F5 to start debugging
- Open a file that might have infinite loops
- Press
Ctrl+Shift+P(Cmd+Shift+P on Mac) - Type "MCP Debugger: Detect Hanging Process"
- View hang detection results
- Place cursor on a line
- Right-click and select "MCP Debugger: Set Smart Breakpoint"
- Choose from AI-suggested breakpoint locations
Configure the extension in VS Code settings (Ctrl+, / Cmd+,):
{
"mcp-debugger.serverPath": "",
"mcp-debugger.autoStart": true,
"mcp-debugger.defaultTimeout": 30000,
"mcp-debugger.enableHangDetection": true,
"mcp-debugger.hangDetectionTimeout": 5000,
"mcp-debugger.enableProfiling": false,
"mcp-debugger.logLevel": "info"
}Add to .vscode/launch.json:
{
"type": "mcp-node",
"request": "launch",
"name": "MCP Debug Current File",
"program": "${file}",
"cwd": "${workspaceFolder}",
"enableHangDetection": true
}{
"type": "mcp-node",
"request": "launch",
"name": "MCP Debug with Profiling",
"program": "${workspaceFolder}/index.js",
"cwd": "${workspaceFolder}",
"enableProfiling": true,
"enableHangDetection": true
}{
"type": "mcp-node",
"request": "launch",
"name": "MCP Debug Jest",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["--runInBand"],
"cwd": "${workspaceFolder}",
"enableHangDetection": true
}| Command | Description | Shortcut |
|---|---|---|
MCP Debugger: Start Debug Session |
Start debugging current file | - |
MCP Debugger: Detect Hanging Process |
Detect infinite loops | - |
MCP Debugger: Set Smart Breakpoint |
Set AI-suggested breakpoint | - |
MCP Debugger: Start CPU Profiling |
Start CPU profiler | - |
MCP Debugger: Take Heap Snapshot |
Take memory snapshot | - |
// app.js
function calculateSum(numbers) {
let sum = 0;
for (let i = 0; i < numbers.length; i++) {
sum += numbers[i];
}
return sum;
}
const result = calculateSum([1, 2, 3, 4, 5]);
console.log(result);- Open
app.js - Set a breakpoint on line 3 (inside the loop)
- Press F5 to start debugging
- Step through the code with F10 (Step Over)
- Inspect variables in the Debug sidebar
// hang.js
function infiniteLoop() {
let i = 0;
while (true) {
i++;
// This will hang forever
}
}
infiniteLoop();- Open
hang.js - Run "MCP Debugger: Detect Hanging Process"
- View hang detection results showing the infinite loop location
// slow.js
function slowFunction() {
let result = 0;
for (let i = 0; i < 1000000; i++) {
result += Math.sqrt(i);
}
return result;
}
slowFunction();- Open
slow.js - Start debugging with profiling enabled
- Run "MCP Debugger: Start CPU Profiling"
- Let the code execute
- View CPU profile to identify bottlenecks
The MCP Debugger works seamlessly with GitHub Copilot for AI-assisted debugging:
- Debugging Context: Copilot can access debugging information
- Smart Suggestions: Get AI-powered debugging recommendations
- Breakpoint Suggestions: Copilot suggests optimal breakpoint locations
- Error Analysis: Copilot helps analyze errors and exceptions
- Autonomous Debugging: Copilot can debug code automatically
- Open Copilot Chat (Ctrl+Shift+I / Cmd+Shift+I)
- Ask: "Debug this file and find the bug"
- Copilot will automatically use the MCP Debugger tools
You: "Debug this function and tell me why it returns undefined"
Copilot: [Starts debug session, sets breakpoints, inspects variables, explains issue]
You: "Check if this script has an infinite loop"
Copilot: [Uses hang detection, identifies loop location, suggests fix]
You: "Why is this function so slow?"
Copilot: [Profiles code, identifies bottlenecks, suggests optimizations]
See the Copilot Integration Guide for:
- Detailed setup instructions
- Complete debugging workflows
- Example conversations
- Tips and best practices
- Troubleshooting guide
Problem: Extension shows "MCP Debugger server not running"
Solution:
- Check if Node.js is installed:
node --version - Install MCP server:
npm install -g @ai-capabilities-suite/mcp-debugger-server - Set custom server path in settings if needed
- Restart VS Code
Problem: Breakpoints are not being hit
Solution:
- Ensure source maps are enabled for TypeScript
- Check that file paths are absolute
- Verify the program is actually executing the code
- Try setting a breakpoint on the first line
Problem: Hang detection reports hangs for legitimate long-running operations
Solution:
- Increase
mcp-debugger.hangDetectionTimeoutin settings - Disable hang detection for specific debug sessions
- Use conditional breakpoints instead
Problem: Debugging is slow
Solution:
- Disable profiling if not needed
- Reduce number of breakpoints
- Increase timeout values
- Close other VS Code extensions
- VS Code: Version 1.85.0 or higher
- Node.js: Version 16.x or higher
- Operating System: Windows, macOS, or Linux
This extension contributes the following settings:
mcp-debugger.serverPath: Path to MCP debugger server executablemcp-debugger.autoStart: Automatically start MCP server when VS Code opensmcp-debugger.defaultTimeout: Default timeout for debug operations (ms)mcp-debugger.enableHangDetection: Enable automatic hang detectionmcp-debugger.hangDetectionTimeout: Timeout for hang detection (ms)mcp-debugger.enableProfiling: Enable performance profiling featuresmcp-debugger.logLevel: Log level (debug, info, warn, error)
- WebSocket connections may timeout on slow networks
- Source maps must be inline or in the same directory
- Some Node.js native modules may not be debuggable
Initial release:
- Advanced debugging with MCP integration
- Hang detection
- CPU and memory profiling
- Smart breakpoint suggestions
- GitHub Copilot integration
- Test framework support (Jest, Mocha, Vitest)
Found a bug or have a feature request? Please open an issue on GitHub.
MIT License - see LICENSE file for details.
Enjoy debugging with AI! 🚀