mcp_flutter
by: Arenukvern
MCP server for Flutter
πOverview
Purpose: To provide an AI-powered Model Context Protocol (MCP) server that enhances Flutter app development by integrating AI coding assistants for improved code analysis and debugging.
Overview: The Flutter Inspector MCP Server serves as a bridge between Flutter applications and AI coding assistants such as Cursor, Claude, and Cline. This server enables developers to access vital information about their apps, thus enhancing their development experience with features for analyzing widget trees and debugging layout issues.
Key Features:
-
Screenshot Functionality: Allows capturing screenshots of the Flutter app interface, facilitating visual debugging and app presentation.
-
Widget Tree Analysis: Offers insights into the structure of the app, enabling developers to understand widget relationships, current routes, and navigation states effectively.
Flutter Inspector MCP Server for AI-Powered Development
π A powerful Model Context Protocol (MCP) server that connects your Flutter apps with AI coding assistants like Cursor, Claude, and Cline.
β οΈ This project is a work in progress and not all methods (mostly Flutter Inspector related) are implemented yet.
Currently Flutter works with MCP server via forwarding server. Please see Architecture for more details.
Some other methods are not tested β they may work or not. Please use with caution. Most methods may be removed from the MCP server later to focus solely on Flutter applications and maybe Jaspr.
β οΈ WARNING β οΈ
Dump RPC methods (like dump_render_tree
) may cause huge token usage or overload context. They are disabled by default but can be enabled via environment variable DUMPS_SUPPORTED=true
.
See more details about environment variables in the .env.example
file.
OS Testing Statuses
What works:
β
macOS, β
iOS (error retrieval works, screenshots do not)
Should work, in testing:
π§ Android (some methods work, some do not, investigating)
Should work, not tested yet:
π€ Windows, Linux
Does not work currently:
β Web - issue unknown.
π Getting Started
- Quick Start is available in QUICK_START.md
- Configuration options are available in CONFIGURATION.md
π― What Agent Can Call
- Analyse errors: get precise and condensed errors of your app. Better than console messages as it only contains what the Agent needs, avoiding duplicates.
- Screenshot: get screenshot of the app. Works only with Claude (untested). Cursor and Cline don't support image types in response.
- Hot reload: hot reload the app.
Will be implemented (Work in Progress)
-
App info: size of screen, pixel ratio; enables widget selection.
-
Selection tool:
- Enable widget selection in Flutter Inspector.
- Select widget by logical pixel position.
- Get detailed info about app structure based on position.
-
Hot restart
In Research
- Inspect Current Route: view current navigation state
- Extensions: Flutter Provider/Riverpod states
- Extensions: Jaspr and Jaspr Provider
- Extensions: Flame
π Available Tools
All tools default to using port 8181 if no port is specified; you can specify a different port.
Most tools are described in MCP_RPC_DESCRIPTION.md.
π§ Troubleshooting
Make sure you:
- Verify that the forwarding server is running.
- Open DevTools in the browser.
- Added MCP extension to your Flutter app dev dependencies and enabled it in DevTools.
Connection Issues
- Ensure your Flutter app is running in debug mode.
- Verify port matches in both Flutter app and inspector.
- Check if port is not used by another process.
AI Tool Not Detecting Inspector
- Restart AI tool after config changes.
- Verify configuration JSON syntax.
- Check tool logs for connection errors.
π§ Smithery Integration (Work in Progress)
The Flutter Inspector is registered with Smithery's registry, making it discoverable and usable by other AI tools through a standardized interface.
Integration Architecture
Flutter App (Debug Mode) <--> DevTools Extension <--> Forwarding Server <--> MCP Server (Registered) <--> Smithery Registry
π€ Contributing
Contributions are welcome! Please feel free to submit pull requests or report issues on the GitHub repository.
π Learn More
π License
MIT β Feel free to use in your projects!
Flutter and Dart are trademarks of Google LLC.