搜索插件、代码仓与 APP 分类

插件详情v0.7.0

marionette_flutter

通过MCP实现AI代理交互的Flutter扩展——让Claude、Copilot和Cursor能够点击、滚动、输入并截取您的应用画面。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
25万
喜欢数
77
Pub 分数
160

安装插件

flutter pub add marionette_flutter

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

Marionette Flutter 通过 MCP 协议使 AI 代理能够与 Flutter 应用交互,允许 Claude、Copilot 和 Cursor 等工具执行点击、滚动、输入和截屏等操作。它为 Flutter 应用扩展了自动化测试和 AI 驱动的 UI 交互功能,提升了开发工作流效率。该包可无缝集成到 Android、iOS、Web、macOS、Windows 和 Linux 等多个平台。专为在应用测试或自动化中利用大语言模型(LLM)的开发者设计,它弥合了 AI 代理与原生应用行为之间的差距。

适合场景

  • 使用AI代理的自动化UI测试
  • AI 驱动的应用程序探索和调试
  • 与 Copilot 和 Claude 的集成以实现应用程序交互
  • 测试期间的实时截图捕获
  • 通过MCP实现跨平台应用程序交互

主要特点

  • MCP协议支持AI代理通信
  • 支持点击、滚动、输入和截图操作
  • 多平台兼容性(Android、iOS、Web、macOS、Windows、Linux)
  • 与基于大语言模型的开发工具无缝集成
  • 轻量级 Flutter 扩展用于代理交互

适合对象

  • 使用AI代理进行测试的开发者
  • 实施AI驱动的UI自动化团队
  • 需要高级测试编排的Flutter项目
  • 与 Copilot、Claude 或 Cursor 合作的集成商
  • 专注于应用开发中生成式AI的项目

使用建议

  • 需要具有 MCP 支持的兼容 AI 代理
  • 可能需要额外设置以实现安全的代理访问
  • 仅限支持 MCP 的平台
  • 依赖外部AI工具以实现完整功能
  • 不适用于生产环境中的用户交互

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

marionette_mcp

Marionette MCP

License marionette_mcp pub.dev badge

"Playwright MCP/Cursor Browser, but for Flutter apps"

Marionette MCP enables AI agents (Claude Code, Copilot, Cursor, Gemini CLI, and more) to inspect and interact with running Flutter applications. It connects your AI agent directly to a running app via the Model Context Protocol (MCP), so it can see the widget tree, tap elements, enter text, scroll, and capture screenshots for automated AI-driven smoke testing and interaction.

Marionette MCP keeps the surface area intentionally small. It exposes only a handful of high-signal actions and returns the minimum actionable data, which helps keep prompts focused and context sizes under control.

Learn more about Marionette MCP:

Demo

Marionette MCP vs Flutter MCP

The official Dart & Flutter MCP server focuses on development-time tasks: searching pub.dev, managing dependencies, analyzing code, and inspecting runtime errors. It can also drive the UI, but it does so through Flutter Driver, which introduces extra instrumentation in your app. Marionette MCP focuses solely (and in an opinionated way) on runtime interaction: tapping buttons, entering text, scrolling, and taking screenshots, while requiring minimal changes to your app. Use Flutter MCP to build your app, use Marionette MCP to test and interact with it with minimal code changes.

Quick Start

[!NOTE] Your Flutter app must be prepared to be compatible with Marionette. The steps below are the short version — the Getting Started guide walks through each one.

  1. Prepare your app — add marionette_flutter and initialize MarionetteBinding in main.dart:

    flutter pub add marionette_flutter
    
    void main() {
      if (kDebugMode) {
        MarionetteBinding.ensureInitialized();
      } else {
        WidgetsFlutterBinding.ensureInitialized();
      }
      runApp(const MyApp());
    }
    
  2. Install the bridge — activate the MCP server (for the CLI alternative, see the CLI guide):

    dart pub global activate marionette_mcp
    
  3. Configure your AI tool — e.g. for Claude Code:

    claude mcp add --transport stdio marionette -- marionette_mcp
    

    Other tools (Cursor, Gemini CLI, Copilot, Antigravity): see Configuring your AI tool.

  4. Run your app in debug mode — flutter run, then copy the VM service URI from the console (e.g. ws://127.0.0.1:9101/ws).

  5. Connect and interact — ask your agent to connect using that URI and start driving the app.

[!IMPORTANT] Standard Material widgets work out of the box. If your app uses a custom design system, configuration is required — otherwise the agent can't see or tap your custom buttons and fields. Start with the Production Setup Checklist.

What you can do

Once connected, an agent can drive your app with a small, focused toolset: inspect the widget tree (get_interactive_elements), tap / secondary_tap / double_tap / long_press / swipe / pinch_zoom / scroll_to, enter_text, press_back_button, take_screenshots, read get_logs, and hot_reload. Full list: MCP Tools.

Your app can also expose its own actions to the agent via Custom Extensions — navigate by route name, seed test data, toggle feature flags, and more.

Some real-world prompts:

"I implemented the Forgot Password screen — connect, navigate to login, tap 'Forgot Password', enter a valid email, submit, and check the logs that the API call fired."

"I refactored the routing. Run a smoke test: cycle through all bottom-nav tabs and verify each screen loads without exceptions in the logs."

"Investigate the unresponsive 'Clear Cache' button on Settings — find it via get_interactive_elements, tap it, and analyze the logs."

Documentation

Guide What's inside
Getting Started Zero-to-driving in 5 steps.
Flutter Setup The binding, debug-only init, the single-binding rule.
Configuration Custom design systems, production checklist, complete main.dart.
Log Collection Wire up get_logs (logging, logger, or custom).
Semantics Make custom-painted / rich content readable to agents.
MCP Tools Full tool reference + AI-tool configuration.
Custom Extensions Expose app-specific actions as agent tools via registerMarionetteExtension.
CLI Drive Marionette from any shell-capable agent.
Troubleshooting Common gotchas and limitations.

Packages

Package Role
marionette_flutter The binding you add to your Flutter app. Required.
marionette_mcp MCP server bridging AI agents to your running app.
marionette_cli CLI alternative for shell-only / restricted environments.
marionette_logging LogCollector adapter for the logging package.
marionette_logger LogCollector adapter for the logger package.

🛠️ Maintained by LeanCode

This package is built with 💙 by LeanCode. We are top-tier experts focused on Flutter Enterprise solutions.

Why LeanCode?
  • Creators of Patrol – the next-gen testing framework for Flutter.

  • Production-Ready – We use this package in apps with millions of users.

  • Full-Cycle Product Development – We take your product from scratch to long-term maintenance.


Need help with your Flutter project?

👉 Hire our team   •   Check our other packages

所属分类

依赖

依赖清单 2 项

源码仓库

使用此插件的项目