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 Server
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).
Features
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 |
Key Benefits
- Intelligent Path Handling: Automatically resolves relative paths to absolute paths, ensuring commands work correctly regardless of working directory
- Project Auto-Detection: Identifies Dart/Flutter projects in common locations like home directories and workspaces
- Cross-Platform Support: Works on macOS, Linux, and Windows
- Zero Configuration: Works out of the box with sensible defaults
- MCP Integration: Compatible with any MCP client, including Windsurf, Cline, and other Model Context Protocol implementations
Prerequisites
- Node.js: 18.x or higher
- Dart SDK: 3.0 or higher installed and available in your PATH
Installation
Using npx (recommended)
The server can be run directly without installation using npx:
Global Installation
For easier access, you can install the server globally:
Then run it using:
From Source
Integration with MCP Clients
Windsurf / Codeium IDE Configuration
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
):
Environment Variables
DART_MCP_VERBOSE
: Set to any value to enable verbose logging for debugging
MCP Tool Usage Examples
Here 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.
dart-analyze
Analyze Dart code for errors, warnings, and lints:
dart-compile
Compile Dart code to various formats:
Supported formats: exe
, aot-snapshot
, jit-snapshot
, kernel
, js
dart-create
Create a new Dart project from a template:
Note on projectName and output:
- If only
projectName
is provided, it's used as the directory name where the project is created. - If
output
is provided, it's used as the directory where the project is created. - The actual package/project name in Dart is derived from the final directory name by the Dart CLI.
Supported templates: console
, package
, server-shelf
, web
dart-doc
Generate API documentation for a Dart project:
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 (pub commands):
Supported commands: get
, upgrade
, outdated
, add
, remove
, publish
, deps
, downgrade
, cache
, run
, global
dart-run
Run Dart programs with support for passing arguments:
dart-test
Run tests with support for filtering and reporting options:
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Tool API Reference
dart-analyze
Analyze Dart code in a directory or file.
Example:
dart-compile
Compile Dart to various formats.
Example:
dart-create
Create a new Dart project.
Note:
- If
output
is provided, the project will be created in that directory. - If only
projectName
is provided, it will be used as the directory name. - The actual Dart package name is derived from the final directory name.
Example:
dart-doc
Generate API documentation for Dart projects.
Example:
dart-fix
Apply automated fixes to Dart source code.
Example:
dart-format
Idiomatically format Dart source code.
Example:
dart-info
Show diagnostic information about the installed tooling.
Example:
dart-package
Work with packages (pub commands).
Examples:
dart-run
Run a Dart program.
Example:
dart-test
Run tests for a project.
Example:
Development
Error Handling
The server implements comprehensive error handling:
- Command execution errors are captured and formatted appropriately
- Path resolution issues are reported with detailed diagnostics
- Timeout handling for long-running operations
- Proper exit code propagation from Dart commands
Contributing
Please see CONTRIBUTING.md for detailed contribution guidelines.
Our commit format follows:
Example:
License
MIT
You must be authenticated.
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).
- Features
- Prerequisites
- Installation
- Integration with MCP Clients
- MCP Tool Usage Examples
- License
- Contributing
- Tool API Reference
- Development
- Error Handling
- Contributing
- License