Dart MCP サーバー


AIを活用した開発向けにDart SDKコマンドを公開する、分散型モデルコンテキストプロトコル(MCP)サーバーです。このサーバーは、モデルコンテキストプロトコル(MCP)を実装することで、AIコーディングアシスタントとDart/Flutter開発ワークフロー間のギャップを埋めます。
特徴
この MCP サーバーは、次の Dart SDK コマンドへのシームレスなアクセスを提供します。
指示 | 説明 |
dart-analyze
| Dart コードのエラー、警告、および lint を分析する |
dart-compile
| Dart をさまざまな形式 (exe、AOT/JIT スナップショット、JavaScript) にコンパイルします。 |
dart-create
| テンプレートから新しい Dart プロジェクトを作成する |
dart-doc
| DartプロジェクトのAPIドキュメントを生成する |
dart-fix
| Dartソースコードに自動修正を適用する |
dart-format
| Dartソースコードをスタイルガイドラインに従ってフォーマットする |
dart-info
| インストールされている Dart ツールに関する診断情報を表示します |
dart-package
| パッケージの操作 (取得、追加、アップグレード、古いパッケージなど) |
dart-run
| 引数渡しをサポートしたDartプログラムを実行する |
dart-test
| フィルタリングとレポートオプションをサポートしたテストを実行する |
主なメリット
インテリジェントなパス処理: 相対パスを絶対パスに自動的に解決し、作業ディレクトリに関係なくコマンドが正しく動作することを保証します。
プロジェクトの自動検出: ホームディレクトリやワークスペースなどの一般的な場所にある Dart/Flutter プロジェクトを識別します。
クロスプラットフォームサポート:macOS、Linux、Windowsで動作
ゼロ構成: 適切なデフォルト設定ですぐに使用可能
MCP 統合: Windsurf、Cline、その他のモデル コンテキスト プロトコル実装を含む、あらゆる MCP クライアントと互換性があります。
Related MCP server: dbt CLI MCP Server
前提条件
インストール
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
次に、次のコマンドを使用して実行します。
ソースから
# 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"
]
}
}
}
環境変数
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"]
}
サポートされている形式: exe 、 aot-snapshot 、 jit-snapshot 、 kernel 、 js
ダーツ作成
テンプレートから新しい Dart プロジェクトを作成します。
{
"projectName": "my_awesome_app",
"template": "console",
"output": "projects/my_awesome_app",
"options": ["--force"]
}
projectName と出力に関する注意:
projectNameのみが指定されている場合は、プロジェクトが作成されるディレクトリ名として使用されます。
outputが指定されている場合は、プロジェクトが作成されるディレクトリとして使用されます。
Dart の実際のパッケージ/プロジェクト名は、Dart CLI によって最終的なディレクトリ名から派生されます。
サポートされているテンプレート: console 、 package 、 server-shelf 、 web
ダーツドキュメント
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"]
}
サポートされているコマンド: get 、 upgrade 、 outdated 、 add 、 remove 、 publish 、 deps 、 downgrade 、 cache 、 run 、 global
ダートラン
引数の受け渡しをサポートする 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
エラー処理
サーバーは包括的なエラー処理を実装します。
貢献
詳細な貢献ガイドラインについては、 CONTRIBUTING.md を参照してください。
コミット形式は次のとおりです:
<type>[optional scope]: [JIRA-123(optional)] <description>
例:
feat(tools): [DART-456] add support for dart test tags
ライセンス
マサチューセッツ工科大学