Skip to content

Commit 7e08894

Browse files
committed
docs(mcp): drop --print-dtd, clarify web limitation
- Remove --print-dtd from the launch command (auto-discovered via DDS in Flutter ≥3.27; flag no longer needed) - Add explicit web note: flutter_driver doesn't compile under dart2js, pair with a browser-driving MCP for UI actions - Trim wording to keep this section setup-oriented; full reference lives in dart-lang/ai
1 parent 857658e commit 7e08894

1 file changed

Lines changed: 22 additions & 13 deletions

File tree

src/content/ai/mcp-server.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -391,25 +391,34 @@ is now a single request.
391391

392392
[`package:fl_chart`]: {{site.pub-pkg}}/fl_chart
393393

394-
### Interact with a running app using Flutter Driver
394+
### Interact with a running app
395395

396-
You can use the Dart and Flutter MCP server to connect to a running
397-
Flutter app and interact with its UI—taking screenshots, tapping
398-
buttons, entering text, and scrolling.
396+
You can use the Dart and Flutter MCP server to drive a running
397+
Flutter app from your AI assistant—take screenshots, tap buttons,
398+
enter text, scroll, and hot reload.
399399

400-
Launch your app with `--print-dtd` and ask your AI assistant:
400+
Launch your app and ask your assistant to connect:
401401

402-
> Connect to my running Flutter app using the DTD URI from the
403-
> terminal output, then take a screenshot and tap "Sign In".
402+
```bash
403+
flutter run -d <device-id> --dart-define=ENABLE_FLUTTER_DRIVER=true
404+
```
405+
406+
> Connect to my running Flutter app, take a screenshot, then tap "Sign In".
404407
405-
The AI agent connects with the `dtd` tool, takes a screenshot with
406-
`flutter_driver_command`, and taps the button—all without you
407-
writing test code.
408+
The agent uses the `dtd` tool to discover the app and `flutter_driver_command`
409+
to drive its UI—no integration test setup required.
408410

409411
:::note
410-
Your app must call `enableFlutterDriverExtension()` before `runApp()`
411-
for Flutter Driver commands to work. See the
412-
[full setup guide][flutter-driver-guide] for details.
412+
**Mobile (iOS, Android) and desktop**: gate
413+
`enableFlutterDriverExtension()` behind a `--dart-define` flag so it stays
414+
out of production builds.
415+
**Web**: the `flutter_driver` package doesn't compile under dart2js. Pair
416+
the Dart MCP server with a browser-driving MCP for clicks and screenshots;
417+
the Dart MCP server still handles widget tree, runtime errors, and hot
418+
reload through DTD.
419+
420+
See the [setup guide][flutter-driver-guide] for the snippet, web modes,
421+
and common pitfalls.
413422
:::
414423

415424
[flutter-driver-guide]: https://github.com/dart-lang/ai/blob/main/pkgs/dart_mcp_server/README.md#connect-to-a-running-flutter-app

0 commit comments

Comments
 (0)