GDB Lite MCP
The GDB Lite MCP server enables LLM agents to programmatically control native GDB debugging sessions. Key capabilities include:
gdb_spawn: Start a new GDB session for a local program, core file, attached PID, or remote target, with support for custom working directories, extra GDB arguments, and environment variables.gdb_exec: Execute any GDB command(s) in a session, with support for batching multiple commands, configurable timeouts, output size limits, and polling for output. Returns structured metadata:completion_reason,at_prompt,command_pending,needs_interrupt,timed_out,truncated, byte counts, and duration.gdb_interrupt: Send SIGINT to interrupt a hung GDB session or its debuggee and wait for the GDB prompt to return.gdb_close: Terminate and clean up a GDB session bysession_id.gdb-lite://debug-guide: Access a built-in debug guide resource.Full native GDB access: Since commands are passed directly to GDB, agents can use breakpoints, watchpoints, Python snippets, backtrace, core inspection, and more without additional wrappers.
Configuration: Control the GDB executable path, maximum concurrent sessions, and per-session output buffer size via environment variables.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@GDB Lite MCPStart a GDB session and examine a crash"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
GDB Lite MCP
A small TypeScript MCP server for driving GDB sessions from LLM agents.
GDB Lite MCP intentionally exposes only a thin set of primitives around native GDB. Agents can spawn sessions, execute GDB commands, interrupt hung programs, and close sessions while still using normal GDB features such as breakpoints, watchpoints, command lists, Python snippets, core files, attach, and remote targets.
Requirements
Node.js 20 or newer
GDB available on
PATHA native compiler such as
gccif you want to build the repository scenarios
Related MCP server: gdb and rr Debugging
Install
npm install
npm run buildRun the server locally:
npm startThe package also exposes a gdb-lite-mcp binary after it has been built.
The npm package is intentionally limited to the runtime server, debug guide,
and debugging Skill. The eval/scenarios/ directory contains repository
development assets; clone this repository if you want to run them locally.
MCP Configuration
Point your MCP client at the published package via npx:
{
"mcpServers": {
"gdb-lite": {
"command": "npx",
"args": ["-y", "gdb-lite-mcp"]
}
}
}For repository-local evaluation, eval/run_eval.py writes a temporary
opencode.json that starts the same server from the built dist/index.js.
Runtime environment variables:
GDB_LITE_GDB_PATH: GDB executable path. Defaults togdb.GDB_LITE_MAX_SESSIONS: maximum live sessions. Defaults to8; must be a positive integer.GDB_LITE_MAX_INTERNAL_BUFFER_CHARS: per-session retained output buffer. Defaults to4194304; must be a positive integer.GDB_LITE_AUTO_INIT: set to0,false,no, oroffto disable automatic startup defaults.
Invalid runtime configuration values fail fast when the server starts.
Tools
The server registers these MCP tools:
Tool | Purpose |
| Start a GDB session for a local program, core file, attached PID, or remote target. |
| Send a native GDB command, poll output with an empty command, or list sessions with an empty or unknown |
| Send SIGINT and wait for GDB to return to a prompt. |
| Terminate and remove a GDB session, or return the current session list when |
gdb_exec and gdb_interrupt return structured state such as
completion_reason (completed, timeout, or exited), at_prompt,
command_pending, needs_interrupt, timed_out, truncated, and byte counts.
Use this metadata to avoid stacking commands behind a still-running inferior.
Calls on the same session are not queued; concurrent gdb_exec or
gdb_interrupt requests are rejected.
The server also exposes a gdb-lite://debug-guide resource backed by
GUIDE.md.
Example Workflow
gdb_spawn({
"prog_path": "bin/program",
"work_dir": "/absolute/path/to/debug-workspace"
})
gdb_exec({
"session_id": "...",
"command": "break main\nrun\nbt\ninfo locals",
"timeout": 5
})
gdb_close({
"session_id": "..."
})Prefer batching related GDB commands in one tool call. For hangs, let the run
time out, call gdb_interrupt, then inspect bt, info threads, and relevant
locals before continuing.
Debugging Skill
The skills/gdb-debugging directory contains an agent Skill with focused
debugging workflows for:
crashes
hangs
memory corruption
recursion issues
wrong results
GDB Python probes
Agents that support repository-local Skills should read
skills/gdb-debugging/SKILL.md before using the MCP tools.
Scenarios
The repository eval/scenarios directory contains small native debugging tasks
used to evaluate the MCP server and Skill. It is not included in the npm
package.
Build all scenario binaries:
python3 eval/scenarios/build_scenarios.pyEach scenario writes local build artifacts under eval/scenarios/<name>/build/,
which is ignored by Git.
Evaluation
Repository-local evaluation prompts and config live under eval/. They are not
included in the npm package.
npm run build
python3 eval/run_eval.py --scenario hang-tokenizerRun outputs are written under eval/runs/, which is ignored because it is a
local evaluation result artifact.
Development
npm run build
npm testGenerated artifacts such as dist/, node_modules/, scenario build
directories, logs, and local evaluation results are ignored by Git.
License
MIT. See LICENSE.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Mort2000/gdb-lite-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server