FlutterSDK Dusk

io.github.fluttersdk由 GitHub 帳號 fluttersdk 發布v0.0.13更新於 Oct 24, 2026

Drive live Flutter apps: snapshot the Semantics tree, tap, type, scroll and screenshot.

已驗證STDIO僅桌面瀏覽器自動化開發者工具

概覽

AI 產生的概覽

一個本機 stdio MCP 伺服器,讓 AI 助理驅動執行中的 Flutter 應用程式:讀取語意樹、點擊、輸入、捲動並截圖。

可以做什麼
檢查執行中的應用程式:輸出帶穩定參照標記的語意樹快照、觀察候選元件、截圖、讀取主控台輸出與擷取的 Flutter 錯誤,並檢視路由與彈出視窗。執行手勢操作:點擊、雙擊、右鍵、輸入、填寫、清除、拖曳、捲動、懸停、聚焦、失焦、勾選核取方塊、選擇選項、按鍵與導覽。管理應用程式生命週期:一次呼叫完成熱重載並重新快照、透過 CDP 調整視埠並模擬裝置設定、等待網路閒置、關閉應用程式。量測效能:以效能開始與結束包住一次互動,再取得影格歸因、追蹤與比較。透過 evaluate 工具在執行中的應用程式內執行運算式。
適用情境
適合助理需要以互動方式測試或除錯執行中的 Flutter 應用程式時,例如重現介面缺陷、驗證熱重載後的修正,或在不撰寫測試檔案的情況下走查某個流程。它針對執行中應用程式的非腳本化自動化,而非撰寫好的整合測試。
執行需求
以本機程序在使用者機器上執行(僅限桌面)。需要 Dart SDK 3.4.0 以上、Flutter 3.22.0 以上,並在應用程式中加入 fluttersdk_dusk 套件、執行其安裝指令以修改 main.dart 並產生 CLI。應用程式需在除錯或效能模式下啟動並安裝該外掛。
安裝前請注意
驅動必須在 main.dart 中以發行模式判斷包住;否則驅動會被包進發行版本。它會操作執行中的應用程式:點擊、輸入、導覽、熱重載與視埠調整都會改變執行狀態。evaluate 工具會在應用程式內執行運算式。它僅供除錯,不適合正式建置。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 FlutterSDK Dusk,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

[Dusk Logo]

Dusk

End-to-end driver for Flutter apps. Read by humans, driven by AI agents.
Snapshot the Semantics tree, drive any gesture, capture screenshots, observe live state, all from one CLI and one stdio MCP server.

[CI] [pub package] [pub points] [License: MIT] [GitHub stars]

Documentation · pub.dev · Issues


[!NOTE] Requires Dart SDK >= 3.4.0 and Flutter >= 3.22.0. dusk is debug-only: production builds tree-shake the entire driver across web, desktop, and mobile.

Installation

bash
flutter pub add fluttersdk_duskdart run fluttersdk_dusk dusk:install      # patches lib/main.dart + scaffolds ./bin/fsa + registers dusk plugin

That's it. After the second command, all 41 dusk:* commands surface through ./bin/fsa <cmd> (~110ms warm) or dart run fluttersdk_dusk <cmd> (works the same, ~3s startup), and the MCP server is one dart run fluttersdk_dusk mcp:install away. When fastcli (./bin/fsa) is absent, mcp:install writes dart run fluttersdk_dusk mcp:serve into .mcp.json automatically; no manual edit required. See MCP install: 8 clients for the per-client wiring. Manual wiring, Magic-stack integration, and the full per-command flag reference live in the Getting Started guide.

[!TIP] fastcli is the AOT-compiled artisan dispatcher (~110ms warm) shipped as ./bin/fsa. dusk:install scaffolds it for you automatically (best-effort; falls through to a warning when dart is not on PATH). After that, every ./bin/fsa <cmd> is the fast path. The CLI also runs as dart run fluttersdk_dusk <cmd> with the same surface, ~3s slower per call.

Why Dusk?

End-to-end testing on Flutter has always been a stitched-together ritual. flutter_driver ships a one-off socket protocol that does not survive hot restart. integration_test runs in-process against a simulated WidgetTester, but you write a test file, build, run, and wait. AI coding agents that want to drive the running app reach for ad hoc flutter test invocations, copy stack traces back into the prompt, and paste screenshots back, calling it a workflow.

Dusk closes that loop. A single VM Service extension family (ext.dusk.*), a single CLI namespace (dusk:*), and a single stdio MCP server back 41 CLI commands and 39 MCP tools (33 ext.dusk.* + 6 artisan:dusk:* substrate-routed). The same contracts power human-driven terminal calls and agent-driven MCP tool calls: dusk:tap --ref=e7 (CLI) and dusk_tap (MCP) reach the exact same code path. No test harness, no test file, no build step. Attach to the live app and the agent has eyes (dusk_snap, dusk_screenshot, dusk_observe) and hands (dusk_tap, dusk_type, dusk_scroll, dusk_drag). On Flutter web, the dusk:screenshot CLI command falls back to CDP Page.captureScreenshot when artisan was started with --cdp-port, bypassing the in-isolate extension that hangs under CanvasKit; the dusk_screenshot MCP tool still dispatches in-isolate, so web agents should use the CLI for screenshots. dusk_exceptions captures non-fatal FlutterErrors (including overflow) in-package so diagnostics work even without telescope.

ToolWhat it doesWhere Dusk fits
integration_test (Flutter SDK)In-process WidgetTester wrapper; runs tests via flutter driveDifferent niche: integration_test owns the authored test file; Dusk owns the unscripted running app. Use both.
patrol (Leancode, 694 likes)Native UI permissions + dialogs layered on integration_testOrthogonal: patrol owns authored tests with native dialogs; Dusk owns unscripted automation by humans and AI agents.
flutter_driver (Flutter SDK, legacy)One-off socket protocol; being phased outDusk is hot-restart safe via registerExtensionIdempotent (21 aggregator register functions), one contract for CLI and MCP, no test harness, no separate isolate.
maestro (13.7K stars)YAML DSL over OS accessibility layerDusk drives the Flutter widget tree directly (Semantics nodes + RenderObjects); no Flutter Desktop limitation; zero YAML to author.
mcp_flutter (298 stars)Flutter MCP toolkit with fmt_* toolsDusk is on pub.dev with verified publisher, framework-native Artisan plugin, e<N> and q<N> ref system, 6-step actionability gate.
playwright-mcp (33K stars)Browser MCP via accessibility tree + [ref=eN] tokensThe Flutter-native equivalent. Dusk's q<N> handles mirror Playwright's getByRole(); dusk_observe borrows Stagehand's observe-once-act-many pattern, ported to Flutter Semantics.

Features

FeatureDescription
🌳Semantics Snapshotdusk_snap emits a YAML tree with stable [ref=eN] tokens; every action targets a ref, no brittle XPath or coordinate guessing
🛠️41 CLI Commandssnap, tap, type, fill, drag, scroll, hover, dblclick, right_click, triple_click, focus, blur, clear, set_checkbox, select_option, press_key, wait, find, observe, navigate, navigate_back, get_routes, modal, reset_overlays, screenshot, hot_reload_and_snap, CDP resize + device, close_app, install, doctor, wait_for_network_idle, console, exceptions, perf_begin + perf_end + perf_insight + perf_run + perf_compare + perf_trace + perf_campaign
🤖39 MCP ToolsThe full CLI surface plus dusk_evaluate, exposed as stdio JSON-RPC tools to Claude Code, Cursor, Windsurf, VS Code Copilot, and any MCP-compatible agent
🚪6-Step Actionability GateEvery gesture passes defunct (preflight) → enabled → zero-rect → off-viewport (auto-scrolls) → stable (2-frame rect drift) → receives-events (hit-test path); no flaky taps, and a checks block when the last one could not be proven rather than a silent pass
🔖Playwright-style Locatorsq<N> re-resolvable handles via dusk_find walk the live Semantics tree on every action. Stale handles throw, never silently act on the wrong widget
🔄Hot Reload + Snap Round-tripdusk_hot_reload_and_snap returns {reloaded, durationMs, snapshot, screenshot, exceptions} in one call
🖥️CDP Device Emulationdusk_resize_viewport and dusk_device_profile (iphone-x, pixel-5, desktop-1440, plus 5 more) drive Chrome DevTools Protocol
📈Frame Attribution Sessiondusk_perf_begin / dusk_perf_end bracket a driven interaction and report which widget types built, how often and for how long, next to wind's cache hit/miss/bypass counters and magic's controller notifies. A session the engine did not render through is REFUSED rather than reported, because a table of zeros reads as "fast"
🎨Snapshot Enricher Plug-inDuskPlugin.enrichers.add() lets magic and wind add framework-specific YAML fragments via a frozen String? Function(Element, RefRegistry) contract
🔒Release Tree-ShakeConsumer wraps DuskPlugin.install() in !kReleaseMode, so debug and profile builds carry the driver; release builds tree-shake it across web, desktop, and mobile
📡AI-first DistributionCanonical fluttersdk-dusk skill at skills/fluttersdk-dusk/ and hosted docs MCP at mcp.fluttersdk.com, distributed to 8+ agents (Claude Code, Cursor, OpenCode, Gemini CLI, VS Code Copilot, Codex CLI, Cline, Roo Code) via fluttersdk/ai. First end-to-end driver in the Flutter ecosystem to ship its own LLM-agent skill bundle + docs MCP.

[!IMPORTANT] DuskPlugin.install() must be wrapped in if (!kReleaseMode) { ... } at the call site in lib/main.dart, so debug and profile builds carry it (dusk:perf_run measures a profile build). An app wired under kDebugMode before this still works in debug, but registers no ext.dusk.* in a profile build. Release builds tree-shake the entire driver across web (dart2js), desktop (dart2native), and mobile (AOT), but only when the guard exists. Without the guard, dusk ships into release binaries.

AI Coding Assistants

Dusk ships AI-first. The skill at skills/fluttersdk-dusk/SKILL.md teaches your agent the 6 core laws, the e<N> / q<N> ref grammar, the 6-step actionability vocabulary, the 39 MCP tool surface, and the agent-workflow playbooks. The same skill is distributed through fluttersdk/ai for Claude Code, Cursor, OpenCode, Gemini CLI, VS Code Copilot, Codex CLI, Cline, and Roo Code, one command:

bash
npx skills add fluttersdk/ai --skill fluttersdk-dusk

The hosted MCP server at mcp.fluttersdk.com exposes a search-docs tool over Streamable HTTP (no auth) for agents that need to query the dusk docs corpus directly. For stdio-only clients, the npx @fluttersdk/mcp bridge proxies stdio to the upstream HTTP server. The LLM-readable inventory lives at llms.txt. Full multi-client wire-up and the OpenCode registry URL live in the fluttersdk/ai README.

This is independent of dusk's own runtime MCP server (./bin/fsa mcp:serve, covered in the next section): the docs MCP teaches the agent ABOUT dusk; the runtime MCP gives the agent eyes and hands on a running Flutter app.

MCP install: 8 clients

Dusk is the first Flutter MCP server focused on UI automation (tap, snap, screenshot, observe) rather than runtime telemetry. The 39 dusk_* tools surface to any MCP-compatible agent.

[!NOTE] Configs below use ./bin/fsa (the fastcli wrapper, see top of README). If fastcli is not scaffolded yet, swap ./bin/fsa mcp:serve for dart run fluttersdk_dusk mcp:serve in every client row.

Standard config (any client that reads .mcp.json in the project root):

jsonc
{  "mcpServers": {    "fluttersdk": {      "command": "./bin/fsa",      "args": ["mcp:serve"],      "cwd": "."    }  }}
ClientInstall
Claude Codeclaude mcp add fluttersdk -- ./bin/fsa mcp:serve
VS Codecode --add-mcp '{"name":"fluttersdk","command":"./bin/fsa","args":["mcp:serve"]}', or drop the standard config into .vscode/mcp.json
CursorSettings > MCP > Add new MCP Server, or drop the standard config into ~/.cursor/mcp.json
WindsurfDrop the standard config into ~/.codeium/windsurf/mcp_config.json
GooseAdvanced settings > Extensions > Add custom extension; paste the standard config
WarpSettings > AI > Manage MCP Servers, or /add-mcp slash command with the standard config
Claude DesktopEdit claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/, Windows: %APPDATA%\Claude\) and add the standard config under mcpServers
Codexcodex mcp add fluttersdk ./bin/fsa mcp:serve

Before / after

Without DuskWith Dusk
You hot-reload, screenshot the result, drag the PNG into Claude, type "the counter button should be tappable but isn't, what's wrong?", scroll, copy the relevant widget source, paste back.Claude calls dusk_snap and reads the YAML tree with [ref=eN] tokens. Claude calls dusk_tap --ref=e7, the gate fires, the counter increments, Claude verifies via a fresh snap. Loop closes without you in the middle.
You wonder if the failing test is a timing issue or a real bug. You add Future.delayed(Duration(seconds: 2)) and re-run.The 6-step actionability gate fires before every gesture: defunct, not enabled, zero rect, off-viewport, not stable, obscured by another widget. Errors carry agent-parseable reason strings.

Typical agent session

[agent] artisan_start { device: macos }            # launch the app[agent] dusk_snap {}                                # semantic tree with stable refs[agent] dusk_observe {}                             # structured candidate list (Stagehand-style)[agent] dusk_tap { ref: "e7" }                      # tap a button by ref[agent] dusk_screenshot { format: "jpeg" }          # verify visually[agent] dusk_hot_reload_and_snap {}                 # reload + snap in one round-trip[agent] artisan_stop                                # tear down

Full per-tool input schemas + example calls in the MCP tool reference. For agents that read structured project context at attach time, the canonical entry point is llms.txt; it lists the 39 MCP tool names inline, plus the command surface, ref token grammar, and 6-step actionability vocabulary. The site serves the bare URLs to humans and the same paths with a .md suffix to LLM agents (e.g. https://fluttersdk.com/dusk/getting-started.md).

Examples

The example/ directory ships a vanilla Flutter showroom that gives every CLI command a live target widget on one route: TextField, Dropdown, Checkbox, Switch, counter button, Draggable + DragTarget, dialog, bottom sheet, 30 ListTile rows for scrolling, and navigation buttons across three named routes.

bash
cd example && flutter pub getdart run fluttersdk_dusk start --device=macos

Documentation

Full docs with live examples at fluttersdk.com/dusk: commands catalog, MCP tool reference, the 6-step actionability reference, Magic and Wind integration guides, and the snapshot enricher authoring guide. The internal architecture lives in ARCHITECTURE.md for contributors.

Contributing

bash
git clone https://github.com/fluttersdk/dusk.gitcd dusk && flutter pub getflutter test && dart analyze

CI enforces 80%+ line coverage on lib/ on every push to master and every PR back into it, with zero analyze issues and zero format drift on lib/, test/, and bin/. New behavior ships with a failing test first (red, green, refactor).

Before opening a pull request, run the same checks CI runs:

bash
dart format --output=none --set-exit-if-changed lib/ test/ bin/dart analyze lib/ test/ bin/flutter test --exclude-tags=integration --coverage --timeout=30sdart pub publish --dry-run

Report a bug · Request a feature

License

MIT, see LICENSE for details.


Built with care by FlutterSDK
If Dusk saves you debugging time, give it a star, it helps others discover it.

來源:README.md,提交 238ab21

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.0.13最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分