Skip to main content
Glama

dap-mcp

by KashunCheng

dap-mcp

**dap-mcpは、**デバッグアダプタプロトコル(DAP)セッションの管理に特化したモデルコンテキストプロトコル(MCP)の実装です。MCPは、大規模言語モデルのコンテキストウィンドウを最適化および拡張するための標準化されたフレームワークを提供し、本プロジェクトでは、デバッグワークフローの強化と効率化に使用されています。

特徴

  • **デバッグ アダプタ プロトコルの統合:**標準化されたプロトコルを使用してデバッガーと対話します。
  • MCP フレームワーク: MCP を活用してコンテキストを最適化し、デバッグ ワークフローを強化します。
  • **豊富なデバッグ ツール:**ブレークポイントの設定、一覧表示、削除、実行の制御 (続行、ステップ イン/アウト/次へ)、式の評価、スタック フレームの変更、ソース コードの表示を行います。
  • 柔軟な構成: JSON 構成ファイルを使用して、デバッガー設定、ソース ディレクトリ、その他のパラメーターをカスタマイズします。

インストール

前提条件

  • 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" }

この構成は、デバッガーに次の情報を通知します。

  • デバッガー実行可能ファイルとその引数へのパス。
  • ブレークポイント操作中にファイル パスを解決するためのソース ディレクトリ。
  • デバッグ対象を起動するために必要なその他の設定 (モジュール、作業ディレクトリ、インタープリター パスなど)。

利用可能なデバッガーの種類

タイプ例のパス引数の例
デバッグ/usr/bin/python3["-m", "debugpy.adapter"]
lldb/usr/bin/lldb-dap[]

利用可能なツール

このプロジェクトでは、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 サーバー拡張機能が完全に統合されます。

貢献

貢献を歓迎します!貢献するには:

  1. リポジトリをフォークします。
  2. 機能またはバグ修正用の新しいブランチを作成します。
  3. テストを記述し、すべてのチェックが合格することを確認します。
  4. プルリクエストを送信します。

コーディングガイドラインに従い、変更には適切なテストを含めてください。

ライセンス

このプロジェクトはAGPL-3.0ライセンスに基づきます。詳細はLICENSEファイルをご覧ください。

-
security - not tested
A
license - permissive license
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

デバッグ アダプターとの対話を可能にするモデル コンテキスト プロトコル (MCP) の実装。これにより、言語モデルはデバッグ セッション中にデバッガーを制御し、ブレークポイントを設定し、式を評価し、ソース コードをナビゲートできるようになります。

  1. 特徴
    1. インストール
      1. 前提条件
      2. サーバーのインストールと実行
    2. 構成
      1. 利用可能なデバッガーの種類
    3. 利用可能なツール
      1. 他のDAPサーバーとの拡張
        1. 貢献
      2. ライセンス

        Related MCP Servers

        • A
          security
          A
          license
          A
          quality
          Model Context Protocol (MCP) is a new, standardized protocol for managing context between large language models (LLMs) and external systems. In this repository, we provide an installer as well as an MCP Server for Upstash Developer API's.
          Last updated -
          16
          66
          43
          TypeScript
          MIT License
          • Linux
          • Apple
        • -
          security
          A
          license
          -
          quality
          A Model Context Protocol (MCP) implementation for connecting to and working with various database systems.
          Last updated -
          17
          18
          TypeScript
          MIT License
          • Linux
          • Apple
        • -
          security
          A
          license
          -
          quality
          A server implementation of the Model Context Protocol (MCP) for managing development workflow with features like project management, task tracking, and QA review support.
          Last updated -
          3
          JavaScript
          AGPL 3.0
        • A
          security
          A
          license
          A
          quality
          Implements Model Context Protocol (MCP) to enable interaction with CODING DevOps platform through standardized interfaces for managing projects and work items.
          Last updated -
          6
          1
          1
          TypeScript
          MIT License

        View all related MCP servers

        MCP directory API

        We provide all the information about MCP servers via our MCP API.

        curl -X GET 'https://glama.ai/api/mcp/v1/servers/KashunCheng/dap_mcp'

        If you have feedback or need assistance with the MCP directory API, please join our Discord server