DF

draganbajic/flutter-devtools-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

5 stars 3 forks 质量 72 趋势 13MIT

MCP server that connects AI agents to Flutter DevTools for runtime inspection, profiling, and debugging of Flutter applications

概览

An MCP (Model Context Protocol) server that connects AI coding assistants like , , , and to running Flutter applications through the Dart VM Service Protocol. Instead of switching between your IDE and DevTools, just tell your AI assistant: "Find my running Flutter app and connect to it" "Track widget rebuilds while I scroll through the feed" "Take a memory snapshot, I'll fix the leak, then compare" - Automatically find running Flutter apps on your machine - No manual URI copying — just say "connect to my Flutter app" - Scans processes, temp files, and common ports - Get the complete widget hierarchy of any screen with source file locations - Filter to show only your project's widgets (skip framework internals) - Deep-inspect individual widgets for constraints, size, and state - Recursively expands the full tree, not just the first level - Track exactly which widgets rebuild and how many times - Source file and line number for every rebuilding widget - Severity-rated output...

README

以下为原文 README 节选,完整内容请查看原文。

flutter-devtools-mcp

Give AI agents the power to inspect, profile, and debug your Flutter apps at runtime.

An MCP (Model Context Protocol) server that connects AI coding assistants like Cursor, Claude Code, Windsurf, and GitHub Copilot to running Flutter applications through the Dart VM Service Protocol.

Instead of switching between your IDE and DevTools, just tell your AI assistant:

“Find my running Flutter app and connect to it”

“Track widget rebuilds while I scroll through the feed”

“Take a memory snapshot, I’ll fix the leak, then compare”

┌─────────────────┐     stdio      ┌──────────────────────┐   WebSocket    ┌─────────────────┐
│  AI Agent        │◄──────────────►│  flutter-devtools-mcp │◄─────────────►│  Flutter App     │
│  (Cursor/Claude) │                │  (MCP Server)         │  VM Service   │  (--profile)     │
└─────────────────┘                └──────────────────────┘               └─────────────────┘

Features

Auto-Discovery

  • Automatically find running Flutter apps on your machine
  • No manual URI copying — just say “connect to my Flutter app”
  • Scans processes, temp files, and common ports

Widget Tree Inspection

  • Get the complete widget hierarchy of any screen with source file locations
  • Filter to show only your project’s widgets (skip framework internals)
  • Deep-inspect individual widgets for constraints, size, and state
  • Recursively expands the full tree, not just the first level

Widget Rebuild Tracking

  • Track exactly which widgets rebuild and how many times
  • Source file and line number for every rebuilding widget
  • Severity-rated output (green/yellow/orange/red)
  • Actionable recommendations for reducing unnecessary rebuilds

Performance Profiling

  • Start/stop profiling sessions while you interact with the app
  • Frame-by-frame analysis with jank detection
  • CPU hotspot identification with severity ratings
  • Build/Layout/Paint phase breakdown
  • AI-generated recommendations for fixing performance issues

Memory Analysis

  • Heap usage overview with utilization percentage
  • App & framework classes separated from VM internals
  • Automatic detection of suspicious allocation patterns
  • Optional forced GC before snapshot for accuracy

Snapshot Comparison (Before/After Diff)

  • Save named memory snapshots at any point
  • Compare two snapshots to see exactly what changed
  • Shows which classes grew/shrank with byte and instance deltas
  • Verdict: did your fix actually improve memory?

Network Traffic Inspector

  • Capture HTTP requests and responses in real-time
  • Method, URL, status code, response time, payload size
  • Flags slow requests (>2s) and large responses (>500KB)
  • Error tracking for failed requests
  • Note: Relies on dart:io HttpClient timeline events. May not capture traffic from some GraphQL clients (Ferry, gql_http_link) or custom HTTP implementations that bypass dart:io instrumentation.

Debug Actions

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "flutter-devtools": { "command": "node", "args": ["/path/to/flutter-devtools-mcp/dist/index.js"] } } }