GDB Debugger MCP server

Integrates with GDB to provide debugging capabilities for C/C++ programs, enabling breakpoint setting, code stepping, memory examination, and call stack viewing without leaving the conversation interface.
Back to servers
Provider
signal-slot
Release date
Mar 21, 2025
Language
TypeScript
Package
Stats
166 downloads
12 stars

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.

Installation

# 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

Configuration

To use the MCP GDB Server with Claude or other MCP-enabled assistants:

  1. Configure the MCP settings in the Claude desktop app or browser extension:
{
  "mcpServers": {
    "gdb": {
      "command": "node",
      "args": ["/path/to/mcp-gdb/build/index.js"],
      "disabled": false
    }
  }
}
  1. Restart Claude or refresh the page to apply the settings.

Using GDB Commands

Once configured, you can use various GDB commands through your conversation with Claude. Here are the key commands:

Starting and Loading

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

Setting Breakpoints and Running

Use gdb_set_breakpoint to set a breakpoint at main in the active GDB session
Use gdb_continue to start execution

Debugging Commands

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

Supported Commands

Session Management

  • gdb_start: Start a new GDB session
  • gdb_terminate: Terminate a GDB session
  • gdb_list_sessions: List all active GDB sessions

Program Control

  • gdb_load: Load a program into GDB
  • gdb_attach: Attach to a running process
  • gdb_load_core: Load a core dump file

Execution Control

  • gdb_continue: Continue program execution
  • gdb_step: Step program execution
  • gdb_next: Step over function calls
  • gdb_finish: Execute until the current function returns

Inspection

  • gdb_backtrace: Show call stack
  • gdb_print: Print value of expression
  • gdb_examine: Examine memory
  • gdb_info_registers: Display registers
  • gdb_set_breakpoint: Set a breakpoint

Generic Command

  • gdb_command: Execute an arbitrary GDB command

How to add this MCP server to Cursor

There 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.

Adding an MCP server to Cursor globally

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"
            ]
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later