Skip to main content
Glama
Flutter Inspector MCP Server

Flutter Inspector MCP Server

Flutter Inspector MCP 服务器,助力 AI 开发

GitHub 存储库铁匠徽章

🔍 模型上下文协议 (MCP) 服务器,将您的 Flutter 应用与 AI 编码助手(如 Cursor、Claude、Cline、Windsurf、RooCode 或任何其他支持 MCP 服务器的 AI 助手)连接起来

观看小视频教程,了解如何使用 Cursor 在 macOS 上设置 mcp 服务器 - https://www.youtube.com/watch?v=NBY2p7XIass

[!NOTE] 由于正在开发一个新的实验包,它向客户端公开了 Dart 工具开发工具操作,因此将来可能不再需要这个项目。

因此我目前的重点是

  1. 稳定和完善这些在开发中有用的工具(因此它将更加即插即用) ,更多信息请参见 MCP_RPC_DESCRIPTION.md

  2. 找到不使用转发服务器的解决方法。

希望对你有用,

祝你今天过得愉快!

目前 Flutter 通过转发服务器与 MCP 服务器配合使用。更多详情,请参阅架构。

⚠️警告⚠️

转储 RPC 方法(例如dump_render_tree )可能会导致大量令牌使用或上下文过载。因此,现在默认情况下禁用它们,但可以通过环境变量DUMPS_SUPPORTED=true启用它们。

有关环境变量的更多详细信息,请参阅.env.example 。

Related MCP server: flutter-dev-mcp

🚀 入门

🎯 适用于 AI 代理的工具

错误分析

  • get_app_errors [资源|工具] - 从您的 Flutter 应用中检索精确且简明的错误信息用法:

    • 仅使用简短的错误描述。应过滤重复的错误,以避免 Agent 上下文窗口充斥着相同的错误。

    • 使用错误监视器捕获 Dart VM 错误。具体操作如下:首先启动 mcp 服务器、转发服务器,然后启动应用,打开开发者工具和扩展程序,最后重新加载应用,以捕获错误。所有错误都会被捕获到开发者工具扩展程序 (mcp_bridge) 中。

    已在以下平台测试:✅ macOS、✅ iOS未在以下平台测试:🚧 Android、🤔 Windows、🤔 Linux、❌ Web查看问题

开发工具

  • hot_reload [工具] - 执行 Flutter 应用程序的热重新加载已在以下平台测试:✅ macOS、✅ iOS、✅ Android未在以下平台测试:🤔 Windows、🤔 Linux、❌ Web查看问题

  • screenshot [资源|工具] - 捕获正在运行的应用程序的屏幕截图。配置:

    • 使用--images标志或IMAGES_SUPPORTED=true环境变量启用

    • 可以使用压缩来优化图像大小

    已在以下平台测试:✅ macOS、✅ iOS未在以下平台测试:🚧 Android、🤔 Windows、🤔 Linux、❌ Web查看问题

如果未指定端口,所有工具均默认使用端口 8181。您可以提供具体的端口号来覆盖此设置。

📚 请参阅MCP_RPC_DESCRIPTION中的更多内容

🔧 故障排除

get_app_errors - 由于错误是在 DevTools Extension 中捕获的,因此您需要确保在启动 MCP 服务器、转发服务器和 DevTools mcp_bridge 扩展后重新启动或重新加载 Flutter 应用程序。

还请确保:

  1. 验证转发服务器是否正在运行。

  2. 在浏览器中打开 Devtools。

  3. 已将 MCP 扩展添加到您的 Flutter 应用程序开发依赖项并在 Devtools 中启用它。

  4. 连接问题

    • 确保您的 Flutter 应用在调试模式下运行

    • 验证 Flutter 应用和检查器中的端口是否匹配

    • 检查端口是否未被其他进程使用

  5. AI工具未检测到检查员

    • 配置更改后重新启动 AI 工具

    • 验证配置 JSON 语法

    • 检查工具日志中的连接错误

🚧 Smithery 集成🚧(正在进行中)

Flutter Inspector 已在 Smithery 的注册表中注册,因此其他 AI 工具可以通过标准化界面发现和使用它。

集成架构

┌─────────────────┐     ┌──────────────┐     ┌──────────────┐     ┌─────────────────┐     ┌─────────────┐
│                 │     │              │     │              │     │                 │     │             │
│  Flutter App    │<--->│  DevTools    │<--->│  Forwarding  │<--->│   MCP Server   │<--->│  Smithery   │
│  (Debug Mode)   │     │  Extension   │     │  Server      │     │   (Registered) │     │  Registry   │
│                 │     │              │     │              │     │                 │     │             │
└─────────────────┘     └──────────────┘     └──────────────┘     └─────────────────┘     └─────────────┘

🤝 贡献

欢迎贡献代码!欢迎在GitHub 仓库提交 Pull 请求或报告问题。

📖 了解更多

📄 许可证

MIT——欢迎在您的项目中自由使用!


Flutter 和 Dart 是 Google LLC 的商标。

Available Tools

60 tools
dart_io_get_http_profile_requestC

RPC: Get details of a specific HTTP request from the profile

Inputs: requestId (required), port.

dart_io_get_open_file_by_idC

RPC: Get details of a specific open file by its ID

Inputs: fileId (required), port.

dart_io_get_open_filesC

RPC: Get list of currently open files in the Flutter app

Inputs: port.

dart_io_get_versionC

RPC: Get Flutter version information (ext.dart.io.getVersion)

Inputs: port.

dart_io_http_enable_timeline_loggingB

RPC: Enable or disable HTTP timeline logging. Connects to the default Flutter debug port (8181) unless specified otherwise.

Inputs: enabled (required), port.

dart_io_socket_profiling_enabledB

RPC: Enable or disable socket profiling. Connects to the default Flutter debug port (8181) unless specified otherwise.

Inputs: enabled (required), port.

debug_allow_bannerC

RPC: Toggle the debug banner in the Flutter app

Inputs: enabled (required), port.

debug_disable_clip_layersC

RPC: Toggle disabling of clip layers in the Flutter app

Inputs: enabled (required), port.

debug_disable_opacity_layersB

RPC: Toggle opacity layers debugging (ext.flutter.debugDisableOpacityLayers). Connects to the default Flutter debug port (8181) unless specified otherwise.

Inputs: enabled (required), port.

debug_disable_physical_shape_layersC

RPC: Toggle physical shape layers debugging (ext.flutter.debugDisablePhysicalShapeLayers)

Inputs: enabled (required), port.

debug_dump_focus_treeB

RPC: Dump the focus tree (ext.flutter.debugDumpFocusTree)

Inputs: port.

debug_dump_layer_treeB

RPC: Dump the layer tree (ext.flutter.debugDumpLayerTree). Connects to the default Flutter debug port (8181) unless specified otherwise.

Inputs: port.

debug_dump_render_treeB

RPC: Dump the render tree (ext.flutter.debugDumpRenderTree). Connects to the default Flutter debug port (8181) unless specified otherwise.

Inputs: port.

debug_dump_semantics_treeA

RPC: Dump the semantics tree (ext.flutter.debugDumpSemanticsTreeInTraversalOrder). Connects to the default Flutter debug port (8181) unless specified otherwise.

Inputs: port.

debug_dump_semantics_tree_inverseC

RPC: Dump the semantics tree in inverse hit test order (ext.flutter.debugDumpSemanticsTreeInInverseHitTestOrder)

Inputs: port.

debug_paint_baselines_enabledB

RPC: Toggle baseline paint debugging (ext.flutter.debugPaintBaselinesEnabled). Connects to the default Flutter debug port (8181) unless specified otherwise.

Inputs: enabled (required), port.

flutter_core_brightness_overrideC

RPC: Override the brightness for the Flutter app

Inputs: brightness (required), port.

flutter_core_did_send_first_frame_eventC

RPC: Check if the first frame event has been sent

Inputs: port.

flutter_core_did_send_first_frame_rasterized_eventC

RPC: Check if the first frame has been rasterized

Inputs: port.

flutter_core_evictC

RPC: Evict an asset from the Flutter app's cache

Inputs: asset (required), port.

flutter_core_invert_oversized_imagesB

RPC: Toggle inverting of oversized images for debugging

Inputs: enabled (required), port.

flutter_core_platform_overrideC

RPC: Override the platform for the Flutter app

Inputs: platform (required), port.

flutter_core_profile_platform_channelsB

RPC: Enable or disable profiling of platform channels

Inputs: enabled (required), port.

flutter_core_time_dilationB

RPC: Set the time dilation factor for animations in the Flutter app

Inputs: dilation (required), port.

get_active_portsA

Utility: Get list of ports where Flutter/Dart processes are listening. This is a local utility, not a Flutter RPC method.

Inputs: no named parameters.

get_extension_rpcsB

Utility: List all available extension RPCs in the Flutter app. This is a helper tool for discovering available methods.

Inputs: isRawResponse, isolateId, port.

get_supported_protocolsB

Utility: Get supported protocols from a Flutter app. This is a VM service method, not a Flutter RPC. Connects to the default Flutter debug port (8181) unless specified otherwise.

Inputs: port.

get_vm_infoB

Utility: Get VM information from a Flutter app. This is a VM service method, not a Flutter RPC. Connects to the default Flutter debug port (8181) unless specified otherwise.

Inputs: port.

inspector_add_pub_root_directoriesC

RPC: Add additional root directories for pub packages (ext.flutter.inspector.addPubRootDirectories)

Inputs: directories (required), port.

inspector_dispose_all_groupsA

RPC: Dispose all inspector groups to free up memory (ext.flutter.inspector.disposeAllGroups)

Inputs: port.

inspector_dispose_groupB

RPC: Dispose a specific inspector group to free up memory (ext.flutter.inspector.disposeGroup)

Inputs: groupId (required), port.

inspector_dispose_idB

RPC: Dispose a specific widget ID to free up memory (ext.flutter.inspector.disposeId)

Inputs: id (required), port.

inspector_get_children_details_subtreeC

RPC: Get the children details subtree for a widget (ext.flutter.inspector.getChildrenDetailsSubtree)

Inputs: objectId (required), port.

inspector_get_children_summary_treeB

RPC: Get the children summary tree for a widget (ext.flutter.inspector.getChildrenSummaryTree). Connects to the default Flutter debug port (8181) unless specified otherwise.

Inputs: objectId (required), port.

inspector_get_details_subtreeB

RPC: Get the details subtree for a widget. This provides detailed information about the widget and its descendants. Connects to the default Flutter debug port (8181) unless specified otherwise.

Inputs: objectId (required), port.

inspector_get_layout_explorer_nodeB

RPC: Get layout explorer information for a widget (ext.flutter.inspector.getLayoutExplorerNode). Connects to the default Flutter debug port (8181) unless specified otherwise.

Inputs: objectId (required), port.

inspector_get_parent_chainB

RPC: Get the parent chain for a widget (ext.flutter.inspector.getParentChain). Connects to the default Flutter debug port (8181) unless specified otherwise.

Inputs: objectId (required), port.

inspector_get_pub_root_directoriesB

RPC: Get the list of root directories for pub packages (ext.flutter.inspector.getPubRootDirectories)

Inputs: port.

inspector_get_root_widget_summary_treeC

RPC: Get the root widget summary tree (ext.flutter.inspector.getRootWidgetSummaryTree)

Inputs: port.

inspector_get_root_widget_summary_tree_with_previewsC

RPC: Get the root widget summary tree with previews from the Flutter app. This provides a hierarchical view of the widget tree with preview information.

Inputs: port.

inspector_get_selected_summary_widgetB

RPC: Get summary information about the currently selected widget in the Flutter app. Connects to the default Flutter debug port (8181) unless specified otherwise.

Inputs: port.

inspector_get_selected_widgetB

RPC: Get information about the currently selected widget in the Flutter app. Connects to the default Flutter debug port (8181) unless specified otherwise.

Inputs: port.

inspector_is_widget_creation_trackedB

RPC: Check if widget creation tracking is enabled in the Flutter app.

Inputs: port.

inspector_is_widget_tree_readyA

RPC: Check if the widget tree is ready for inspection (ext.flutter.inspector.isWidgetTreeReady)

Inputs: port.

inspector_remove_pub_root_directoriesB

RPC: Remove root directories from pub packages (ext.flutter.inspector.removePubRootDirectories)

Inputs: directories (required), port.

inspector_screenshotA

RPC: Take a screenshot of the Flutter app (ext.flutter.inspector.screenshot). Connects to the default Flutter debug port (8181) unless specified otherwise.

Inputs: port.

inspector_set_pub_root_directoriesC

RPC: Set the root directories for pub packages (ext.flutter.inspector.setPubRootDirectories)

Inputs: directories (required), port.

inspector_set_selection_by_idC

RPC: Set the selected widget by ID (ext.flutter.inspector.setSelectionById). Connects to the default Flutter debug port (8181) unless specified otherwise.

Inputs: selectionId (required), port.

inspector_showC

RPC: Show specific widget details in the Flutter app inspector.

Inputs: options (required), port.

inspector_structured_errorsB

RPC: Enable or disable structured error reporting in the Flutter app.

Inputs: enabled (required), port.

inspector_track_rebuild_dirty_widgetsB

RPC: Track widget rebuilds to identify performance issues (ext.flutter.inspector.trackRebuildDirtyWidgets). Connects to the default Flutter debug port (8181) unless specified otherwise.

Inputs: enabled (required), port.

inspector_track_repaint_widgetsB

RPC: Track widget repaints to identify rendering performance issues (ext.flutter.inspector.trackRepaintWidgets)

Inputs: enabled (required), port.

inspector_widget_location_id_mapB

RPC: Get a mapping of widget IDs to their source code locations (ext.flutter.inspector.widgetLocationIdMap)

Inputs: port.

layout_set_flex_factorC

RPC: Set the flex factor of a flex child widget (ext.flutter.inspector.setFlexFactor)

Inputs: factor (required), objectId (required), port.

layout_set_flex_fitB

RPC: Set the flex fit property of a flex child widget (ext.flutter.inspector.setFlexFit)

Inputs: fit (required), objectId (required), port.

layout_set_flex_propertiesC

RPC: Set multiple flex properties of a flex child widget (ext.flutter.inspector.setFlexProperties)

Inputs: objectId (required), properties (required), port.

performance_profile_render_object_layoutsC

RPC: Enable or disable profiling of render object layout operations (ext.flutter.profileRenderObjectLayouts)

Inputs: enabled (required), port.

performance_profile_render_object_paintsA

RPC: Enable or disable profiling of render object paint operations (ext.flutter.profileRenderObjectPaints)

Inputs: enabled (required), port.

repaint_rainbowC

RPC: Toggle repaint rainbow debugging (ext.flutter.repaintRainbow)

Inputs: enabled (required), port.

stream_listenA

RPC: Subscribe to a Flutter event stream. This is a VM service method for event monitoring. Connects to the default Flutter debug port (8181) unless specified otherwise.

Inputs: streamId (required), port.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.8/5.0

    Scored across 60 tools

    Disambiguation2/5

    Many tools are distinct, but there are confusingly similar pairs such as inspector_get_root_widget_summary_tree versus inspector_get_root_widget_summary_tree_with_previews, and multiple near-identical dump/toggle variants. With 60 tools, users need deep domain knowledge to pick the right one.

    Naming Consistency4/5

    Naming mostly follows snake_case with clear prefixes (debug_, inspector_, dart_io_, flutter_core_). Minor inconsistencies exist (e.g., flutter_core_invert_oversized_images vs debug_paint_baselines_enabled), but overall patterns are recognizable.

    Tool Count1/5

    60 tools is far beyond a coherent toolkit size for an inspector surface. Many are fine-grained toggles and getters that could be consolidated, making the set unwieldy.

    Completeness4/5

    Covers the major Flutter inspector workflows: tree dumps, selection, layout info, debug toggles, pub roots, and HTTP profiling. Some areas like hot reload/restart or broader VM service operations are absent, but within the inspector scope it is fairly complete.

    Maintenance

    ActivityActive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      D
      maintenance
      A distributable Model Context Protocol (MCP) server that exposes Dart SDK commands for AI-powered development. This server bridges the gap between AI coding assistants and Dart/Flutter development workflows by implementing the Model Context Protocol (MCP).
      10
      6
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      An MCP server that wraps Flutter CLI tools into structured, agent-friendly tools for AI coding agents, with features like two-phase test results, output capping, and managed app lifecycle.
      15
      15 npm
      4
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      An MCP server that lets AI agents see, tap, type, scroll, and assert inside live Flutter apps — no pre-written tests required.
      28
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP server for FlutterFlow that uses a command-palette model to manage projects, inspect UI, and apply safe edits via transactional ChangeSets.
      10
      MIT