
Dart
STDIOMCP server exposing Dart SDK commands for AI-powered development workflows.
MCP server exposing Dart SDK commands for AI-powered development workflows.
A distributable Model Context Protocol (MCP) server that exposes Dart SDK commands for AI-powered development. This server bridges the gap between AI coding assistants and Dart/Flutter development workflows by implementing the Model Context Protocol (MCP).
This MCP server provides seamless access to the following Dart SDK commands:
Command | Description |
---|---|
dart-analyze | Analyze Dart code for errors, warnings, and lints |
dart-compile | Compile Dart to various formats (exe, AOT/JIT snapshots, JavaScript) |
dart-create | Create new Dart projects from templates |
dart-doc | Generate API documentation for Dart projects |
dart-fix | Apply automated fixes to Dart source code |
dart-format | Format Dart source code according to style guidelines |
dart-info | Show diagnostic information about the installed Dart tooling |
dart-package | Work with packages (get, add, upgrade, outdated, etc.) |
dart-run | Run Dart programs with support for passing arguments |
dart-test | Run tests with support for filtering and reporting options |
To install Dart MCP Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @egyleader/dart-mcp --client claude
The server can be run directly without installation using npx:
npx @egyleader/dart-mcp-server
For easier access, you can install the server globally:
npm install -g @egyleader/dart-mcp-server
Then run it using:
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
To use this MCP server with Windsurf or Codeium IDE, add the following to your mcp_config.json
file (typically located at ~/.codeium/windsurf/mcp_config.json
):
{ "mcpServers": { "dart": { "command": "npx", "args": [ "-y", "@egyleader/dart-mcp-server" ] } } }
DART_MCP_VERBOSE
: Set to any value to enable verbose logging for debuggingHere are examples of how to use the MCP tools provided by the server. These examples show the parameters that can be passed to each tool.
Analyze Dart code for errors, warnings, and lints:
{ "path": "lib/main.dart", "options": ["--fatal-infos", "--fatal-warnings"] }
Compile Dart code to various formats:
{ "path": "lib/main.dart", "format": "exe", "output": "build/app", "options": ["--verbose"] }
Supported formats: exe
, aot-snapshot
, jit-snapshot
, kernel
, js
Create a new Dart project from a template:
{ "projectName": "my_awesome_app", "template": "console", "output": "projects/my_awesome_app", "options": ["--force"] }
Note on projectName and output:
projectName
is provided, it's used as the directory name where the project is created.output
is provided, it's used as the directory where the project is created.Supported templates: console
, package
, server-shelf
, web
Generate API documentation for a Dart project:
{ "path": ".", "output": "doc", "options": ["--exclude", "lib/generated"] }
Apply automated fixes to Dart source code:
{ "path": "lib", "apply": true, "options": ["--pedantic"] }
Format Dart source code according to style guidelines:
{ "paths": ["lib/main.dart", "lib/models"], "setExitIfChanged": true, "options": ["--line-length=100"] }
Show diagnostic information about the installed Dart tooling:
{ "options": ["--verbose"] }
Work with packages (pub commands):
{ "command": "get", "workingDir": ".", "args": ["--offline"] }
Supported commands: get
, upgrade
, outdated
, add
, remove
, publish
, deps
, downgrade
, cache
, run
, global
Run Dart programs with support for passing arguments:
{ "script": "bin/server.dart", "workingDir": ".", "args": ["--port=8080", "--mode=production"] }
Run tests with support for filtering and reporting options:
{ "path": "test", "workingDir": ".", "options": ["--name=login", "--platform=chrome"] }
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
Analyze Dart code in a directory or file.
{ path?: string; // Directory or file to analyze options?: string[]; // Additional options for the dart analyze command }
Example:
{ path: "lib", options: ["--fatal-infos", "--fatal-warnings"] }
Compile Dart to various formats.
{ 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 }
Example:
{ format: "exe", path: "bin/main.dart", output: "bin/app" }
Create a new Dart project.
{ 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 }
Note:
output
is provided, the project will be created in that directory.projectName
is provided, it will be used as the directory name.Example:
{ template: "package", projectName: "my_dart_library", output: "projects/my_dart_library" }
Generate API documentation for Dart projects.
{ path?: string; // Directory containing the Dart package to document output?: string; // Output directory for the generated documentation options?: string[]; // Additional documentation options }
Example:
{ path: ".", output: "doc/api" }
Apply automated fixes to Dart source code.
{ path?: string; // Directory or file to apply fixes to apply?: boolean; // Whether to apply the suggested fixes (default: true) options?: string[]; // Additional fix options }
Example:
{ path: "lib", apply: true, options: ["--pedantic"] }
Idiomatically format Dart source code.
{ 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 }
Example:
{ paths: ["lib", "test"], setExitIfChanged: true, options: ["--line-length=80"] }
Show diagnostic information about the installed tooling.
{ options?: string[]; // Additional info options }
Example:
{ options: ["--verbose"] }
Work with packages (pub commands).
{ 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 }
Examples:
// Add a package { command: "add", args: ["rxdart"], workingDir: "my_project" } // Get dependencies { command: "get", workingDir: "my_project" }
Run a Dart program.
{ script: string; // Path to the Dart script to run args?: string[]; // Arguments to pass to the script workingDir?: string; // Working directory for the command }
Example:
{ script: "bin/main.dart", args: ["--verbose"], workingDir: "my_project" }
Run tests for a project.
{ path?: string; // Path to the test file or directory options?: string[]; // Additional test options workingDir?: string; // Working directory for the command }
Example:
{ path: "test", options: ["--coverage", "--name=auth"], workingDir: "my_project" }
# Watch mode for development pnpm run dev # Build for production pnpm run build
The server implements comprehensive error handling:
Please see CONTRIBUTING.md for detailed contribution guidelines.
Our commit format follows:
<type>[optional scope]: [JIRA-123(optional)] <description>
Example:
feat(tools): [DART-456] add support for dart test tags
MIT