Dart MCP Server

平台与服务

by egyleader

连接 AI 编码助手与 Dart/Flutter 开发流程,借助 Dart SDK 命令完成分析、编译与项目管理,支持零配置与智能路径处理。

什么是 Dart MCP Server

连接 AI 编码助手与 Dart/Flutter 开发流程,借助 Dart SDK 命令完成分析、编译与项目管理,支持零配置与智能路径处理。

核心功能 (10 个工具)

dart-analyze
dart-compile
dart-create
dart-doc
dart-fix
dart-format
dart-info
dart-package
dart-run
dart-test

README

Dart MCP Server

npm version License: MIT smithery badge

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).

<a href="https://glama.ai/mcp/servers/vuwii9l5gu"> <img width="380" height="200" src="https://glama.ai/mcp/servers/vuwii9l5gu/badge" alt="Dart Server MCP server" /> </a>

Features

This MCP server provides seamless access to the following Dart SDK commands:

CommandDescription
dart-analyzeAnalyze Dart code for errors, warnings, and lints
dart-compileCompile Dart to various formats (exe, AOT/JIT snapshots, JavaScript)
dart-createCreate new Dart projects from templates
dart-docGenerate API documentation for Dart projects
dart-fixApply automated fixes to Dart source code
dart-formatFormat Dart source code according to style guidelines
dart-infoShow diagnostic information about the installed Dart tooling
dart-packageWork with packages (get, add, upgrade, outdated, etc.)
dart-runRun Dart programs with support for passing arguments
dart-testRun 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

Installing via Smithery

To install Dart MCP Server for Claude Desktop automatically via Smithery:

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

Using npx (recommended)

The server can be run directly without installation using npx:

bash
npx @egyleader/dart-mcp-server

Global Installation

For easier access, you can install the server globally:

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

Then run it using:

bash
dart-mcp-server

From Source

bash
# 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

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):

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

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:

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

dart-compile

Compile Dart code to various formats:

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

Supported formats: exe, aot-snapshot, jit-snapshot, kernel, js

dart-create

Create a new Dart project from a template:

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

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:

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

dart-fix

Apply automated fixes to Dart source code:

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

dart-format

Format Dart source code according to style guidelines:

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

dart-info

Show diagnostic information about the installed Dart tooling:

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

dart-package

Work with packages (pub commands):

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

Supported commands: get, upgrade, outdated, add, remove, publish, deps, downgrade, cache, run, global

dart-run

Run Dart programs with support for passing arguments:

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

dart-test

Run tests with support for filtering and reporting options:

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

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.

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

Example:

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

dart-compile

Compile Dart to various formats.

typescript
{
  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:

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

dart-create

Create a new Dart project.

typescript
{
  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:

  • 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:

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

dart-doc

Generate API documentation for Dart projects.

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

Example:

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

dart-fix

Apply automated fixes to Dart source code.

typescript
{
  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:

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

dart-format

Idiomatically format Dart source code.

typescript
{
  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:

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

dart-info

Show diagnostic information about the installed tooling.

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

Example:

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

dart-package

Work with packages (pub commands).

typescript
{
  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:

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

// Get dependencies
{
  command: "get",
  workingDir: "my_project"
}

dart-run

Run a Dart program.

typescript
{
  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:

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

dart-test

Run tests for a project.

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

Example:

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

Development

bash
# Watch mode for development
pnpm run dev

# Build for production
pnpm run build

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:

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

Example:

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

License

MIT

常见问题

Dart MCP Server 是什么?

连接 AI 编码助手与 Dart/Flutter 开发流程,借助 Dart SDK 命令完成分析、编译与项目管理,支持零配置与智能路径处理。

Dart MCP Server 提供哪些工具?

提供 10 个工具,包括 dart-analyze、dart-compile、dart-create

相关 Skills

MCP构建

by anthropics

Universal
热门

聚焦高质量 MCP Server 开发,覆盖协议研究、工具设计、错误处理与传输选型,适合用 FastMCP 或 MCP SDK 对接外部 API、封装服务能力。

想让 LLM 稳定调用外部 API,就用 MCP构建:从 Python 到 Node 都有成熟指引,帮你更快做出高质量 MCP 服务器。

平台与服务
未扫描109.6k

Slack动图

by anthropics

Universal
热门

面向Slack的动图制作Skill,内置emoji/消息GIF的尺寸、帧率和色彩约束、校验与优化流程,适合把创意或上传图片快速做成可直接发送的Slack动画。

帮你快速做出适配 Slack 的动图,内置约束规则和校验工具,少踩上传与播放坑,做表情包和演示都更省心。

平台与服务
未扫描109.6k

接口设计评审

by alirezarezvani

Universal
热门

审查 REST API 设计是否符合行业规范,自动检查命名、HTTP 方法、状态码与文档覆盖,识别破坏性变更并给出设计评分,适合评审接口方案和版本迭代前把关。

做API和架构方案时,它能帮你提前揪出接口设计问题并对齐最佳实践,评审视角系统,团队协作更省心。

平台与服务
未扫描9.0k

相关 MCP Server

Slack 消息

编辑精选

by Anthropic

热门

Slack 是让 AI 助手直接读写你的 Slack 频道和消息的 MCP 服务器。

这个服务器解决了团队协作中需要 AI 实时获取 Slack 信息的痛点,特别适合开发团队让 Claude 帮忙汇总频道讨论或发送通知。不过,它目前只是参考实现,文档有限,不建议在生产环境直接使用——更适合开发者学习 MCP 如何集成第三方服务。

平台与服务
82.9k

by netdata

热门

io.github.netdata/mcp-server 是让 AI 助手实时监控服务器指标和日志的 MCP 服务器。

这个工具解决了运维人员需要手动检查系统状态的痛点,最适合 DevOps 团队让 Claude 自动分析性能数据。不过,它依赖 NetData 的现有部署,如果你没用过这个监控平台,得先花时间配置。

平台与服务
78.3k

by d4vinci

热门

Scrapling MCP Server 是专为现代网页设计的智能爬虫工具,支持绕过 Cloudflare 等反爬机制。

这个工具解决了爬取动态网页和反爬网站时的头疼问题,特别适合需要批量采集电商价格或新闻数据的开发者。不过,它依赖外部浏览器引擎,资源消耗较大,不适合轻量级任务。

平台与服务
34.5k

评论