The MCP GDB Server enables AI assistants like Claude to provide GDB debugging functionality, allowing you to debug programs, analyze core dumps, inspect variables, and manage breakpoints through an AI conversation interface.
# Clone the repository
git clone https://github.com/signal-slot/mcp-gdb.git
cd mcp-gdb
# Install dependencies
npm install
# Build the project
npm run build
To use the MCP GDB Server with Claude or other MCP-enabled assistants:
{
"mcpServers": {
"gdb": {
"command": "node",
"args": ["/path/to/mcp-gdb/build/index.js"],
"disabled": false
}
}
}
Once configured, you can use various GDB commands through your conversation with Claude. Here are the key commands:
Use gdb_start to start a new debugging session
Use gdb_load to load /path/to/my/program with the sessionId that was returned from gdb_start
Use gdb_set_breakpoint to set a breakpoint at main in the active GDB session
Use gdb_continue to start execution
Use gdb_print to evaluate the expression "my_variable" in the current context
Use gdb_backtrace to see the current call stack
Use gdb_terminate to end the debugging session
gdb_start
: Start a new GDB sessiongdb_terminate
: Terminate a GDB sessiongdb_list_sessions
: List all active GDB sessionsgdb_load
: Load a program into GDBgdb_attach
: Attach to a running processgdb_load_core
: Load a core dump filegdb_continue
: Continue program executiongdb_step
: Step program executiongdb_next
: Step over function callsgdb_finish
: Execute until the current function returnsgdb_backtrace
: Show call stackgdb_print
: Print value of expressiongdb_examine
: Examine memorygdb_info_registers
: Display registersgdb_set_breakpoint
: Set a breakpointgdb_command
: Execute an arbitrary GDB commandThere are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.