Token导航 LogoToken导航TokenDH.com
Dart MCP logo
开发工具stdio官方级别未说明来源级核验

Dart MCP

MCP Server

@smithery/cli

一个可分发的模型上下文协议(MCP)服务器,为AI驱动的开发提供Dart SDK命令,连接AI编码助手与Dart/Flutter开发工作流。

工具数

10

提示词数

0

GitHub Stars

6

资源数

0
代码分析TypeScriptClaudeClaude DesktopClaudeWindsurfCline

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

egyleader

提供方

egyleader

最后核验

2026/5/17 20:55

运行时

Node.js

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

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

详细介绍

Dart MCP服务器

](https://www.npmjs.com/package/@egyleader/dart-mcp-server) ![License: MIT](https://opensource.org/licenses/MIT) ](https://smithery.ai/server/@egyleader/dart-mcp)

一个可分发的模型上下文协议(MCP)服务器,为AI驱动的开发提供Dart SDK命令。该服务器通过实现模型上下文协议(MCP)弥合了AI编码助手和Dart/Flutter开发工作流程之间的差距。

特性

此MCP服务器提供对以下Dart SDK命令的无缝访问:

命令描述
dart-analyze分析Dart代码中的错误、警告和lints
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集成:与任何MCP客户端兼容,包括Windsurf、Cline和其他模型上下文协议实现

先决条件

  • Node.js:18.x或更高
  • Dart SDK:已安装3.0或更高版本,并在PATH中可用

安装

通过Smithery安装

通过以下方式自动安装Dart MCP Server for Claude Desktop 史密瑟里:

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代码中的错误、警告和lints:

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

dart编译

将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 如果提供,它将用作创建项目的目录名。
  • 如果 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"]
}

飞镖包装

使用包(发布命令):

{
  "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许可证获得许可-请参阅 许可证 文件以获取详细信息。

贡献

欢迎投稿!请随时提交拉取请求。

工具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编译

将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"]
}

飞镖包装

使用包(发布命令)。

{
  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命令中正确传播退出代码

贡献

请看 贡献.md 详细的贡献指南。

我们的提交格式如下:

[optional scope]: [JIRA-123(optional)] 

例子:

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

许可证

麻省理工学院

目录标签

目录标签

代码分析TypeScriptClaudeDart开发本地部署AI辅助编程Flutter工具自动化编译

支持客户端

Claude DesktopClaudeWindsurfCline

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

session

运行时(runtime,运行环境)

Node.js

部署方式(deploymentType,部署类型)

local-only

来源包(packageName,安装包名)

@smithery/cli

工具数量(toolCount,工具数)

10

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiosessionlocal-only

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP