Flutter Tools MCP服务器
概述
这 flutter-tools MCP服务器提供了与Flutter SDK交互的工具。它提供了两个主要工具: get_diagnostics 和 apply_fixes这些工具有助于分析和修复Dart/Flutter文件。
工具
get_诊断学
说明: 获取文件的Flutter/Dart诊断。
输入架构:
{
"type": "object",
"properties": {
"file": {
"type": "string",
"description": "Path to the Dart/Flutter file"
}
},
"required": ["file"]
}示例用法:
{
"name": "get_diagnostics",
"arguments": {
"file": "/path/to/your/file.dart"
}
}应用程序_修复
说明: 将Dart修复建议应用于文件。
输入架构:
{
"type": "object",
"properties": {
"file": {
"type": "string",
"description": "Path to the Dart/Flutter file"
}
},
"required": ["file"]
}示例用法:
{
"name": "apply_fixes",
"arguments": {
"file": "/path/to/your/file.dart"
}
}依赖项
@modelcontextprotocol/sdk: ^1.0.0node-pty: ^1.0.0which: ^4.0.0
开发依赖关系
@types/node: ^18.19.0@types/which: ^3.0.3typescript: ^5.3.3
脚本
build:编译TypeScript代码,并设置编译后的JavaScript文件的可执行权限。prepare:运行build脚本。watch:编译TypeScript代码并监视更改,自动重新编译。
安装
要安装MCP服务器,请将以下配置添加到MCP设置文件中:
{
"mcpServers": {
"flutter-tools": {
"command": "node",
"args": ["/path/to/flutter-tools/build/index.js"],
"env": {}
}
}
}替换 /path/to/flutter-tools/build/index.js 带有编译后的JavaScript文件的实际路径。
用法
- 确保Flutter SDK已安装并在您的PATH中可用。
- 使用配置的命令启动MCP服务器。
- 使用
get_diagnostics和apply_fixes必要的工具。
示例
node /path/to/flutter-tools/build/index.js