tree: eff3e6838abe38be6a150f34a3977cd8c25f8f74 [path history] [tgz]
  1. _docs/
  2. bin/
  3. lib/
  4. test/
  5. test_fixtures/
  6. analysis_options.yaml
  7. CHANGELOG.md
  8. CONTRIBUTING.md
  9. LICENSE
  10. pubspec.yaml
  11. README.md
pkgs/dart_mcp_server/README.md

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.

If you are using a client that claims it supports roots but does not actually set them, pass --force-roots-fallback which will instead enable tools for managing the 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",
        "--experimental-mcp-server", // Can be removed for Dart 3.9.0 or later.
      ]
    }
  }
}

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.

Gemini Code Assist list mcp tools

For more information see the official Gemini Code Assist documentation for using agent mode.

Cursor

Add to 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
        "--force-roots-fallback" // Workaround for a Cursor issue with Roots support
      ]
    }
  }
}

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.

Tools

Tool NameFeature GroupDescription
analyze_filesstatic analysisAnalyzes the entire project for errors.
signature_helpstatic_analysisGets signature information for usage at a given cursor position.
hoverstatic_analysisGets the hover information for a given cursor position.
resolve_workspace_symbolstatic analysisLook up a symbol or symbols in all workspaces by name.
dart_fixstatic toolRuns dart fix --apply for the given project roots.
dart_formatstatic toolRuns dart format . for the given project roots.
pubstatic toolRuns a dart pub command for the given project roots.
pub_dev_searchpackage searchSearches pub.dev for packages relevant to a given search query.
get_runtime_errorsruntime analysisRetrieves the list of runtime errors that have occurred in the active Dart or Flutter application.
get_widget_treeruntime analysisRetrieves the widget tree from the active Flutter application.
get_selected_widgetruntime analysisRetrieves the selected widget from the active Flutter application.
hot_reloadruntime toolPerforms a hot reload of the active Flutter application.
connect_dart_tooling_daemon*configurationConnects to the locally running Dart Tooling Daemon.
get_active_locationeditorGets the active cursor position in the connected editor (if available).
run_testsstatic toolRuns tests for the given project roots.
create_projectstatic toolCreates a new Dart or Flutter project.

*Experimental: may be removed.