gdb-mcp
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-mcpstart debugging ./mybinary"
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-mcp
Model Context Protocol server that wraps gdb so an LLM can drive live debugging
sessions. The server exposes tools for starting a session on a binary, attaching
to an existing PID, running ad-hoc commands, batching commands, checking status,
and shutting sessions down.
Requires
gdbon the host and themcppython package (v1+).
Setup
Install from PyPI (preferred):
pip install gdb-mcpYou can also install from source, inside a virtualenv (recommended) or directly:
# optional but recommended
python -m venv .venv
. .venv/bin/activate
pip install -e .
# or: pip install .Related MCP server: gdb and rr Debugging
Running the MCP server
You can start the server directly:
gdb-mcp
# or
python -m gdb_mcp.serverThe server uses stdio for transport (the default for most MCP clients). Point your MCP client configuration at the command above.
One-shot client configuration
Run gdb-mcp --install to add the server to any detected MCP-aware clients
without editing config files by hand. The installer currently knows how to
update:
Codex CLI (
~/.codex/config.toml)Claude Desktop configs (common Linux/macOS paths)
Cursor / Windsurf MCP config files (if present)
Use --install-command /custom/path/to/gdb-mcp or --install-args ... if you
need to override what gets written.
Exposed tools
start_binary(binary_path, args=None, cwd=None, load_init=True, start_timeout=30.0, prompt=None, force_prompt=True)– launch gdb against a target binary (with optional args) and return a session id and the initial banner. Setload_init=Falseto skip user gdbinit (default is to load it so helpers like GEF/pwndbg remain enabled). Increasestart_timeoutif loading extensions takes longer to reach the first prompt. Usepromptto force a specific prompt string (defaults cover(gdb),(pwndbg), andgef>).force_promptsets the prompt to the chosen value after startup to avoid timeouts from customized prompts (e.g., pwndbg); setforce_prompt=Falseif you need to keep your custom prompt unchanged.attach_to_pid(pid, cwd=None, load_init=True, start_timeout=30.0, prompt=None, force_prompt=True)– start gdb and attach to a running process (sameload_init/timeout/prompt behavior as above).gdb_command(session_id, command, timeout_seconds=15.0)– execute a single gdb command in the given session and return the output.batch_commands(session_id, commands, timeout_seconds=15.0)– run a list of commands sequentially.list_sessions()– get a snapshot of all active sessions.session_status(session_id)– check if the gdb process is still alive.stop_session(session_id)– shut down the gdb process and remove it.
Each tool returns simple JSON so it is easy to route back into your LLM prompt.
Notes and tips
The server automatically disables pagination and confirmation prompts and enables pending breakpoints to keep interactions non-blocking.
timeout_secondsapplies per command. If you expect a program to run for a long time, pass a larger timeout orNone.Output is captured from gdb stdout/stderr until the next
(gdb)prompt. If you spawn a program that never returns to the prompt (e.g., it blocks on input), the call will time out.Common debugger prompts are detected automatically (
(gdb),(pwndbg),gef>), even with ANSI colors. You can still pass a custompromptif you use something nonstandard. By default the server forces the prompt to a stable value (force_prompt=True) so gdbinit customizations (like pwndbg) don’t prevent the initial prompt from being detected.
Demo
Auto-playing preview:

Source video: docs/media/demo.mp4
Credits
This project was built for my CSE 598 class, which emphasized using AI/LLMs in our workflow. I leaned on AI to write the entire project—including this README.
Inspired by https://github.com/mrexodia/ida-pro-mcp, and their server logic was used as a starting point.
Available Tools
7 toolsattach_to_pidC
Start gdb and attach to an existing process id.
| Name | Required | Description | Default |
|---|---|---|---|
| pid | Yes | ||
| cwd | No | ||
| load_init | No | ||
| start_timeout | No | ||
| prompt | No | ||
| force_prompt | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden of behavioral disclosure. It only states that gdb is started and attached, but does not mention that it creates a persistent session, requires subsequent commands, or that it may take time due to start_timeout. Important traits like session lifecycle are omitted.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise (one sentence) but lacks necessary detail. It is not verbose, yet it is under-specified, which reduces helpfulness. A slightly longer description with parameter context would be preferable.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of the tool with 6 parameters and no annotations or output schema, the description is incomplete. It does not explain return values, side effects, or how the tool fits into the overall workflow (e.g., interaction with gdb_command or batch_commands).
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. However, it only mentions 'attach to an existing process id' and does not explain any of the 6 parameters, such as cwd, load_init, start_timeout, prompt, or force_prompt, leaving the agent without necessary context for parameter usage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool starts gdb and attaches to an existing process id, which is a specific verb and resource. It distinguishes from siblings like start_binary (starts a new binary) and gdb_command (sends commands to an already attached session), making the purpose unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like start_binary for starting a new process or gdb_command for interacting. It lacks context about prerequisites or when it is appropriate.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
batch_commandsC
Send multiple gdb commands in sequence.
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | Yes | ||
| commands | Yes | ||
| timeout_seconds | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must fully disclose behavior. It only states commands are sent 'in sequence', but omits details on error handling, partial execution, or output, leaving behavioral ambiguity.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single short sentence, which is concise but lacks necessary detail. It could be expanded to include key behavioral information without becoming verbose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With 3 parameters (2 required), no output schema, and no annotations, the description is inadequate. It does not explain execution semantics, result format, or error propagation, leaving the agent underinformed.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, and the description does not explain any parameter meanings beyond implying that 'commands' holds multiple commands. 'session_id' and 'timeout_seconds' are entirely unexplained.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'Send' and resource 'gdb commands', and specifies 'multiple' and 'in sequence', distinguishing it from the sibling tool 'gdb_command' which sends a single command.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is given on when to use this tool versus alternatives like 'gdb_command' for single commands. There are no when-not or context conditions mentioned.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
gdb_commandC
Execute a raw gdb command within a session and return the output.
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | Yes | ||
| command | Yes | ||
| timeout_seconds | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description bears full responsibility for disclosing behavioral traits. It fails to mention that commands may modify gdb state or have side effects, and does not explain timeout behavior, error handling, or session lock considerations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence with no extraneous information, which is appropriate for its brevity. However, it could incorporate more detail without becoming overly verbose, such as noting that commands are blocking or that the session must exist.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the absence of an output schema, annotations, and parameter descriptions, the description is insufficient. It does not clarify the return format, error conditions, or the need for an active session, leaving the agent underinformed for correct invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, meaning no parameter descriptions are provided in the schema. The tool description does not add meaning beyond parameter names; e.g., 'command' is described only as 'raw gdb command', which adds little semantic value. 'session_id' and 'timeout_seconds' lack any additional context.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'execute', the resource 'raw gdb command within a session', and the output 'return the output'. It is concise and unambiguous, but does not differentiate from the sibling tool 'batch_commands' which may perform similar command execution.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'batch_commands' or 'start_binary'. It does not mention prerequisites, such as requiring an active session, nor does it advise against use cases.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_sessionsB
List active gdb sessions.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Without annotations, the description must disclose behavioral traits. It only states 'list active gdb sessions' but omits read-only nature, side effects, or return format. This is insufficient for a tool with no annotation coverage.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence with no wasted words. It is appropriately concise, though it could be slightly more informative without sacrificing brevity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no output schema and simple nature, the description should explain what the return value contains (e.g., session IDs, states). It only states the action, leaving the agent uncertain about the output format or completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has no parameters, so the baseline per instructions is 4. The description does not add parameter information, but none is needed.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('List') and the resource ('active gdb sessions'). It distinguishes from siblings like 'session_status' (which likely targets a single session) and other tools. However, it does not explicitly differentiate from similar listing tools.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives like 'session_status'. The description does not mention prerequisites or context for using it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
session_statusA
Report whether the given session still has a live gdb process.
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description bears full responsibility. It states the core behavior (reports live status) but omits details like side effects, authentication requirements, or what 'live' means precisely. Adequate but lacks depth.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
One short sentence, front-loaded with the action and object. No unnecessary words, but could be structured with additional context for completeness.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given a simple tool with one parameter and no output schema, the description is minimally adequate. It does not explain the return format (e.g., boolean or text) or error conditions, which would aid completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description should compensate. The parameter 'session_id' is not elaborated; the description adds no meaning beyond its name. Missing format or constraints.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb 'Report' and clearly identifies the resource: 'whether the given session still has a live gdb process'. It distinguishes from siblings like list_sessions (lists all) and stop_session (terminates), making its unique purpose clear.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit guidance on when to use this tool versus alternatives like list_sessions or start_binary. The context is implied: use when needing a live status check, but no exclusions or when-not-to-use advice is given.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
start_binaryC
Start a new gdb session for a binary and return the session id.
| Name | Required | Description | Default |
|---|---|---|---|
| binary_path | Yes | ||
| args | No | ||
| cwd | No | ||
| load_init | No | ||
| start_timeout | No | ||
| prompt | No | ||
| force_prompt | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description only mentions that it starts a session and returns an ID, but omits critical behavioral details such as whether the binary can be remote, what happens on failure, or if the session persists. No annotations provided to supplement.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is very short and to the point, but it sacrifices detail. It is not verbose, but the lack of structure and missing essential information makes it merely adequate.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given 7 parameters, no output schema, and no annotations, the description is grossly incomplete. It fails to explain the tool's behavior, parameter roles, or return value semantics, leaving the agent with insufficient information to use it correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 0% schema description coverage, the description must compensate, but it provides no information about any of the 7 parameters. It only implies 'binary_path' is the target binary, leaving all other parameters (args, cwd, load_init, etc.) unexplained.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it starts a new gdb session for a binary and returns the session id. The verb 'start' and resource 'gdb session' are specific, and it distinguishes from sibling tools like 'attach_to_pid' which targets existing processes.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus alternatives. The description lacks any context about prerequisites, limitations, or when to prefer other tools like 'attach_to_pid' or 'batch_commands'.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
stop_sessionC
Shut down a gdb session and remove it from the registry.
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It only states the action without disclosing side effects (e.g., data loss, irreversibility), safety implications, or required permissions.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence, which is concise but lacks detail. It is not verbose, but it could be expanded with valuable context without becoming excessively long.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with no annotations, no output schema, and minimal description, the context is incomplete. Missing details: return value, success/failure indicators, side effects, and typical usage patterns.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0% and the description does not explain the 'session_id' parameter beyond what the schema provides. It does not indicate how to obtain a valid session ID or its format.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('shut down'), the resource ('gdb session'), and the additional effect ('remove it from the registry'). It distinguishes from sibling tools like 'list_sessions' and 'session_status', which are inspection tools.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives (e.g., when to stop vs. other session management). There are no prerequisites, context, or exclusions mentioned.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
7 tool updates
v1.0.1- First observed
attach_to_pid - First observed
batch_commands - First observed
gdb_command - First observed
list_sessions - First observed
session_status - First observed
start_binary - First observed
stop_session
TDQS
Each tool has a clearly distinct purpose: session creation (attach_to_pid, start_binary), command execution (gdb_command, batch_commands), and session management (list_sessions, session_status, stop_session). No overlap or ambiguity.
All tool names follow a consistent verb_noun pattern (e.g., attach_to_pid, list_sessions, stop_session) using snake_case, making it easy for an agent to infer function.
Seven tools is well-scoped for a GDB debugger MCP, covering all essential operations: starting sessions, sending commands (single and batch), and session lifecycle management.
The tool set covers the full lifecycle of GDB sessions (create, execute, list, check status, stop) and allows arbitrary GDB commands via gdb_command, leaving no obvious gaps.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
An MCP server that provides an API to LLMs to manage their JumpCloud resources.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that provides programmatic access to the GNU Debugger (GDB), enabling AI models to interact with GDB through natural language for debugging tasks.9Apache 2.0
- AlicenseAqualityCmaintenanceMCP server that exposes GDB debugging as tools. An AI assistant can set breakpoints, run programs, step through code, inspect variables and memory, and examine registers — all via structured tool calls. Reverse debugging with rr is also supported.343MIT
- AlicenseCqualityDmaintenanceAn MCP server that exposes pwndbg commands running under LLDB as tools for AI assistants. This enables AI-driven binary analysis, exploit development, and reverse engineering through pwndbg's enhanced debugging capabilities.1001MIT
- AlicenseAqualityDmaintenanceAn MCP server that enables AI assistants to control GDB debugging sessions, including breakpoint management, thread analysis, and variable inspection, using the GDB/MI protocol.221MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- 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/datobena/gdb-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server