python-dap-mcp

python-dap-mcp

An MCP server that exposes Python debugging tools backed by debugpy, providing a focused debugging surface for local scripts.

Category
访问服务器

README

python-dap-mcp

python-dap-mcp is an MCP server that exposes Python debugging tools backed by debugpy.

It gives an MCP client a focused Python debugging surface for local scripts:

  • Launch a Python script under debugpy
  • Set and clear breakpoints by file and line
  • Continue execution or step over, into, and out
  • Inspect the active stack trace
  • Evaluate expressions in the top frame
  • Read variable details from the active frame
  • End the debug session cleanly

The server is intentionally narrow. It runs over stdio, uses debugpy as the underlying adapter, and is designed for local trusted development environments.

What This Server Does

This repository packages a single MCP server command, python-dap-mcp.

When an MCP client connects to it, the server exposes these tools:

  • launch_debugger
  • set_breakpoint
  • clear_breakpoint
  • continue_execution
  • step_over
  • step_into
  • step_out
  • get_stack_trace
  • evaluate_expression
  • get_variable_details
  • end_session

The server resolves relative paths from its project root and launches the debug target with debugpy.adapter.

When To Use It

This server is useful when an MCP client needs to inspect or control a real Python process instead of only reading source code.

Common use cases:

  • Reproducing a bug and stopping at a specific line
  • Inspecting locals at a breakpoint
  • Evaluating expressions against a live frame
  • Stepping through control flow in a small script or test fixture
  • Building agent workflows that need real debugger feedback

Install from GitHub

Run it directly from GitHub with uvx:

uvx --from git+https://github.com/MikeWinkelmannXL2/python-dap-mcp@v0.1.0 python-dap-mcp

Install it persistently with uv tool install:

uv tool install git+https://github.com/MikeWinkelmannXL2/python-dap-mcp@v0.1.0

If you want the latest branch state instead of a tag, replace @v0.1.0 with @main.

To run from a private fork or private repository, use the SSH form:

uvx --from git+ssh://git@github.com/MikeWinkelmannXL2/python-dap-mcp.git@v0.1.0 python-dap-mcp

Integration

Codex

Codex supports local stdio MCP servers through the CLI and ~/.codex/config.toml.

Add this server with the Codex CLI:

codex mcp add python-debugger -- \
  uvx --from git+https://github.com/MikeWinkelmannXL2/python-dap-mcp@v0.1.0 python-dap-mcp

Verify that Codex sees it:

codex mcp list

Equivalent ~/.codex/config.toml entry:

[mcp_servers.python-debugger]
command = "uvx"
args = ["--from", "git+https://github.com/MikeWinkelmannXL2/python-dap-mcp@v0.1.0", "python-dap-mcp"]

GitHub Copilot CLI

Copilot CLI can add MCP servers interactively with /mcp add, or you can edit ~/.copilot/mcp-config.json directly.

Recommended ~/.copilot/mcp-config.json entry:

{
  "mcpServers": {
    "python-debugger": {
      "type": "local",
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/MikeWinkelmannXL2/python-dap-mcp@v0.1.0",
        "python-dap-mcp"
      ],
      "env": {},
      "tools": ["*"]
    }
  }
}

If you prefer the interactive flow, run /mcp add inside Copilot CLI and use:

  • Server name: python-debugger
  • Server type: Local or STDIO
  • Command: uvx
  • Args: --from git+https://github.com/MikeWinkelmannXL2/python-dap-mcp@v0.1.0 python-dap-mcp
  • Tools: *

Claude Code

Claude Code supports local stdio MCP servers directly from its CLI.

Add this server with:

claude mcp add python-debugger -- \
  uvx --from git+https://github.com/MikeWinkelmannXL2/python-dap-mcp@v0.1.0 python-dap-mcp

Verify it:

claude mcp get python-debugger

If you prefer JSON-based setup, the equivalent server definition is:

{
  "type": "stdio",
  "command": "uvx",
  "args": [
    "--from",
    "git+https://github.com/MikeWinkelmannXL2/python-dap-mcp@v0.1.0",
    "python-dap-mcp"
  ],
  "env": {}
}

If You Install The Tool Globally

If python-dap-mcp is already installed on the machine, each client can point directly to the executable instead of uvx:

command: python-dap-mcp
args: []

Typical Workflow

A normal debugger flow through MCP looks like this:

  1. Call set_breakpoint with a source file and 1-based line number.
  2. Call launch_debugger with the script path and optional arguments.
  3. When execution stops, call get_stack_trace, evaluate_expression, or get_variable_details.
  4. Call continue_execution or one of the step tools.
  5. Call end_session when you are done.

Example sequence:

set_breakpoint("app.py", 42)
launch_debugger("app.py", stop_on_entry=false)
get_stack_trace()
evaluate_expression("user_id")
continue_execution()
end_session()

Tool Semantics

  • launch_debugger starts one active session at a time. A second launch is rejected until the first session ends.
  • console is intentionally limited to internalConsole.
  • Breakpoints can be set before launch. They are synchronized when the debug session starts.
  • Expression evaluation runs in the top stack frame of the currently stopped thread.
  • Relative paths are resolved from the server project root.

Requirements

  • Python 3.13+
  • A local environment where the server is allowed to launch Python processes
  • A trusted workspace. This server can execute code and evaluate expressions inside the debuggee context

Development

Run the full test suite:

env UV_CACHE_DIR=/tmp/uv-cache uv run --extra dev pytest

Build distributable artifacts with the uv build backend:

env UV_CACHE_DIR=/tmp/uv-cache uv build

Run the server from the repository:

uv run python -m debug_server

Run it through the installed package entrypoint:

uv run python -m python_dap_mcp

Security

This server can:

  • Launch local Python programs
  • Pause and resume execution
  • Evaluate expressions in a live frame
  • Expose runtime state from the debuggee process

That makes it useful, but also high-trust. Only install and run it in environments you control and only connect trusted MCP clients to it.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选