tree: e90d8f5622055380621137a14f90dbdf9825e682 [path history] [tgz]
  1. bin/
  2. lib/
  3. test/
  4. test_fixtures/
  5. analysis_options.yaml
  6. LICENSE
  7. pubspec.yaml
  8. README.md
pkgs/dart_tooling_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.

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.
get_runtime_errorsruntime analysisRetrieves the list of runtime errors that have occurred in the active Dart or Flutter application.
take_screenshotruntime analysisTakes a screenshot of the active Flutter application in its current state.
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).

*Experimental: may be removed.

Usage

To use this package, you will need to compile the bin/main.dart script to exe and use the compiled path as the command in your MCP server config.

dart compile exe bin/main.dart

With the example WorkflowBot

After compiling the binary, you can run the example workflow chat bot to interact with the server. Note that the workflow bot sets the current directory as the root directory, so if your server expects a certain root directory you will want to run the command below from there (and alter the paths as necessary). For example, you may want to run this command from the directory of the app you wish to test the server against.

dart ../dart_mcp/example/workflow_client.dart --server bin/main.exe

With Cursor

Go to Cursor -> Settings -> Cursor Settings and select “MCP”.

Then, click “Add new global MCP server”. Put in the full path to the executable you created in the first step as the “command”.

If you are directly editing your mcp.json file, it should look like this:

{
  "mcpServers": {
    "dart_mcp": {
      "command": "<path-to-compiled-exe>",
      "args": []
    }
  }
}

Each time you make changes to the server, you'll need to re-run dart compile exe bin/main.dart and reload the Cursor window (Developer: Reload Window from the Command Pallete) to see the changes.

Development

For local development, use the MCP Inspector.

  1. Run the inspector with no arguments:

    npx @modelcontextprotocol/inspector
    
  2. Open the MCP Inspector in the browser and enter the path to the server executable in the “Command” field (e.g. /Users/me/path/to/ai/pkgs/dart_tooling_mcp_server/bin/main.exe).

  3. Click “Connect” to connect to the server and debug using the MCP Inspector.