dap-mcp
dap-mcp
**dap-mcpは、**デバッグアダプタプロトコル(DAP)セッションの管理に特化したモデルコンテキストプロトコル(MCP)の実装です。MCPは、大規模言語モデルのコンテキストウィンドウを最適化および拡張するための標準化されたフレームワークを提供し、本プロジェクトでは、デバッグワークフローの強化と効率化に使用されています。
特徴
**デバッグ アダプタ プロトコルの統合:**標準化されたプロトコルを使用してデバッガーと対話します。
MCP フレームワーク: MCP を活用してコンテキストを最適化し、デバッグ ワークフローを強化します。
**豊富なデバッグ ツール:**ブレークポイントの設定、一覧表示、削除、実行の制御 (続行、ステップ イン/アウト/次へ)、式の評価、スタック フレームの変更、ソース コードの表示を行います。
柔軟な構成: JSON 構成ファイルを使用して、デバッガー設定、ソース ディレクトリ、その他のパラメーターをカスタマイズします。
Related MCP server: Debug-MCP
インストール
前提条件
Python 3.10以上
uv (オプション、サーバーの実行用)
サーバーのインストールと実行
dap-mcpとその依存関係をインストールします。
pip install dap-mcp
python -m dap_mcp --config config.json
# Or, if you have uv installed
uvx dap-mcp@latest --config config.json構成
このプロジェクトでは、JSON設定ファイル(例: .config.json )を使用して、デバッガー設定とソースディレクトリを指定します。設定例:
{
"type": "debugpy",
"debuggerPath": "/path/to/python/with/debugpy",
"debuggerArgs": [
"-m",
"debugpy.adapter"
],
// source directories for resolving file paths
// if you always use absolute paths, you can omit this
"sourceDirs": [
"/path/to/source/code"
],
// debugger-specific settings start here
// configurations for debugpy can be found at
// https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings
// you can use "program" instead of "module" to specify the program to debug
"module": "pytest",
// the python executable to use to run the debuggee
"python": ["/path/to/python"],
"cwd": "/path/to/working/directory"
}この構成は、デバッガーに次の情報を通知します。
デバッガー実行可能ファイルとその引数へのパス。
ブレークポイント操作中にファイル パスを解決するためのソース ディレクトリ。
デバッグ対象を起動するために必要なその他の設定 (モジュール、作業ディレクトリ、インタープリター パスなど)。
利用可能なデバッガーの種類
タイプ | 例のパス | 引数の例 |
デバッグ |
|
|
lldb |
|
|
利用可能なツール
このプロジェクトでは、MCP フレームワークを介して呼び出すことができるいくつかのツールを公開しています。
**launch:**デバッグ対象プログラムを起動します。
**set_breakpoint:**指定したファイルと行にブレークポイントを設定します (オプションの条件付き)。
**Remove_breakpoint:**指定されたファイルと行からブレークポイントを削除します。
**list_all_breakpoints:**デバッガーに現在設定されているすべてのブレークポイントを一覧表示します。
**continue_execution:**ブレークポイントに到達した後もプログラムの実行を継続します。
**step_in:**関数呼び出しにステップインします。
**step_out:**現在の関数からステップアウトします。
**next:**次のコード行に進みます。
**評価:**現在のデバッグコンテキストで式を評価します。
**change_frame:**別のスタック フレームに切り替えます。
**view_file_around_line:**指定された行の周囲のソース コードを表示します (指定されていない場合は最後に提供されたファイルを使用します)。
**終了:**デバッグセッションを終了します。
これらのツールは、MCP クライアントとの統合のために XML レンダリングされた出力を提供します。
他のDAPサーバーとの拡張
追加のDAPサーバーをサポートするには、 dap_mcp/config.pyファイルに新しいDAP固有の設定クラスを追加するだけです。すべてのDAP設定は、基本クラスDAPConfigから拡張されます。新しいサブクラスはそれぞれ以下の要件を満たす必要があります。
識別子として機能する一意の
type値 (Literalを使用) を定義します。そのデバッガーに固有の追加フィールドまたは設定を含めます。
たとえば、「mydap」という仮想の DAP サーバーのサポートを追加するには、次のようにします。
class MyDAP(DAPConfig):
type: Literal["mydap"]
# Add any additional settings for MyDAP here
customSetting: Optional[str] = Field(
None, description="A custom setting for MyDAP."
)新しい構成クラスを作成したら、デバッガー固有の構成で使用するユニオン型に新しいクラスを追加して更新します。例:
DebuggerSpecificConfig = Annotated[Union[DebugPy, MyDAP], Field(..., discriminator="type")]ここで、 "type": "mydap"を含む構成 JSON を指定すると、新しいMyDAPクラスを使用して解析および検証され、DAP サーバー拡張機能が完全に統合されます。
貢献
貢献を歓迎します!貢献するには:
リポジトリをフォークします。
機能またはバグ修正用の新しいブランチを作成します。
テストを記述し、すべてのチェックが合格することを確認します。
プルリクエストを送信します。
コーディングガイドラインに従い、変更には適切なテストを含めてください。
ライセンス
このプロジェクトはAGPL-3.0ライセンスに基づきます。詳細はLICENSEファイルをご覧ください。
This server cannot be deployed
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Enable secure connectivity between Sentry issues and debugging data, and LLM clients, using a Model Context Protocol (MCP) server.
A Model Context Protocol server for Wix AI tools
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA VSCode extension that enables AI agents to programmatically control VSCode's debugging features through the Model Context Protocol (MCP).-
- AlicenseAqualityDmaintenanceEnables 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.81MIT
- AlicenseNot gradedqualityCmaintenanceMCP server for AI-assisted Python debugging using debugpy and Debug Adapter Protocol, enabling AI agents to run tests, set breakpoints, and inspect variables via natural language.8MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to inspect debug state, control execution, and set breakpoints in VS Code by exposing the Debug Adapter Protocol as an MCP server.Apache 2.0