
Dart and Flutter MCP Server
MCPDart 团队官方 MCP 服务器(dart mcp-server):分析项目错误、搜索 pub.dev 并管理依赖、连接运行中的 Flutter 应用做热重载、读取运行时错误与 Widget 树。需要 Dart 3.9 及以上,仍处实验阶段。
The Dart Tooling MCP Server exposes Dart and Flutter development tool actions to compatible AI-assistant clients.
Status
WIP. This package is still experimental and is likely to evolve quickly.
Set up your MCP client
Note: all of the following set up instructions require Dart 3.9.0-163.0.dev or later.
The Dart MCP server can work with any MCP client that supports standard I/O (stdio) as the transport medium. To access all the features of the Dart MCP server, an MCP client must support Tools and Resources. For the best development experience with the Dart MCP server, an MCP client should also support Roots.
Here are specific instructions for some popular tools:
Gemini CLI
To configure the Gemini CLI to use the Dart MCP
server, edit the .gemini/settings.json file in your local project (configuration will only
apply to this project) or edit the global ~/.gemini/settings.json file in your home directory
(configuration will apply for all projects).
{
"mcpServers": {
"dart": {
"command": "dart",
"args": [
"mcp-server"
]
}
}
}
For more information, see the official Gemini CLI documentation for setting up MCP servers.
Gemini Code Assist in VS Code
Note: this currently requires the "Insiders" channel. Follow instructions to enable this build.
Gemini Code Assist's Agent mode integrates the Gemini CLI to provide a powerful AI agent directly in your IDE. To configure Gemini Code Assist to use the Dart MCP server, follow the instructions to configure the Gemini CLI above.
You can verify the MCP server has been configured properly by typing /mcp in the chat window in Agent mode.

For more information see the official Gemini Code Assist documentation for using agent mode.
Cursor
The easiest way to configure the Dart MCP server with Cursor is by clicking the "Add to Cursor" button above.
Alternatively, you can configure the server manually. Go to Cursor -> Settings -> Cursor Settings > Tools & Integrations, and then click "Add Custom MCP" or "New MCP Server"
depending on whether you already have other MCP servers configured. Edit the .cursor/mcp.json file in your local project (configuration will only apply to this project) or
edit the global ~/.cursor/mcp.json file in your home directory (configuration will apply for
all projects) to configure the Dart MCP server:
{
"mcpServers": {
"dart": {
"command": "dart",
"args": [
"mcp-server",
"--experimental-mcp-server" // Can be removed for Dart 3.9.0 or later
]
}
}
}
For more information, see the official Cursor documentation for installing MCP servers.
GitHub Copilot in VS Code
Note: requires Dart-Code VS Code extension v3.114 or later.
To configure the Dart MCP server with Copilot or any other AI agent that supports the VS Code MCP API, add the following to your VS Code user settings (Command Palette > Preferences: Open User Settings (JSON)):
"dart.mcpServer": true
By adding this setting, the Dart VS Code extension will register the Dart MCP Server configuration with VS Code so that you don't have to manually configure the server. Copilot will then automatically configure the Dart MCP server on your behalf. This is a global setting. If you'd like the setting to apply only to a specific workspace, add the entry to your workspace settings (Command Palette > Preferences: Open Workspace Settings (JSON)) instead.
For more information, see the official VS Code documentation for enabling MCP support.
Connecting to Applications
Often, connecting to your running application is as simple as asking your agent to do it, you can say "connect to my flutter web app" or "connect to my web server".
This works by discovering Dart Tooling Daemon instances on your machine, and then discovering dart and flutter applications that are registered with those instances.
See the sections below for specific hints and details for flutter versus dart apps, as well as hints about how to make this work better in multi-app scenarios, or use fewer tokens.
Flutter Applications
Flutter applications are automatically registered with the Dart Tooling Daemon
when running in debug/profile mode, unless --no-dds is passed (the Dart
Development Service is actually what spawns DTD, so disabling that disables
DTD).
Dart Applications
To connect to a pure Dart application, you need to run the application with the
--observe flag. This will start the Dart Tooling Daemon (DTD) and register the
application with it.
Pass --print-dtd
Both dart and flutter support the --print-dtd flag to get an explicit
reference to the DTD URI for that application. This is especially useful when the
agent is spawning the process, because it can avoid having to list all available
DTD URIs and trying to pick the right one.
It is recommended to put this instruction in a RULES file so that it is always available to the agent. For example, in a GEMINI.md file in your project:
## Launching Dart and Flutter Applications
- Always pass the `--print-dtd` flag to `dart` or `flutter` when spawning an
application.
- For `dart` applications, always pass the `--observe` flag to enable the app to
be connected to.
- Both `--print-dtd` and `--observe` must come before the script name or path
when spawning `dart` applications: `dart --observe --print-dtd bin/main.dart`.
Tools
Not all tools are enabled by default. Use the --enable and --disable flags
to control which tools are available, by tool name or by category. For example,
to enable the tools for launching and managing Flutter apps (the
flutter_app_lifecycle category):
{
"mcpServers": {
"dart": {
"command": "dart",
"args": [
"mcp-server",
"--enable",
"flutter_app_lifecycle"
]
}
}
}
Enabling a category also enables any tools in that category which are disabled
by default. Disabling takes precedence over enabling at the same level, and
names take precedence over categories. Run dart mcp-server --help for the
full list of tool and category names.
| Tool Name | Title | Description | Categories | Enabled by default |
|---|---|---|---|---|
analyze_files | Analyze projects | Analyzes specific paths, or the entire project, for errors. | analysis | Yes |
create_project | Create project | Creates a new Dart or Flutter project. | cli | No |
dart_fix | Dart fix | Runs dart fix --apply for the given project roots. | cli | No |
dart_format | Dart format | Runs dart format . for the given project roots. | cli | No |
dtd | Dart Tooling Daemon | Manage live app connections to running Dart and Flutter apps using the Dart Tooling Daemon (DTD). A DTD connection is REQUIRED before listing apps or using any tool that interacts with a running app (hot reload/restart, runtime errors, widget inspector, flutter driver, vm service, etc). Workflow: 1. listDtdUris: find available DTD instances and their URIs. If you see DTD instances with a working dir that looks like a home directory, these are likely connected to an IDE and you should connect to those to find IDE launched apps.2. connect with the chosen uri. All apps registered with that DTD instance are connected to automatically.3. listConnectedApps (optional): list the apps on all connected DTD instances. This only returns apps after step 2.Use disconnect to disconnect from a DTD instance. | dart_tooling_daemon | Yes |
flutter_driver_command | Flutter Driver | Run a flutter driver command | flutter_driver | Yes |
get_active_location | Get Active Editor Location | Retrieves the current active location (e.g., cursor position) in the connected editor. Requires an active DTD connection. | dart_tooling_daemon | No |
get_app_logs | Returns the collected logs for a given flutter run process id. Can only retrieve logs started by the launch_app tool. | flutter, flutter_app_lifecycle | No | |
get_runtime_errors | Get runtime errors | Retrieves the most recent runtime errors that have occurred in the active Dart or Flutter application. Requires an active DTD connection. | dart_tooling_daemon | Yes |
hot_reload | Hot reload | Performs a hot reload of the active Flutter application. Requires an active DTD connection, use the dtd tool to discover and connect to an app pro-actively (don't wait for the user to instruct you, this is a safe operation with minimal bad consequences). | flutter | Yes |
hot_restart | Hot restart | Performs a hot restart of the active Flutter application. This applies the latest code changes to the running application, including changes to global const values, while resetting application state. Requires an active DTD connection. Doesn't work for Non-Flutter Dart CLI programs. | flutter | Yes |
launch_app | Launches a Flutter application and returns its DTD URI. | flutter, flutter_app_lifecycle | No | |
list_devices | Lists available Flutter devices. | flutter, flutter_app_lifecycle, cli | No | |
list_running_apps | Returns the list of running app process IDs and associated DTD URIs for apps started by the launch_app tool. | flutter, flutter_app_lifecycle | No | |
lsp | Language Server Protocol | Interacts with the Dart Language Server Protocol (LSP) to provide code intelligence features like hover, signature help, and symbol resolution. Commands: - hover: Get hover information (docs, types) at a position. Requires: uri, line, column. - signatureHelp: Get signature help at a position. Requires: uri, line, column. - resolveWorkspaceSymbol: Fuzzy search for symbols by name. Requires: query. | analysis | Yes |
pub | pub | Runs a pub command for the given project roots, like dart pub get or flutter pub add. | cli, package_deps | Yes |
pub_dev_search | pub.dev search | Searches pub.dev for packages relevant to a given search query. The response will describe each result with its download count, package description, topics, license, and publisher. | package_deps | Yes |
read_package_uris | Reads "package" and "package-root" scheme URIs which represent paths under Dart package dependencies. "package" URIs are always relative to the "lib" directory and "package-root" URIs are relative to the true root directory of the package. For example, the URI "package:test/test.dart" represents the path "lib/test.dart" under the "test" package. "package-root:test/example/test.dart" represents the path "example/test.dart". This API supports both reading files and listing directories. | package_deps | Yes | |
rip_grep_packages | Uses ripgrep to find patterns in package dependencies. Note that ripgrep must be installed already, see https://github.com/BurntSushi/ripgrep for instructions. | package_deps | Yes | |
roots | Manage project roots. | None | Yes | |
run_tests | Run tests | Run Dart or Flutter tests with an agent centric UX. ALWAYS use instead of dart test or flutter test shell commands. | cli | No |
stop_app | Kills a running Flutter process started by the launch_app tool. | flutter, flutter_app_lifecycle | No | |
vm_service | VM Service | Manage and interact with VM service connections. This tool allows you to connect to an app using its VM service URI, disconnect from it, invoke VM service methods directly, or list the services that VM service clients registered on it. Connecting allows features like hot reload to work on apps not launched via DTD. | dart_tooling_daemon | Yes |
widget_inspector | Widget Inspector | Interact with the Flutter widget inspector in the active Flutter application. Requires an active DTD connection. | flutter | Yes |
Prompts
The server also provides the following prompts. Prompts are enabled and
disabled with the same --enable and --disable flags as tools, by prompt name
or by category.
| Prompt Name | Title | Description | Arguments | Categories | Enabled by default |
|---|---|---|---|---|---|
flutter_driver_user_journey_test | User journey flutter driver test | Prompts the LLM to attempt to accomplish a user journey in the running app using flutter driver. If successful, it will then translate the steps it followed into a flutter driver test and write that to disk. | user_journey (optional): The user journey to perform and write a test for. | flutter_driver | Yes |
Connect to a running Flutter app
Recent Flutter versions auto-register a DTD via DDS for every flutter run
in debug or profile mode — no extra flag is needed. Discover and connect:
dtd(command: "listDtdUris")
dtd(command: "connect", uri: "ws://127.0.0.1:<port>/<token>=")
dtd(command: "listConnectedApps")
listConnectedApps returns each app's VM Service URI. When more than one
app is connected, every subsequent tool call must include appUri (that
VM Service URI) to disambiguate.
Flutter Driver
To use finder-based UI commands (tap, enter_text, screenshot,
scroll, waitFor…), your app must call enableFlutterDriverExtension()
before runApp() (see the Flutter Driver documentation for background).
This works on every platform, web included. Gate it behind a define so
release builds never ship it:
import 'package:flutter_driver/driver_extension.dart';
void main() {
if (const bool.fromEnvironment('ENABLE_FLUTTER_DRIVER')) {
enableFlutterDriverExtension();
}
runApp(const MyApp());
}
Launch with the flag:
flutter run -d <device-id> --dart-define=ENABLE_FLUTTER_DRIVER=true
bool.fromEnvironment is baked at compile time; toggling it requires a
quit and relaunch, not a hot reload.
Driving the UI
flutter_driver_command(command: "screenshot", appUri: "...")
flutter_driver_command(command: "tap", finderType: "ByText", text: "Sign In", appUri: "...")
The enabled parameter (used by set_semantics, set_frame_sync,
set_text_entry_emulation) is passed as a string — "true" or "false",
not an unquoted bool.
A few non-obvious finder rules:
- TextField hint text is part of the field decoration, not a
Textwidget —ByTextwill not find it. UseBySemanticsLabel(or add aValueKeyand useByValueKey). BySemanticsLabelrequires semantics enabled. Callflutter_driver_command(command: "set_semantics", enabled: "true")once per session before relying on it; the semantics tree only builds when accessibility is on.- Multiple
TextFields on screen makeByType: "TextField"fail with "ambiguously found multiple matching widgets". Add aValueKeyor useBySemanticsLabelwith the field's hint or label. - Frame sync timeouts on apps with continuous animations (Rive, Lottie,
spinners) — call
flutter_driver_command(command: "set_frame_sync", enabled: "false")once per session.
No pixel-coordinate clicks
Flutter Driver locates widgets only by finders (text, type, key, semantics).
There is no pixel-coordinate click. On Android, adb shell input tap x y
fills the gap from a regular terminal but is not exposed through the MCP
server. On iOS there is no known equivalent — every interactive widget the
agent might click on must expose visible text, a tooltip, a ValueKey, or
a semantics label.
Web
Everything above works on web. Two launch modes:
flutter run -d chrome opens a clean Chrome window spawned by Flutter,
and that window is the one DTD knows about.
flutter run -d web-server doesn't spawn a browser. DTD does not
list the app in listDtdUris until you open the URL in a browser and
the page finishes loading; that handshake is what registers the app with
DDS. The "Dart Debug Chrome extension" Flutter mentions in its log is
for human DevTools-style breakpoints; the MCP tools work without it.
⚠️ The second-browser trap (
-d chromeonly). Opening another Chrome tab at the same dev URL looks normal: the bundle is served and the app renders. But hot reload, runtime errors,listConnectedAppsstill shows a single entry. In-d chromemode, dwds tracks the window it spawned via CDP and ignores other clients.
Identifying instances when several are connected
listConnectedApps returns a name per app:
| Source | name |
|---|---|
| iOS / Android / desktop | Kind: Flutter - Device: <device> - Package: <bundle> |
| Web | Unknown web app (always — same string for every web instance) |
For web, match the VM Service URI suffix (<port>/<token>=) against the
A Dart VM Service on Web Server is available at: … line in each
flutter run log. Logging each launch to its own file
(flutter run … 2>&1 | tee /tmp/flutter-<port>.log) makes the lookup
trivial.
Notes on a few tools
analyze_filesruns the analysis server withcustom_lintplugins (e.g.riverpod_lint); the bashdart analyzeCLI does not. If your project relies on those plugins,analyze_filesis the only way an agent will see the diagnostics. Each entry in therootsargument accepts an optionalpathsfield — passpaths: ["lib"]to scope the analysis; without it, an iOS build pullsbuild/ios/SourcePackagesinto the analyzed set.widget_inspector(get_widget_tree)can return very large trees on non-trivial apps and overflow to a file. PasssummaryOnly: truefor a much smaller payload that still includes user widgets.
Troubleshooting
listDtdUrisreturns nothing on a freshly launched web app. The app must be loaded in a browser tab before DTD registers. Open the URL, wait a few seconds, retry.Connected to a VM Service but expected to connect to a Dart Tooling Daemon service.The URI passed toconnectwas the VM Service URI, not the DTD URI. Use thewsUrifromlistDtdUris; the VM Service URI is what you pass later asappUri.The flutter driver extension is not enabled.You launched without--dart-define=ENABLE_FLUTTER_DRIVER=true. The flag is compile-time — quit and relaunch.BySemanticsLabeltimes out. Callflutter_driver_command(command: "set_semantics", enabled: "true")first.- Frame sync timeouts on animated apps. Call
flutter_driver_command(command: "set_frame_sync", enabled: "false")once per session. hot_reload(or any tool) returns "must specify app URI". Multiple apps connected — passappUrion every call.- Live
flutter runexits withThe Dart compiler exited unexpectedly. Something deleted.dart_tool/orbuild/while the app was running (typicallyflutter clean,flutter pub get, or abuild_runnerrerun). Quit the app first, clean, relaunch.
相關資源

Dart and Flutter
PluginDart 与 Flutter 团队官方插件:一次装上 Flutter 技能与 Dart MCP 服务器,覆盖分层架构、响应式布局、布局报错修复、组件与集成测试、路由与国际化。需本机已装 Dart/Flutter SDK。
flutter/agent-plugins3.2k
Flutter Agent Plugins
SkillFlutter 团队官方维护的 agent 技能:分层架构、响应式布局、修复布局溢出、声明式路由、国际化、JSON 序列化,以及组件测试和集成测试,可配合 Dart MCP 服务器使用。
flutter/agent-plugins3.2k
Claude Skills (Fullstack Dev Skills)
Plugin把 60 多个全栈专家技能打包成一个插件:Python、TypeScript、Go、Rust、Java 等 12 种语言专家,以及 React、Django、Spring Boot 等框架专家,按请求自动激活;另含对接 Jira / Confluence 的项目工作流命令(需 Atlassian MCP)。
Jeffallan/claude-skills12.6k
Chrome DevTools MCP
MCP让 agent 控制并检查真实 Chrome:查看控制台与网络请求、截图、录制性能追踪并给出优化建议。Chrome DevTools 团队官方维护。
ChromeDevTools/chrome-devtools-mcp60k
MobileBuildMCP
MCP让 agent 构建、运行、测试与调试 iOS / macOS 项目,并控制模拟器和真机,同时附带命令行模式。原名 XcodeBuildMCP,现由 Sentry 维护;仅支持 macOS,需要 Xcode 16 以上。
getsentry/MobileBuildMCP6.6k
agent-device
MCPCallstack 出品:让编码 agent 在 iOS、Android、鸿蒙等模拟器与真机上检查、操作并验证应用,读取无障碍快照、截图录屏、抓取日志与性能数据。同时提供 CLI 与内置 MCP 服务器。
callstack/agent-device5.6k