
MCP server for AI-assisted Python debugging using debugpy and Debug Adapter Protocol
概览
MCP server for AI-assisted Python debugging using debugpy and Debug Adapter Protocol. Enable AI agents to debug your Python code through natural language. This MCP server provides: - reports for machine-readable failures - control of a live debugpy session (breakpoints, continue, variables) - exposing tools: run tests, read JSON, and send DAP commands Install git hooks to run CI checks before every commit: This prevents CI failures by automatically running ruff, black, mypy, and pytest before allowing commits. Run the CLI after activating the project virtualenv: Then register the MCP server with VS Code and/or Claude so they can launch it automatically: Open your MCP-aware chat surface and invoke tools like run_tests_json or dap_launch (see docs/mcp_usage.md for a full walkthrough).
README
以下为原文 README 节选,完整内容请查看原文。
mcp-debugpy
MCP server for AI-assisted Python debugging using debugpy and Debug Adapter Protocol.
Enable AI agents to debug your Python code through natural language. This MCP server provides:
- pytest JSON reports for machine-readable failures
- DAP (Debug Adapter Protocol) control of a live
debugpysession (breakpoints, continue, variables) - MCP server exposing tools: run tests, read JSON, and send DAP commands
Quick start
macOS/Linux:
git clone
cd mvp-agent-debug
./setup.sh
# Activate the venv and run demos/tests:
source .venv/bin/activate
python src/dap_stdio_direct.py # direct adapter walkthrough
python -m pytest tests/test_mcp_server.py # verify MCP tooling
Windows:
git clone
cd mvp-agent-debug
setup.bat
REM Activate the venv and run demos/tests:
.venv\Scripts\activate
python src\dap_stdio_direct.py
python -m pytest tests\test_mcp_server.py
Install (from source):
python -m pip install -e '.[dev]'
IMPORTANT: Install git hooks to run CI checks before every commit:
./scripts/install-hooks.sh
This prevents CI failures by automatically running ruff, black, mypy, and pytest before allowing commits.
Run the CLI after activating the project virtualenv:
mcp-debug-server --help
Then register the MCP server with VS Code and/or Claude so they can launch it automatically:
python scripts/configure_mcp_clients.py
Open your MCP-aware chat surface and invoke tools like run_tests_json or dap_launch (see docs/mcp_usage.md for a full walkthrough).
The sample app intentionally contains a bug to demonstrate failing tests and an interactive breakpoint.
Optional helper
Run python scripts/configure_mcp_clients.py to detect existing VS Code/Claude MCP entries, interactively add/update/remove them, and generate a Claude snippet. Works on macOS, Linux, and Windows.
Developer tooling
This repository uses pre-commit hooks and CI for linting, formatting, and typing checks.
Install hooks locally:
source .venv/bin/activate
pip install pre-commit
pre-commit install
pre-commit run --all-files
If you prefer to run hooks manually, the CI runs ruff, black --check, and mypy before pytest.
📘 For a step-by-step walkthrough of every MCP tool (including suggested agent workflows for VS Code and Claude), see docs/mcp_usage.md.
Using the MCP tooling
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →配置
{
"mcpServers": {
"agentDebug": {
"command": "/path/to/your/project/.venv/bin/python",
"args": ["src/mcp_server.py"],
"cwd": "/path/to/your/project",
"env": {
"PYTHONPATH": "/path/to/your/project/src"
}
}
}
}