A C++ Model Context Protocol (MCP) server that enables LLMs to autonomously inspect and interact with Flutter applications via the VM Service Protocol.
Foundation & Build System complete. VM Service connection working end-to-end with real Flutter apps!
✅ Core Infrastructure (Phase 1)
- CMake build system with automatic dependency management
- JSON-RPC 2.0 protocol implementation
- STDIO transport for MCP communication
- MCP server with initialize and tools/list endpoints
- Tool registration system
- Comprehensive unit tests
- Windows build support
✅ VM Service Connection (Phase 2 - Complete)
- WebSocket client for Flutter VM Service Protocol
- JSON-RPC over WebSocket with async request/response correlation
- Isolate discovery and main isolate detection
- Connection management (connect/disconnect)
- Tested with real Flutter app (Bookfy) - Working perfectly!
- MCP Tools Available:
flutter_connect- Connect to Flutter app via VM Serviceflutter_disconnect- Disconnect from Flutter app
- Windows 10/11
- Visual Studio 2019+ or MinGW-w64
- CMake 3.20+
- Git
All dependencies are automatically fetched via CMake FetchContent:
- nlohmann/json v3.11.3 (JSON parsing)
- websocketpp 0.8.2 (WebSocket client)
- asio 1.28.0 (Async I/O)
- spdlog 1.12.0 (Logging)
- googletest 1.14.0 (Testing)
# Generate Visual Studio solution and open it
generate_vs_solution.bat
# Or quick generate for VS 2022
generate_vs2022.bat
# Build Debug
build_debug.bat
# Build Release
build_release.bat
# Run tests
run_tests.bat
# Clean build directory
clean.bat# Configure
cmake -B build -DCMAKE_BUILD_TYPE=Debug
# Build
cmake --build build --config Debug
# Run tests
./build/Debug/flutter_reflect_tests.exeSee VISUAL_STUDIO_GUIDE.md for detailed instructions.
flutter_reflect.exe- Main MCP server executableflutter_reflect_tests.exe- Unit test suitesimple_connect.exe- Example program (placeholder)
# Show help
flutter_reflect.exe --help
# Show version
flutter_reflect.exe --version
# Run with custom log level
flutter_reflect.exe --log-level debug
# Log to file
flutter_reflect.exe --log-file flutter_reflect.logAdd to %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"flutter-reflect": {
"command": "C:\\path\\to\\flutter_reflect.exe",
"args": ["--log-level", "info"]
}
}
}# For Windows Desktop
flutter run -d windows --vm-service-port=8181 --disable-service-auth-codes
# For Chrome Web
flutter run -d chrome --vm-service-port=8181 --disable-service-auth-codesLook for this line in the output:
A Dart VM Service on Windows is available at: http://127.0.0.1:8181/
The WebSocket URI is: ws://127.0.0.1:8181/ws
cd E:\C++\FlutterReflect
python test_mcp.pyOnce configured in Claude Desktop, you can ask Claude to:
- "Connect to my Flutter app at ws://127.0.0.1:8181/ws"
- "What's the VM version?"
- "Disconnect from the Flutter app"
✅ Initialize: FlutterReflect v1.0.0
✅ Tools available: ['flutter_connect', 'flutter_disconnect']
✅ Connected to Flutter app successfully
- VM: Dart 3.11.0-93.1.beta
- Main isolate: isolates/3149591706543463
- Isolate count: 1
✅ Disconnected successfully
FlutterReflect/
├── include/ # Public headers
│ ├── mcp/ # MCP protocol
│ ├── jsonrpc/ # JSON-RPC implementation
│ ├── flutter/ # Flutter VM Service (Phase 2+)
│ └── utils/ # Utilities
├── src/ # Implementation files
│ ├── mcp/ # MCP server
│ ├── jsonrpc/ # JSON-RPC handlers
│ ├── flutter/ # Flutter integration (Phase 2+)
│ ├── tools/ # MCP tools (Phase 2+)
│ └── main.cpp # Entry point
├── tests/ # Unit tests
├── examples/ # Example programs
└── CMakeLists.txt # Build configuration
- CMake build system
- JSON-RPC 2.0 implementation
- STDIO transport
- MCP server skeleton
- Basic tests
- WebSocket client ✓
- Flutter VM Service integration ✓
- Connection tools (flutter_connect, flutter_disconnect) ✓
- Tested with real Flutter app (Bookfy) ✓
- WidgetInspectorService wrapper
- Widget tree construction
- Inspection tools
- CSS-like selector syntax
- Widget matching
- Query tool
- Tap, type, scroll operations
- Wait mechanisms
- Interaction tools
- Screenshot, navigation
- Error handling
- Performance optimization
- Windows packaging
- Documentation
- v1.0.0 release
- ✅
flutter_connect- Connect to Flutter app via VM Service - ✅
flutter_disconnect- Disconnect from app
flutter_get_tree- Get widget tree snapshotflutter_query- Find widgets by selectorflutter_get_properties- Get widget properties
flutter_tap- Tap on widgetflutter_type- Type textflutter_scroll- Scroll widgetflutter_wait_for- Wait for widget
flutter_screenshot- Capture screenshotflutter_navigate- Navigate to routeflutter_go_back- Go back
# Run all tests
./build/Debug/flutter_reflect_tests.exe
# Run with CTest
cd build
ctest -C Debug --output-on-failureCurrent test coverage:
- JSON-RPC message parsing/serialization ✓
- Request/response handling ✓
- Error handling ✓
- Notification support ✓
LLM (Claude) ←→ MCP Client (Claude Desktop) ←→ FlutterReflect (C++ Server)
↓
WebSocket (VM Service Protocol)
↓
Flutter App (Desktop or Web)
- MCP Server Layer: JSON-RPC 2.0, STDIO transport, tool registry
- VM Service Client: WebSocket client for Flutter VM Service (Phase 2)
- Widget Inspector: High-level API for widget inspection (Phase 3)
- Selector Engine: CSS-like selector syntax (Phase 4)
- Interaction Engine: User interaction simulation (Phase 5)
- ✅
No tools registered yet- 2 connection tools now available! - ✅
Flutter VM Service connection not implemented- Now implemented! - Widget inspection not fully implemented yet (Phase 3 - Next)
- No widget query/selector capabilities yet (Phase 4)
- No interaction capabilities yet (tap, type, scroll - Phase 5)
- Testing with real Flutter app pending
Phase 2 (VM Service Connection) is partially complete! Next steps for contributors:
- Test Phase 2: Test connection tools with real Flutter apps
- Phase 3: Implement Widget Inspector and tree extraction
- Create test Flutter applications for integration testing
- Write integration tests for widget inspection
To be determined.
- MCP Protocol Specification
- Flutter VM Service Protocol
- [Implementation Plan](C:\Users\Vinicius Santos.claude\plans\splendid-booping-dream.md)
Built with: C++17, CMake, nlohmann/json, websocketpp, asio, spdlog
Target Platforms: Windows Desktop + Flutter Web