gdb-mcp
Multi-session GDB control for Claude Code, Codex, Gemini CLI, and any MCP client.
gdb-mcp (PyPI package beacox-gdb-mcp) is a
Model Context Protocol server that drives
GDB over GDB/MI. It provides isolated multi-session debugging for local Linux
executables, core dumps, gdbserver targets, and rr time-travel traces.
Why gdb-mcp
- Lazy startup:
gdb-mcpanswersinitialize,tools/list,resources/*, andprompts/*immediately; GDB starts only on the first tool call. - Explicit multi-session safety: every session requires a
session_id; raw execution, inferior calls, and memory writes require--unsafe. - Bounded, selectable tool surface: use
--tool-profile core(29 tools) or--tools/--exclude-toolson schema-constrained clients:
| Profile | Tools | tools/list Size |
3-Scenario Total (Schema + Calls) |
|---|---|---|---|
full (default) |
98 | 51,909 B (~17,303 tok) | 61,286 B (~20,436 tok) |
core |
29 | 13,648 B (~4,550 tok) | 23,025 B (~7,683 tok) |
Measured with scripts/measure_tools.py and scripts/run_eval_harness.py --compare-profiles
(core cuts upfront schema tokens by 73.7% and total session tokens by 62.4%).
Requirements & Platform Setup
- Linux (local attach, core files, and
gdbserverrequire Linux) - Python 3.10+ and
uv(recommended foruv tool install) gdbonPATH; optionalgdbserverandrr
sudo apt-get install -y gcc gdb
sudo apt-get install -y gdbserver rr # optional
Linux kernel / container permissions (checked automatically by gdb-mcp doctor):
# Allow gdb_attach on non-child processes:
sudo sysctl kernel.yama.ptrace_scope=0
# Allow rr hardware performance counters:
sudo sysctl kernel.perf_event_paranoid=1
# Inside Docker / OCI containers:
docker run -i --rm --cap-add=SYS_PTRACE --security-opt seccomp=unconfined ...
# Add --pid=host when attaching to host processes.
Install
uv tool install beacox-gdb-mcp
Verify
gdb-mcp --version
gdb-mcp doctor
Configure Your Agent
claude mcp add --scope user gdb -- gdb-mcp
codex mcp add gdb -- gdb-mcp
gemini mcp add gdb -- gdb-mcp
Generate JSON snippets for Cursor, VS Code, Windsurf, Claude, Codex, or Gemini:
gdb-mcp config cursor --installed
gdb-mcp config vscode --installed
For clients that preload all tool schemas (such as Claude Desktop or smaller
context windows), pass --tool-profile core:
claude mcp add --scope user gdb -- gdb-mcp --tool-profile core
Update
uv tool upgrade beacox-gdb-mcp
Then restart your MCP client.
Quick Start
Ask your coding agent:
Use GDB MCP to debug /tmp/gdb-mcp-hello. Set a breakpoint at add, run, show the
current location, backtrace, locals, then continue once.
Typical tool flow: gdb_create_session -> gdb_set_breakpoint ->
gdb_run_and_context -> gdb_context / gdb_eval_expression /
gdb_read_memory -> gdb_close_session. For stripped binaries, switch to
gdb_pwn_context, gdb_vmmap_structured, gdb_telescope, and gdb_symbols.
Unsafe Mode & Shutdown
Raw gdb_execute, inferior calls, variable/memory writes, and init_file are
disabled by default. Enable them explicitly with gdb-mcp --unsafe or
GDB_MCP_ALLOW_UNSAFE=1.
On stdin EOF, SIGTERM, or SIGKILL of the proxy, PR_SET_PDEATHSIG and
session process groups (start_new_session=True + os.killpg) terminate all
spawned backend, GDB, and gdbserver processes without orphans. See
docs/TRANSPORTS.md for HTTP mode, environment variables,
and shutdown details.
Documentation
Metadata
Release files for beacox-gdb-mcp 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| beacox_gdb_mcp-0.6.0.tar.gz | 179.0 kB | With provenance | Details for beacox_gdb_mcp-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| beacox_gdb_mcp-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for beacox_gdb_mcp-0.6.0-py3-none-any.whl |
Total release size: 290.3 kB
Release files / beacox_gdb_mcp-0.6.0.tar.gz
| Download URL | beacox_gdb_mcp-0.6.0.tar.gz |
|---|---|
| Size | 179.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
31d4dad5c568ee0bcfd4e35eee67f71664a92ef0b0d5083c3a46eabbe6bbf7dd
|
|
BLAKE2b-256 checksum How to use checksums |
36b40fa07359ca56daff33a2215d8661570ba7d692d039faac381264e7f7e5a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logRelease files / beacox_gdb_mcp-0.6.0-py3-none-any.whl
| Download URL | beacox_gdb_mcp-0.6.0-py3-none-any.whl |
|---|---|
| Size | 111.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
604f157fd8ad265d5ea67d6d02021f0160d2af714e4df708d3b89735162122f7
|
|
BLAKE2b-256 checksum How to use checksums |
22ac3e849651b7358d56942b5c34f2f328b68282f8c0015c7250e7fa9c78b3fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logSecurity for beacox-gdb-mcp 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for beacox_gdb_mcp-0.6.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.