MCP-PDB: Python Debugger Interface for Claude/LLMs
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.
Metadata
Release files for iflow-mcp_samefarrar-mcp-pdb 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| iflow_mcp_samefarrar_mcp_pdb-0.5.0.tar.gz | 17.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| iflow_mcp_samefarrar_mcp_pdb-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.4 kB
Release files / iflow_mcp_samefarrar_mcp_pdb-0.5.0.tar.gz
| Download URL | iflow_mcp_samefarrar_mcp_pdb-0.5.0.tar.gz |
|---|---|
| Size | 17.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
02a83ba48d54bba0669edb7d38f7257f7512b27dcad61485efa749a88ea9a3aa
|
|
BLAKE2b-256 checksum How to use checksums |
75dee734038a8cf31230947794508c425f10fbde3dda10310bebf852a5e2c87c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|
Release files / iflow_mcp_samefarrar_mcp_pdb-0.5.0-py3-none-any.whl
| Download URL | iflow_mcp_samefarrar_mcp_pdb-0.5.0-py3-none-any.whl |
|---|---|
| Size | 15.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1088805b9024e0f81d540114e769a727ccce688e583ac86075b04b70d6eac808
|
|
BLAKE2b-256 checksum How to use checksums |
0c5e9195d4b945129e1a72ce55078662b7afb7b76736b150b2f41edebead7fcb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|