
MCP服务器使AI代理能够在运行时与Flutter应用交互——让他们检查小部件、模拟点击、输入文本、滚动和截图。
概览
Marionette MCP 使 AI 代理(Claude Code、Copilot、Cursor、Gemini CLI 等)能够检查并与正在运行的 Flutter 应用交互。它通过模型上下文协议(MCP)将你的 AI 代理直接连接到正在运行的应用,从而可以看到控件树、点击元素、输入文本、滚动并截取截图,用于自动化的 AI 烟雾测试和交互。 Marionette MCP 有意保持表面积较小。它只暴露少数高信号动作,并返回最小可操作数据,有助于保持提示的聚焦和上下文大小的控制。 - 视频:用 Marionette MCP 点击你的应用- 文章:Marionette MCP - 你的 Flutter AI 代理,与运行中的应用互动 官方的 Dart & Flutter MCP 服务器专注于任务:搜索 pub.dev、管理依赖、分析代码以及检查运行时错误。它也可以驱动用户界面,但通过 Flutter 驱动实现,后者会在你的应用中引入额外的仪器。
概述(AI 翻译)
你的经纪人手和眼睛都在运行的Flutter应用上。
Marionette 将 Claude 代码、光标、Codex、Gemini CLI、Copilot 或任何 MCP 客户端连接到你在调试模式下运行的 Flutter 应用。代理看到屏幕,点击、输入、滚动、读取日志、热加载并写一份报告。如果你了解 Playwright MCP:这就是 Flutter 的版本。
网站****文档视频 ·文章
快速开始
-
将包添加到你的应用中,并在调试构建中初始化绑定:
-
给你的代理设置桥接器:MCP服务器或
marionetteCLI,随你偏好(每个代理): -
运行应用时使用
flutter run并粘贴它打印的ws://…/ws虚拟机服务 URI 到提示符中,或者让代理运行应用本身:
连接 ws://127.0.0.1:9101/…/ws。在个人资料中,格式错误的邮件必须显示错误并保持提交功能被禁用,且提交必须是有效的。
[!重要] Flutter 自己的小部件可以按原样运行。自定义设计系统只需一步配置,否则代理无法看到你的按钮和字段:详见配置。
代理人能做什么
| 工具 | |
|---|---|
| 看 | get_interactive_elements, take_screenshots |
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
Marionette MCP
Your agent’s hands and eyes on a running Flutter app.
Marionette connects Claude Code, Cursor, Codex, Gemini CLI, Copilot or any MCP client to the Flutter app you run in debug mode. The agent sees the screen, taps, types, scrolls, reads the logs, hot reloads, and writes a report of what it did. If you know Playwright MCP: this is that, for Flutter.
Website · Docs · Video · Article
Quick start
-
Add the package to your app and initialize the binding in debug builds:
flutter pub add marionette_fluttervoid main() { if (kDebugMode) { MarionetteBinding.ensureInitialized(); } else { WidgetsFlutterBinding.ensureInitialized(); } runApp(const MyApp()); } -
Give your agent a bridge: the MCP server or the
marionetteCLI, whichever you prefer (every agent):# MCP server, registered with Claude Code dart pub global activate marionette_mcp claude mcp add --transport stdio marionette -- marionette_mcp # or the CLI dart pub global activate marionette_cli -
Run the app with
flutter runand paste thews://…/wsVM service URI it prints into the prompt, or ask the agent to run the app itself:Connect to ws://127.0.0.1:9101/…/ws. On Profile, a malformed email must show an error and keep Submit disabled, and a valid one must submit.
[!IMPORTANT] Flutter’s own widgets work as is. A custom design system needs one configuration step, or the agent cannot see your buttons and fields: see Configure.
What the agent can do
| Tools | |
|---|---|
| See | get_interactive_elements, take_screenshots |
| Act | tap, enter_text, scroll_to, swipe, long_press, double_tap, pinch_zoom, press_key, press_back_button |
| Verify | get_logs, set_device_config (text scale, bold text, dark mode) |
| Iterate | hot_reload, hot_restart |
| Extend | your app’s own actions, registered with registerMarionetteExtension |
安装
npx skills add leancodepl/marionette_mcp # without the Dart toolchain