Dart MCP Server

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Integrates with Codeium IDE through the Model Context Protocol, allowing AI coding assistants to leverage Dart functionality

  • Provides seamless access to Dart SDK commands for AI-powered development, enabling analysis, compilation, project creation, documentation, fixes, formatting, package management, and testing of Dart code

  • Identifies and works with Flutter projects, providing Dart SDK commands that support Flutter development workflows

Dart MCP サーバー

AIを活用した開発向けにDart SDKコマンドを公開する、分散型モデルコンテキストプロトコル(MCP)サーバーです。このサーバーは、モデルコンテキストプロトコル(MCP)を実装することで、AIコーディングアシスタントとDart/Flutter開発ワークフロー間のギャップを埋めます。

特徴

この MCP サーバーは、次の Dart SDK コマンドへのシームレスなアクセスを提供します。

指示説明
dart-analyzeDart コードのエラー、警告、および lint を分析する
dart-compileDart をさまざまな形式 (exe、AOT/JIT スナップショット、JavaScript) にコンパイルします。
dart-createテンプレートから新しい Dart プロジェクトを作成する
dart-docDartプロジェクトのAPIドキュメントを生成する
dart-fixDartソースコードに自動修正を適用する
dart-formatDartソースコードをスタイルガイドラインに従ってフォーマットする
dart-infoインストールされている Dart ツールに関する診断情報を表示します
dart-packageパッケージの操作 (取得、追加、アップグレード、古いパッケージなど)
dart-run引数渡しをサポートしたDartプログラムを実行する
dart-testフィルタリングとレポートオプションをサポートしたテストを実行する

主なメリット

  • インテリジェントなパス処理: 相対パスを絶対パスに自動的に解決し、作業ディレクトリに関係なくコマンドが正しく動作することを保証します。
  • プロジェクトの自動検出: ホームディレクトリやワークスペースなどの一般的な場所にある Dart/Flutter プロジェクトを識別します。
  • クロスプラットフォームサポート:macOS、Linux、Windowsで動作
  • ゼロ構成: 適切なデフォルト設定ですぐに使用可能
  • MCP 統合: Windsurf、Cline、その他のモデル コンテキスト プロトコル実装を含む、あらゆる MCP クライアントと互換性があります。

前提条件

  • Node.js : 18.x 以上
  • Dart SDK : 3.0 以上がインストールされ、PATH で利用可能

インストール

Smithery経由でインストール

Smithery経由で Claude Desktop 用の Dart MCP Server を自動的にインストールするには:

npx -y @smithery/cli install @egyleader/dart-mcp --client claude

npx の使用(推奨)

npx を使用すると、インストールせずにサーバーを直接実行できます。

npx @egyleader/dart-mcp-server

グローバルインストール

アクセスを容易にするために、サーバーをグローバルにインストールできます。

npm install -g @egyleader/dart-mcp-server

次に、次のコマンドを使用して実行します。

dart-mcp-server

ソースから

# Clone the repository git clone https://github.com/egyleader/dart-mcp-server.git cd dart-mcp-server # Install dependencies npm install # Build the project npm run build # Run the server node dist/index.js

MCPクライアントとの統合

Windsurf / Codeium IDE の設定

この MCP サーバーを Windsurf または Codeium IDE で使用するには、 mcp_config.jsonファイル (通常は~/.codeium/windsurf/mcp_config.jsonにあります) に次のコードを追加します。

{ "mcpServers": { "dart": { "command": "npx", "args": [ "-y", "@egyleader/dart-mcp-server" ] } } }

環境変数

  • DART_MCP_VERBOSE : デバッグのための詳細なログを有効にするには任意の値を設定します。

MCPツールの使用例

サーバーが提供するMCPツールの使用方法の例を以下に示します。これらの例では、各ツールに渡すことができるパラメータを示しています。

ダーツ分析

Dart コードのエラー、警告、および lint を分析します。

{ "path": "lib/main.dart", "options": ["--fatal-infos", "--fatal-warnings"] }

ダートコンパイル

Dart コードをさまざまな形式にコンパイルします。

{ "path": "lib/main.dart", "format": "exe", "output": "build/app", "options": ["--verbose"] }

サポートされている形式: exeaot-snapshotjit-snapshotkerneljs

ダーツ作成

テンプレートから新しい Dart プロジェクトを作成します。

{ "projectName": "my_awesome_app", "template": "console", "output": "projects/my_awesome_app", "options": ["--force"] }

projectName と出力に関する注意:

  • projectNameのみが指定されている場合は、プロジェクトが作成されるディレクトリ名として使用されます。
  • outputが指定されている場合は、プロジェクトが作成されるディレクトリとして使用されます。
  • Dart の実際のパッケージ/プロジェクト名は、Dart CLI によって最終的なディレクトリ名から派生されます。

サポートされているテンプレート: consolepackageserver-shelfweb

ダーツドキュメント

Dart プロジェクトの API ドキュメントを生成します。

{ "path": ".", "output": "doc", "options": ["--exclude", "lib/generated"] }

ダーツフィックス

Dart ソース コードに自動修正を適用します。

{ "path": "lib", "apply": true, "options": ["--pedantic"] }

ダーツ形式

Dart ソース コードをスタイル ガイドラインに従ってフォーマットします。

{ "paths": ["lib/main.dart", "lib/models"], "setExitIfChanged": true, "options": ["--line-length=100"] }

ダーツ情報

インストールされている Dart ツールに関する診断情報を表示します。

{ "options": ["--verbose"] }

ダーツパッケージ

パッケージを操作する (pub コマンド):

{ "command": "get", "workingDir": ".", "args": ["--offline"] }

サポートされているコマンド: getupgradeoutdatedaddremovepublishdepsdowngradecacherunglobal

ダートラン

引数の受け渡しをサポートする Dart プログラムを実行します。

{ "script": "bin/server.dart", "workingDir": ".", "args": ["--port=8080", "--mode=production"] }

ダーツテスト

フィルタリングとレポートのオプションをサポートしたテストを実行します。

{ "path": "test", "workingDir": ".", "options": ["--name=login", "--platform=chrome"] }

ライセンス

このプロジェクトは MIT ライセンスに基づいてライセンスされています - 詳細についてはLICENSEファイルを参照してください。

貢献

貢献を歓迎します!お気軽にプルリクエストを送信してください。

ツールAPIリファレンス

ダーツ分析

ディレクトリまたはファイル内の Dart コードを分析します。

{ path?: string; // Directory or file to analyze options?: string[]; // Additional options for the dart analyze command }

例:

{ path: "lib", options: ["--fatal-infos", "--fatal-warnings"] }

ダートコンパイル

Dart をさまざまな形式にコンパイルします。

{ format: 'exe' | 'aot-snapshot' | 'jit-snapshot' | 'kernel' | 'js'; // Output format path: string; // Path to the Dart file to compile output?: string; // Output file path options?: string[]; // Additional compilation options }

例:

{ format: "exe", path: "bin/main.dart", output: "bin/app" }

ダーツ作成

新しい Dart プロジェクトを作成します。

{ template: 'console' | 'package' | 'server-shelf' | 'web'; // Project template projectName: string; // Name of the project to create output?: string; // Directory where to create the project options?: string[]; // Additional project creation options }

注記:

  • outputが指定されている場合、そのディレクトリにプロジェクトが作成されます。
  • projectNameのみが指定されている場合は、それがディレクトリ名として使用されます。
  • 実際の Dart パッケージ名は、最終的なディレクトリ名から派生されます。

例:

{ template: "package", projectName: "my_dart_library", output: "projects/my_dart_library" }

ダーツドキュメント

Dart プロジェクトの API ドキュメントを生成します。

{ path?: string; // Directory containing the Dart package to document output?: string; // Output directory for the generated documentation options?: string[]; // Additional documentation options }

例:

{ path: ".", output: "doc/api" }

ダーツフィックス

Dart ソース コードに自動修正を適用します。

{ path?: string; // Directory or file to apply fixes to apply?: boolean; // Whether to apply the suggested fixes (default: true) options?: string[]; // Additional fix options }

例:

{ path: "lib", apply: true, options: ["--pedantic"] }

ダーツ形式

Dart ソース コードを慣用的にフォーマットします。

{ paths: string[]; // Files or directories to format setExitIfChanged?: boolean; // Return exit code 1 if there are formatting changes (default: false) options?: string[]; // Additional format options }

例:

{ paths: ["lib", "test"], setExitIfChanged: true, options: ["--line-length=80"] }

ダーツ情報

インストールされているツールに関する診断情報を表示します。

{ options?: string[]; // Additional info options }

例:

{ options: ["--verbose"] }

ダーツパッケージ

パッケージを操作します (pub コマンド)。

{ command: 'get' | 'upgrade' | 'outdated' | 'add' | 'remove' | 'publish' | 'deps' | 'downgrade' | 'cache' | 'run' | 'global'; // Pub subcommand args?: string[]; // Arguments for the pub subcommand workingDir?: string; // Working directory for the command }

例:

// Add a package { command: "add", args: ["rxdart"], workingDir: "my_project" } // Get dependencies { command: "get", workingDir: "my_project" }

ダートラン

Dart プログラムを実行します。

{ script: string; // Path to the Dart script to run args?: string[]; // Arguments to pass to the script workingDir?: string; // Working directory for the command }

例:

{ script: "bin/main.dart", args: ["--verbose"], workingDir: "my_project" }

ダーツテスト

プロジェクトのテストを実行します。

{ path?: string; // Path to the test file or directory options?: string[]; // Additional test options workingDir?: string; // Working directory for the command }

例:

{ path: "test", options: ["--coverage", "--name=auth"], workingDir: "my_project" }

発達

# Watch mode for development pnpm run dev # Build for production pnpm run build

エラー処理

サーバーは包括的なエラー処理を実装します。

  • コマンド実行エラーは適切にキャプチャされフォーマットされます
  • パス解決の問題は詳細な診断とともに報告されます
  • 長時間実行操作のタイムアウト処理
  • Dartコマンドからの適切な終了コードの伝播

貢献

詳細な貢献ガイドラインについては、 CONTRIBUTING.md を参照してください。

コミット形式は次のとおりです:

<type>[optional scope]: [JIRA-123(optional)] <description>

例:

feat(tools): [DART-456] add support for dart test tags

ライセンス

マサチューセッツ工科大学

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

AIを活用した開発向けにDart SDKコマンドを公開する、分散型モデルコンテキストプロトコル(MCP)サーバーです。このサーバーは、モデルコンテキストプロトコル(MCP)を実装することで、AIコーディングアシスタントとDart/Flutter開発ワークフロー間のギャップを埋めます。

  1. Features
    1. Key Benefits
  2. Prerequisites
    1. Installation
      1. Installing via Smithery
      2. Using npx (recommended)
      3. Global Installation
      4. From Source
    2. Integration with MCP Clients
      1. Windsurf / Codeium IDE Configuration
      2. Environment Variables
    3. MCP Tool Usage Examples
      1. dart-analyze
      2. dart-compile
      3. dart-create
      4. dart-doc
      5. dart-fix
      6. dart-format
      7. dart-info
      8. dart-package
      9. dart-run
      10. dart-test
    4. License
      1. Contributing
        1. Tool API Reference
          1. dart-analyze
          2. dart-compile
          3. dart-create
          4. dart-doc
          5. dart-fix
          6. dart-format
          7. dart-info
          8. dart-package
          9. dart-run
          10. dart-test
        2. Development
          1. Error Handling
            1. Contributing
              1. License
                ID: vuwii9l5gu