Skip to main content
Glama
mcp-python-debugger

mcp-python-debugger

by nathbenams

mcp-python-debugger

MCP server that gives Claude Code access to a real Python debugger (debugpy + DAP protocol).

Instead of spamming print() statements, Claude can now set breakpoints, step through code, inspect variables, and evaluate expressions — just like a developer in VS Code.

Architecture

Claude Code ──► MCP tools ──► FastMCP Server ──► DAP protocol ──► debugpy ──► your script

The server launches your Python script under debugpy, connects via the Debug Adapter Protocol (DAP), and exposes debugger operations as MCP tools.

Related MCP server: MCP Debugger

Installation

# Clone and install
cd mcp-python-debugger
pip install -e .

# debugpy is installed as a dependency

Claude Code Configuration

Add to your .claude/settings.json:

{
  "mcpServers": {
    "python-debugger": {
      "command": "mcp-python-debugger"
    }
  }
}

Or in your project's .mcp.json:

{
  "mcpServers": {
    "python-debugger": {
      "command": "mcp-python-debugger",
      "type": "stdio"
    }
  }
}

Available Tools

Tool

Description

debug_launch

Launch a script with debugpy attached

debug_set_breakpoints

Set breakpoints at specific lines

debug_continue

Resume until next breakpoint

debug_step_over

Execute current line, stop at next

debug_step_into

Step into a function call

debug_step_out

Run until current function returns

debug_stack_trace

Show the call stack with frame IDs

debug_variables

Inspect locals/globals in a frame

debug_evaluate

Evaluate a Python expression at breakpoint

debug_status

Check session state

debug_stop

Terminate the debug session

Example Workflow

What Claude Code would do when debugging an issue:

1. debug_launch(program="/app/main.py")
   → Session started, paused on entry

2. debug_set_breakpoints(file="/app/main.py", lines=[42, 67])
   → Breakpoints set at lines 42, 67

3. debug_continue()
   → Stopped: breakpoint at process_data(), main.py:42  [frame 1]

4. debug_variables(frame_id=1, scope="locals")
   → data: [1, 2, None, 4]  (list)
   → index: 2  (int)

5. debug_evaluate(expression="data[index]", frame_id=1)
   → None  (NoneType)

6. # Claude now sees the bug: None in the data at index 2
   debug_stop()

How It Works

  1. debug_launch starts python -m debugpy --listen 127.0.0.1:<port> --wait-for-client script.py

  2. The MCP server connects to debugpy's DAP socket

  3. Each tool call translates to DAP requests (JSON messages over TCP)

  4. Responses are formatted for Claude's consumption

Limitations

  • One debug session at a time (by design — keeps it simple)

  • justMyCode=True by default (doesn't step into stdlib/site-packages)

  • 60s timeout on continue, 30s on step operations

  • No conditional breakpoints yet (TODO)

TODO

  • Conditional breakpoints (set_breakpoints with conditions)

  • Watch expressions (auto-evaluate on each stop)

  • Exception breakpoints (break on raise)

  • Multi-threaded debugging (thread selection)

  • Attach to running process (not just launch)

  • stdout/stderr capture from debuggee

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to perform interactive Python debugging with breakpoints, step execution, and variable inspection using the Debug Adapter Protocol (DAP) through an MCP server interface.
      8
      1
      MIT
    • A
      license
      A
      quality
      A
      maintenance
      Enables AI agents to perform step-through debugging of Python, JavaScript/Node.js, and Rust programs using the Debug Adapter Protocol, with support for breakpoints, variable inspection, and stack traces.
      29
      194
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      Enables coding agents to use a real debugger (Python via debugpy) for launching, attaching, setting breakpoints, stepping through code, inspecting stack frames, and evaluating expressions through MCP tools.
      12
      27
      MIT