GDB-MCP

smadi0x86/GDB-MCP

3.3

If you are the rightful owner of GDB-MCP and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

A Model Context Protocol (MCP) server that enables LLM clients to interact with GDB for debugging and binary analysis.

Tools
  1. gdb_start

    Start new GDB session

  2. gdb_terminate

    Terminate session

  3. gdb_list_sessions

    List active sessions

  4. gdb_load

    Load program

  5. gdb_attach

    Attach to process

  6. gdb_load_core

    Load core dump

  7. gdb_continue

    Continue execution

  8. gdb_step

    Step into functions

  9. gdb_next

    Step over functions

  10. gdb_finish

    Finish current function

  11. gdb_set_breakpoint

    Set breakpoint

  12. gdb_backtrace

    Show call stack

  13. gdb_print

    Print expression

  14. gdb_examine

    Examine memory

  15. gdb_info_registers

    Show registers

  16. gdb_disassemble_function

    Disassemble function

  17. gdb_disassemble_around_pc

    Disassemble around PC

  18. gdb_get_local_variables

    Get local variables

  19. gdb_get_stack_frames

    Get stack information

  20. gdb_get_register_values

    Get register values

  21. gdb_read_memory_bytes

    Read memory

  22. gdb_get_thread_info

    Get thread information

  23. gdb_get_breakpoint_list

    List breakpoints

  24. gdb_set_watchpoint

    Set watchpoint

  25. gdb_get_symbol_info

    Get symbol info

  26. gdb_command

    Execute any GDB command

GDB MCP Server

A Model Context Protocol (MCP) server that enables LLM clients to interact with GDB for debugging and binary analysis.

Quick Start

uv sync
uv venv
uv run server.py

Integration

Note that you can use uv run to run the server.py script or you can use uv venv to create a virtual environment and then run /home/youruser/dev/personal/GDB-MCP/.venv/bin/python /home/youruser/dev/personal/GDB-MCP/server.py.

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "gdb": {
      "command": "uv",
      "args": ["run", "/home/youruser/dev/personal/GDB-MCP/server.py"],
      "disabled": false
    }
  }
}

VSCode Copilot

If you're using WSL:

 "mcp": {
    "servers": {
      "my-mcp-server-4dc36648": {
        "type": "stdio",
        "command": "wsl",
        "args": [
          "/home/youruser/dev/personal/GDB-MCP/.venv/bin/python",
          "/home/youruser/dev/personal/GDB-MCP/server.py"
        ]
      }
    }
  }

If you're not using WSL:

  "mcp": {
    "servers": {
      "my-mcp-server-db89eee1": {
        "type": "stdio",
        "command": "/home/youruser/dev/personal/GDB-MCP/.venv/bin/python",
        "args": ["/home/youruser/dev/personal/GDB-MCP/server.py"]
      }
    }
  }

Available Tools

Session Management

  • gdb_start(): Start new GDB session
  • gdb_terminate(session_id): Terminate session
  • gdb_list_sessions(): List active sessions

Program Loading

  • gdb_load(session_id, program_path): Load program
  • gdb_attach(session_id, pid): Attach to process
  • gdb_load_core(session_id, core_file): Load core dump

Execution Control

  • gdb_continue(session_id): Continue execution
  • gdb_step(session_id): Step into functions
  • gdb_next(session_id): Step over functions
  • gdb_finish(session_id): Finish current function

Debugging

  • gdb_set_breakpoint(session_id, location): Set breakpoint
  • gdb_backtrace(session_id): Show call stack
  • gdb_print(session_id, expression): Print expression
  • gdb_examine(session_id, address): Examine memory
  • gdb_info_registers(session_id): Show registers

Advanced Analysis

  • gdb_disassemble_function(session_id, function_name): Disassemble function
  • gdb_disassemble_around_pc(session_id, count): Disassemble around PC
  • gdb_get_local_variables(session_id): Get local variables
  • gdb_get_stack_frames(session_id): Get stack information
  • gdb_get_register_values(session_id): Get register values
  • gdb_read_memory_bytes(session_id, address, count): Read memory
  • gdb_get_thread_info(session_id): Get thread information
  • gdb_get_breakpoint_list(session_id): List breakpoints
  • gdb_set_watchpoint(session_id, expression): Set watchpoint
  • gdb_get_symbol_info(session_id, symbol): Get symbol info

General

  • gdb_command(session_id, command): Execute any GDB command

Testing

uv run python run-tests.py --check-deps
uv run python run-tests.py --type all

Examples

Check the examples directory for example prompts.

License

This project is licensed under the GNU Version 3.0 License, see the LICENSE file for details.