A NeoVim plugin that exposes nvim-dap debugging functionality via the Model Context Protocol (MCP) through mcphub.nvim.
This allows any chat plugin that supports MCP to control debugging sessions, set breakpoints, step through code, and evaluate expressions.
run
- Start a new debug session with full configuration (no user interaction)continue
- Continue execution of a paused debug sessionterminate
- Terminate the current debug sessiondisconnect
- Disconnect from the debug adapterstatus
- Get current debug session status
set_breakpoint_at
- Set a breakpoint at a specific file and line numberremove_breakpoint_at
- Remove a specific breakpoint at file and lineclear_breakpoints
- Clear all breakpointslist_breakpoints
- List all breakpoints and log pointsget_breakpoints
- Get detailed information about all breakpoints and log points
step_over
- Step over the current linestep_into
- Step into the current function or methodstep_out
- Step out of the current function or methodrun_to
- Run execution to a specific file and line number
evaluate
- Evaluate expressions in debug contextget_program_output
- Get the output from the running/debugged programget_current_location
- Get the current execution location in the debuggerwait_until_paused
- Wait until the debugger is paused
dap://session
- Current debug session informationdap://stack
- Current stack trace informationdap://output
- Current program output (all categories combined)dap://output/{category}
- Program output filtered by category (stdout, stderr, console)dap://output/recent/{lines}
- Recent program output (specify number of lines)mcpdap://breakpoints
- List all currently set breakpoints in JSON format
- nvim-dap - Debug Adapter Protocol client
- mcphub.nvim - MCP integration for Neovim
Using lazy.nvim
{
"guill/mcpdap.nvim",
dependencies = {
"mfussenegger/nvim-dap",
"ravitemer/mcphub.nvim"
},
config = function()
-- Then setup mcpdap
require('mcpdap').setup({})
end
}
-
Install the dependencies:
- nvim-dap
- mcphub.nvim
-
Add this plugin to your configuration
-
In your init.lua, after setting up mcphub:
-- Setup mcphub first
require('mcphub').setup({
-- your mcphub configuration
})
-- Then register the DAP MCP server
require('mcpdap').setup({})
Once installed, the DAP tools will be available in any MCP-compatible chat plugin through mcphub.
Start debugging with full configuration:
Use the run tool to start debugging:
- type: "python"
- request: "launch"
- name: "Debug current file"
- program: "${file}"
Start debugging a specific Python script:
Run a debug session with type "python", request "launch", name "Debug main.py", program "/path/to/main.py", and args ["-v", "--debug"]
Attach to a running process:
Start a debug session to attach to a process:
- type: "python"
- request: "attach"
- name: "Attach to server"
- host: "localhost"
- port: 5678
Continue a paused session:
Use the continue tool to resume execution
Set a breakpoint:
Set a breakpoint at line 25 in file main.py
Step through code:
Step over the current line, then step into the next function call
Evaluate expressions:
Evaluate the expression "user.name" in the current debug context
Get session info:
Show me the current debug session status
The plugin works with your existing nvim-dap configuration. Make sure you have:
- Debug adapters configured for your languages
- Launch configurations set up
- nvim-dap working properly
Example nvim-dap setup for Python:
local dap = require('dap')
-- Configure Python debug adapter
dap.adapters.python = {
type = 'executable',
command = 'python',
args = { '-m', 'debugpy.adapter' },
}
-- Configure Python debug configurations
dap.configurations.python = {
{
type = 'python',
request = 'launch',
name = "Launch file",
program = "${file}",
pythonPath = function()
return vim.fn.exepath('python3')
end,
},
}
- Ensure nvim-dap is properly installed and configured
- Verify mcphub.nvim is set up correctly
- Check that you're requiring mcpdap after mcphub.setup()
- Make sure you have debug adapters configured for your language
- Verify your launch configurations are correct
- Test nvim-dap directly first to ensure it's working
- Check mcphub is running:
:MCPHub
- Verify the DAP server is connected in the mcphub UI
- Look for error messages in
:messages
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License - see LICENSE file for details.