Back to Home
FYTJ icon

gdb-mcp-server

by FYTJ

Overview

A server that exposes GDB debugging capabilities (session, target, breakpoint, execution, memory, and event control) via a TCP-based JSON-RPC interface using MCP tools.

Installation

Run Command
PYTHONPATH=src GDB_MCP_ALLOW_LAUNCH=1 GDB_MCP_ALLOWED_ROOT=$(pwd)/examples/client/c_test/hello PYTHONUNBUFFERED=1 python3 -u -m gdb_mcp_server.mcp.server --listen 127.0.0.1:8765

Environment Variables

  • GDB_MCP_CONFIG
  • GDB_MCP_ALLOW_LAUNCH
  • GDB_MCP_ALLOW_ATTACH
  • GDB_MCP_ALLOWED_ROOT
  • GDB_MCP_HOST
  • GDB_MCP_PORT
  • PYTHONPATH
  • PYTHONUNBUFFERED
  • TARGET_BIN
  • MCP_HOST
  • MCP_PORT
  • MCP_UNIX_SOCKET
  • LLDB_MCP_PROJECT_ROOT
  • LLDB_MCP_SRC
  • GDB_MCP_TIMEOUT

Security Notes

The `gdb.command` method allows clients to execute arbitrary GDB console commands via the `-interpreter-exec console "{command}"` interface. This creates a severe command injection vulnerability, potentially allowing a malicious or compromised client to execute arbitrary commands on the host system where GDB is running (e.g., `shell rm -rf /`). While `GDB_MCP_ALLOWED_ROOT` restricts target file paths for `createTarget`, it does not restrict commands passed to `gdb.command`. The server is only safe if access is strictly limited to highly trusted, sandboxed clients or environments.

Similar Servers

Stats

Interest Score0
Security Score3
Cost ClassMedium
Stars0
Forks0
Last Update2025-12-03

Tags

debugginggdbmcpdeveloper-toolspython