A Model Context Protocol (MCP) server that connects AI assistants to running Flutter applications. It communicates with the Dart VM Service over WebSockets, giving AI tools direct access to application state, performance data, layout constraints, and console logs.
AI assistants (such as Claude or Copilot) can inspect, profile, and debug any Flutter application running in debug or profile mode. You can use this server to:
- Track widget rebuild frequencies.
- Diagnose rendering bottlenecks and frame jank.
- Analyze CPU usage and execution hotspots.
- Audit memory usage and find retaining paths that cause memory leaks.
- Capture console, stdout, stderr, and logging streams.
- Read local build sizes to locate heavy packages and assets.
- Validate App Links and Universal Links configurations.
- Drive scroll behaviors and trigger hot reloads.
Activate the package globally to register the flutter-agent-lens binary:
dart pub global activate flutter_agent_lensMake sure your global pub cache bin directory is in your system PATH.
Add this to your configuration file (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json, Windows: %APPDATA%\Claude\claude_desktop_config.json):
{
"mcpServers": {
"flutter_agent_lens": {
"command": "flutter-agent-lens"
}
}
}- Go to Settings > Features > MCP.
- Click + Add New MCP Server and set:
- Name:
flutter_agent_lens - Type:
command - Command:
flutter-agent-lens
- Name:
All tools require an active connection to a running application, unless stated otherwise. MCP clients discover tool schemas and parameters automatically from the server.
| Category | Tool | Description |
|---|---|---|
| App Connection | connectdisconnectdiscover_appsget_app_info |
Establish connection, discover running apps, and query VM metadata. |
| DTD Integration | connect_dtdget_active_location |
Interoperate with Dart Tooling Daemon (DTD) for active file path queries. |
| Diagnostics | diagnose_jankget_cpu_profileget_widget_rebuild_countsstart_profiling / stop_profilingstart_tracking_rebuilds / stop_tracking_rebuilds |
Track render times, CPU execution hotspots, and widget rebuild cycles. |
| Widget Inspector | get_widget_treeinspect_widgettoggle_widget_selectiontoggle_package_widgetstoggle_debug_flag |
Traverse widget trees and inspect constraints or toggle debug overlays. |
| Memory Analysis | get_memory_snapshotsave_snapshotlist_snapshotscompare_snapshotsdiff_heap_allocationsaudit_class_memory_leakget_object_referrers |
Monitor class allocations, diff snapshots, and inspect leak retaining paths. |
| Logs & Network | fetch_console_logsget_network_profilestart_network_capture / stop_network_capturetrigger_scroll_gesture |
Stream logs, capture HTTP network payloads, and simulate device scrolls. |
| Screenshots | take_screenshotcompare_layout_screenshots |
Capture app screens and perform visual pixel-diff regression tests. |
| Platform / Code | analyze_bundle_sizevalidate_deep_links |
Run local bundle size checks and check deep-link configurations. |
| Hot Reload | hot_reloadhot_restart |
Refresh code changes and reset app state (routes via DTD if active). |
| Debugger | get_call_stackset_exception_pause_modeadd_breakpointremove_breakpointevaluate_expression |
Control breakpoints, fetch stack frames, and evaluate Dart expressions. |
- Ensure your Flutter application is running in debug or profile mode. Release builds disable the VM Service.
- Check that the port is accessible. If running on physical devices or emulators, you may need to map ports using ADB:
adb reverse tcp:8181 tcp:8181. - If
discover_appsfails to connect, verify that your application has initialized the Dart Development Service (DDS). You can check by runningdiscover_appswithautoConnect: falseto list active endpoints.
- When connecting via
connect, ensure you provide the absolute path to your local Flutter project directory in theworkspace_rootargument. This allows the path resolver to match package references back to your local files.
This project is licensed under the MIT License. See the LICENSE file for details.