Claude Code can already run flutter analyze and flutter test from the terminal. So why add an MCP server? Because the Dart and Flutter MCP server reaches into things the terminal cannot easily see: a running app’s widget tree, its runtime errors, hot reload, and the analyzer’s symbol data.
This post explains what the server is, how to connect it to Claude Code, which tools it adds, and when it is worth the extra context.
What MCP is, briefly
Model Context Protocol (MCP) is a standard way to give an AI agent extra tools. Claude Code connects to MCP servers and can then call their tools like it calls its own. Anthropic’s docs show the general command:
claude mcp add [options] <name> -- <command> [args...]
Anthropic also gives a fair warning: “Verify you trust each server before connecting it.” The Dart server is published by the Dart team, which is about as trusted as a Flutter tool gets.
What the Dart and Flutter MCP server does
The Flutter docs describe it as “a Model Context Protocol (MCP) server that connects the assistant to the Dart SDK, giving it real-time access to analyzer diagnostics, symbol resolution, test runners, and runtime inspection.”
It ships with the Dart SDK. You start it with dart mcp-server, so there is nothing separate to install beyond a recent SDK. The package README lists the requirement as Dart 3.9.0-163.0.dev or later, and it says clients “should also support Roots,” which Claude Code does.
Install it in Claude Code
Option 1: the plugin
The Flutter docs give a Claude Code plugin route:
claude plugin marketplace add flutter/agent-plugins
claude plugin install dart-flutter@dart-flutter
The docs note: “Claude Code plugins discover skills and MCP servers, but don’t automatically load plugin rules.” If you want the plugin’s rules applied, reference them from your own CLAUDE.md.
Option 2: register the server yourself
If you only want the server, add it with claude mcp add:
claude mcp add dart -- dart mcp-server
Then confirm it is connected:
claude mcp list
Inside a session, /mcp shows server status.
Pick a scope
Anthropic’s docs describe three scopes:
- local (default): only you, only this project, stored in
~/.claude.json. - project: stored in
.mcp.jsonat the project root and meant to be checked into version control, so the whole team gets it. - user: you, across all projects, stored in
~/.claude.json.
For a Flutter team, project scope is usually right. Add --scope project and commit .mcp.json.
The tools it adds
The server’s README lists the tools. Grouped by job:
Code understanding
analyze_files: run the analyzer on the project.lsp: language server features like hover, signature help and symbol lookup.read_package_urisandrip_grep_packages: read and search inside dependencies (the search one needs ripgrep installed).
Code changes
dart_fixanddart_format: apply fixes and formatting.create_project: create a new Dart or Flutter project.pubandpub_dev_search: manage packages and search pub.dev.
Testing
run_tests: run tests through the proper test runner.
Running apps
list_devices,launch_app,list_running_apps,stop_app.hot_reloadandhot_restart.get_app_logsandget_runtime_errors.
Inspecting a running app
widget_inspector: read the widget tree.dtd,vm_serviceandget_active_location: connect to the Dart Tooling Daemon and VM service, and see where the cursor is in a connected editor.flutter_driver_command: drive the app.
Tool names may change. The README is clear that the package is “WIP. This package is still experimental and is likely to evolve quickly.”
Where it helps most
Fixing runtime errors you cannot see in the terminal
A layout overflow or a null error in a build method shows up at runtime. With the server, Claude can launch the app, read get_runtime_errors, change the code, and hot reload, without you pasting logs back and forth.
Understanding a widget tree
Ask “why is this button not visible?” and Claude can inspect the live widget tree instead of guessing from source. That is a real step up for UI bugs.
Fixing analyzer issues in bulk
analyze_files plus dart_fix turns “clean up all warnings” into a short loop. The terminal can do this too, but structured results are easier for the agent to act on.
Picking packages
pub_dev_search lets Claude look up packages before adding them, rather than relying on what it remembers.
When to skip it
Every MCP server adds tool definitions to Claude’s context. Anthropic’s cost docs suggest you prefer CLI tools when they work, since they add less context. If your work is mostly writing code and running flutter test, the plain terminal is enough. Turn the server on when you are debugging a running app, then disable it again with /mcp.
A sample session
- Start your simulator or emulator.
- Ask Claude: “List devices, launch the app on the iOS simulator, then check for runtime errors on the settings screen.”
- Claude calls
list_devicesandlaunch_app, connects to the running app with thedtdtool (the README says a DTD connection is “REQUIRED” before tools that touch a running app), then callsget_runtime_errors. - It edits the widget, calls
hot_reload, and checks again. - Finish with
run_testsandanalyze_filesbefore you review the diff.
For a broader view of driving the simulator from Claude Code, see Claude Code with the iOS simulator.
Pair it with good project rules
The server gives Claude better eyes. It does not tell Claude how your app should be built. That still comes from your rules file and skills:
- Put architecture, state management and testing rules in CLAUDE.md for Flutter.
- Add focused skills for repeated work. See the best Claude Code skills for Flutter.
- Use hooks to run format and analyze after edits, so you do not depend on the agent remembering.
Next steps
If you are starting fresh, the Flutter with Claude Code guide covers project setup, rules and the full build loop. The MCP server slots into that loop at the debug and verify steps. MobileKit’s Flutter skills work alongside it, since skills and MCP servers solve different problems.
Sources read on the day this post was written: Flutter docs: Dart and Flutter MCP server, GitHub: dart_mcp_server README, Claude Code docs: Connect Claude Code to tools via MCP and Claude Code docs: Manage costs effectively.