Skip to main content

MCP-PDB: Python Debugger Interface for Claude/LLMs

Python License

MCP-PDB provides tools for using Python's debugger (pdb) with Claude and other LLMs through the Model Context Protocol (MCP). This was inspired by debug-gym by Microsoft, which showed gains in various coding benchmarks by providing a coding agent access to a python debugger.

⚠️ Security Warning

This tool executes Python code through the debugger. Use in trusted environments only.

Installation

Works best with uv

Claude Code

# Install the MCP server
claude mcp add mcp-pdb -- uv run --with mcp-pdb mcp-pdb

# Alternative: Install with specific Python version
claude mcp add mcp-pdb -- uv run --python 3.13 --with mcp-pdb mcp-pdb

# Note: The -- separator is required for Claude Code CLI

Windsurf

{
  "mcpServers": {
    "mcp-pdb": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "mcp-pdb",
        "mcp-pdb"
      ]
    }
  }
}

Available Tools

Tool Description
start_debug(file_path, use_pytest, args) Start a debugging session for a Python file
send_pdb_command(command) Send a command to the running PDB instance
set_breakpoint(file_path, line_number) Set a breakpoint at a specific line
clear_breakpoint(file_path, line_number) Clear a breakpoint at a specific line
list_breakpoints() List all current breakpoints
restart_debug() Restart the current debugging session
examine_variable(variable_name) Get detailed information about a variable
get_debug_status() Show the current state of the debugging session
end_debug() End the current debugging session

Common PDB Commands

Command Description
n Next line (step over)
s Step into function
c Continue execution
r Return from current function
p variable Print variable value
pp variable Pretty print variable
b file:line Set breakpoint
cl num Clear breakpoint
l List source code
q Quit debugging

Features

  • Project-aware debugging with automatic virtual environment detection
  • Support for both direct Python debugging and pytest-based debugging
  • Automatic breakpoint tracking and restoration between sessions
  • Works with UV package manager
  • Variable inspection with type information and attribute listing

Troubleshooting

Claude Code Installation Issues

If you encounter an error like:

MCP server "mcp-pdb" Connection failed: spawn /Users/xxx/.local/bin/uv run --python 3.13 --with mcp-pdb mcp-pdb ENOENT

Make sure to include the -- separator when using claude mcp add:

# ✅ Correct
claude mcp add mcp-pdb -- uv run --with mcp-pdb mcp-pdb

# ❌ Incorrect (missing --)
claude mcp add mcp-pdb uv run --with mcp-pdb mcp-pdb

To verify your installation:

# Check if mcp-pdb is listed
claude mcp list | grep mcp-pdb

# Check server status in Claude Code
# Type /mcp in Claude Code to see connection status

License

MIT License - See LICENSE file for details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iflow_mcp_samefarrar_mcp_pdb-0.5.0.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iflow_mcp_samefarrar_mcp_pdb-0.5.0-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file iflow_mcp_samefarrar_mcp_pdb-0.5.0.tar.gz.

File metadata

  • Download URL: iflow_mcp_samefarrar_mcp_pdb-0.5.0.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_samefarrar_mcp_pdb-0.5.0.tar.gz
Algorithm Hash digest
SHA256 02a83ba48d54bba0669edb7d38f7257f7512b27dcad61485efa749a88ea9a3aa
MD5 d3cfd3ab2840f4aa84d2d4890503f17c
BLAKE2b-256 75dee734038a8cf31230947794508c425f10fbde3dda10310bebf852a5e2c87c

See more details on using hashes here.

File details

Details for the file iflow_mcp_samefarrar_mcp_pdb-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: iflow_mcp_samefarrar_mcp_pdb-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_samefarrar_mcp_pdb-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1088805b9024e0f81d540114e769a727ccce688e583ac86075b04b70d6eac808
MD5 1ca8c04371d0973d9cf6dcbd4158458d
BLAKE2b-256 0c5e9195d4b945129e1a72ce55078662b7afb7b76736b150b2f41edebead7fcb

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page