cavanaughdesign/flutter-toolkit-mcp
If you are the rightful owner of flutter-toolkit-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
A comprehensive Flutter toolkit Model Context Protocol (MCP) server that provides advanced tools for building Flutter applications.
flutter_system_info
Get comprehensive Flutter system information.
generate_flutter_widget
Generate Flutter widget code from structured input.
create_flutter_database
Setup databases (SQLite, Hive, Firestore, Supabase, PostgreSQL).
Flutter MCP Server
A comprehensive Flutter toolkit Model Context Protocol (MCP) server that provides advanced tools for building Flutter applications. This server enables AI models and MCP-compatible clients to interact with Flutter development environments, offering system detection, UI tools, widget builders, database management, debugging, analysis, code generation, and batch execution capabilities.
Features
Core Functionality
- Flutter System Detection: Analyze Flutter SDK installation, devices, and environment
- MCP Protocol Compliance: Full compatibility with the Model Context Protocol specification
- TypeScript Implementation: Robust, type-safe server implementation
- Extensible Architecture: Modular design for easy extension and customization
Available Tools
System Detection Tools
flutter_system_info
: Get comprehensive Flutter system informationflutter_check_installation
: Verify Flutter installation statusflutter_devices
: List all available Flutter devicesflutter_doctor
: Run Flutter doctor diagnosticsanalyze_flutter_project
: Analyze Flutter project structure and dependenciesexecute_flutter_command
: Execute Flutter CLI commands with error handling
UI & Widget Builder Tools
generate_flutter_widget
: Generate Flutter widget code from structured inputgenerate_widget_from_description
: Generate widgets from natural language descriptionsanalyze_flutter_ui
: Analyze UI code for patterns, complexity, and accessibilitysuggest_flutter_layout
: Get layout suggestions based on UI requirementsgenerate_themed_widget
: Generate theme-aware widgetsextract_flutter_theme
: Extract theme information from existing codegenerate_responsive_widget
: Create responsive widgets for different screen sizesgenerate_widget_tree_data
: Generate widget tree visualization data
Database & Backend Tools
create_flutter_database
: Setup databases (SQLite, Hive, Firestore, Supabase, PostgreSQL)generate_database_schema
: Generate database schemas from model definitionsgenerate_database_migration
: Create migration scripts for schema changesgenerate_crud_operations
: Generate CRUD operations for database tablessetup_database_connection
: Generate database connection and initialization codegenerate_data_access_layer
: Generate complete data access layer with repositoriesoptimize_database
: Analyze and optimize database performance
Code Generation & Analysis Tools
generate_flutter_tests
: Generate unit, widget, or integration testsrefactor_flutter_code
: Refactor code with extract widget/method, rename, move operationslint_flutter_code
: Lint Flutter code with custom rulesformat_flutter_code
: Format Dart/Flutter code according to style guidelinesgenerate_flutter_documentation
: Generate API documentationanalyze_flutter_code
: Run Flutter analyzer to identify issues and improvementsgenerate_code_from_template
: Generate code from predefined templatesdebug_flutter_app
: Start debugging sessions with specified configurationsanalyze_performance
: Analyze app performance and identify optimizations
Batch & Parallel Execution Tools
execute_batch_operations
: Execute multiple Flutter operations in batch with parallel processingrun_parallel_analysis
: Run parallel analysis on multiple Flutter projectsbulk_format_files
: Format multiple files using pattern matchingrun_batch_tests
: Run batch tests with parallel execution support
Installation
Prerequisites
- Node.js (v16 or higher)
- npm or yarn
- Flutter SDK (for system detection features)
Quick Setup
# Clone or download the project
git clone https://github.com/flutter-mcp-server/flutter-mcp-server.git
cd flutter-mcp-server
# Install dependencies
npm install
# Build the project
npm run build
# Test the server (optional)
npm start
MCP Client Configuration
The Flutter MCP Server can be integrated with any MCP-compatible client. Below are specific configuration examples for popular clients:
Claude Desktop
Configuration Location: %APPDATA%\Claude\claude_desktop_config.json
(Windows) or ~/Library/Application Support/Claude/claude_desktop_config.json
(macOS)
{
"mcpServers": {
"flutter-mcp-server": {
"command": "node",
"args": ["C:\\path\\to\\flutter-mcp-server\\dist\\main.js"],
"env": {
"FLUTTER_ROOT": "C:\\flutter",
"ANDROID_HOME": "C:\\Users\\%USERNAME%\\AppData\\Local\\Android\\Sdk"
},
"disabled": false,
"alwaysAllow": []
}
}
}
Windsurf
Configuration Location: Windsurf Settings ā MCP Servers
{
"mcpServers": {
"flutter-toolkit": {
"command": "node",
"args": ["C:\\path\\to\\flutter-mcp-server\\dist\\main.js"],
"env": {
"FLUTTER_ROOT": "C:\\flutter",
"PUB_CACHE": "C:\\Users\\%USERNAME%\\AppData\\Local\\Pub\\Cache"
},
"disabled": false,
"alwaysAllow": ["flutter_system_info", "flutter_devices", "analyze_flutter_project"]
}
}
}
Roo Code
Configuration Location: Roo Code ā Settings ā MCP Configuration
{
"mcpServers": {
"flutter": {
"command": "node",
"args": ["C:\\Users\\%USERNAME%\\AppData\\Roaming\\Roo-Code\\MCP\\flutter-mcp-server\\dist\\main.js"],
"env": {
"FLUTTER_ROOT": "C:\\flutter",
"ANDROID_HOME": "C:\\Users\\%USERNAME%\\AppData\\Local\\Android\\Sdk",
"ANDROID_SDK_ROOT": "C:\\Users\\%USERNAME%\\AppData\\Local\\Android\\Sdk"
},
"disabled": false,
"alwaysAllow": ["flutter_system_info", "flutter_check_installation", "flutter_doctor"]
}
}
}
Cursor AI (VS Code Extension)
Configuration Location: VS Code Settings ā Extensions ā Cursor AI ā MCP Servers
{
"cursor.mcp.servers": {
"flutter-mcp": {
"command": "node",
"args": ["C:\\path\\to\\flutter-mcp-server\\dist\\main.js"],
"env": {
"FLUTTER_ROOT": "C:\\flutter",
"PUB_CACHE": "C:\\Users\\%USERNAME%\\AppData\\Local\\Pub\\Cache"
},
"cwd": "C:\\path\\to\\flutter-mcp-server"
}
}
}
Continue (VS Code Extension)
Configuration Location: .continue/config.json
in your workspace
{
"mcpServers": [
{
"name": "flutter-mcp-server",
"command": "node",
"args": ["C:\\path\\to\\flutter-mcp-server\\dist\\main.js"],
"env": {
"FLUTTER_ROOT": "C:\\flutter",
"ANDROID_HOME": "C:\\Users\\%USERNAME%\\AppData\\Local\\Android\\Sdk"
}
}
]
}
Generic MCP Client Configuration
For any MCP-compatible client, use this template:
{
"name": "flutter-mcp-server",
"command": "node",
"args": ["<PATH_TO_FLUTTER_MCP_SERVER>/dist/main.js"],
"env": {
"FLUTTER_ROOT": "<PATH_TO_FLUTTER_SDK>",
"ANDROID_HOME": "<PATH_TO_ANDROID_SDK>",
"PUB_CACHE": "<PATH_TO_PUB_CACHE>"
}
}
Environment Variables
Configure these environment variables for optimal functionality:
Variable | Description | Example (Windows) | Example (macOS/Linux) |
---|---|---|---|
FLUTTER_ROOT | Flutter SDK installation path | C:\flutter | /usr/local/flutter |
ANDROID_HOME | Android SDK path | C:\Users\%USERNAME%\AppData\Local\Android\Sdk | ~/Android/Sdk |
ANDROID_SDK_ROOT | Alternative Android SDK path | C:\Users\%USERNAME%\AppData\Local\Android\Sdk | ~/Android/Sdk |
PUB_CACHE | Pub package cache directory | C:\Users\%USERNAME%\AppData\Local\Pub\Cache | ~/.pub-cache |
Usage
Tool Examples
Get System Information
{
"tool": "flutter_system_info",
"arguments": {
"forceRefresh": false
}
}
Generate Widget from Description
{
"tool": "generate_widget_from_description",
"arguments": {
"description": "A blue elevated button with white text that says 'Submit' and shows a loading spinner when pressed"
}
}
Create Database Setup
{
"tool": "create_flutter_database",
"arguments": {
"config": {
"type": "sqlite",
"name": "app_database",
"path": "./lib/database/"
}
}
}
Run Batch Analysis
{
"tool": "run_parallel_analysis",
"arguments": {
"projectPaths": ["/path/to/project1", "/path/to/project2"],
"analysisType": "code"
}
}
Architecture
Core Components
- MCP Core: Handles MCP protocol communication
- Tool Manager: Manages tool registration and execution
- System Detector: Gathers Flutter environment information
- UI Tools: Widget generation and analysis capabilities
- Database Tools: Database setup and management
- Analysis Tools: Code analysis, debugging, and generation
- Batch Tools: Parallel and batch execution capabilities
Project Structure
src/
āāā server.ts # Main MCP server implementation
āāā flutter-detector.ts # Flutter system detection
āāā ui-tools.ts # UI and widget tools
āāā database-tools.ts # Database management tools
āāā analysis-tools.ts # Code analysis and generation
āāā batch-tools.ts # Batch and parallel execution
āāā utils/ # Utility functions and helpers
āāā types/ # TypeScript type definitions
āāā index.ts # Type exports and main entry point
Troubleshooting
Common Issues
- "Flutter not found": Ensure
FLUTTER_ROOT
environment variable is set correctly - "Permission denied": Run
chmod +x dist/main.js
on Unix systems - "Module not found": Run
npm install
andnpm run build
- "Port already in use": Check if another MCP server is running
Debug Mode
Run the server in debug mode for detailed logging:
npm run dev
Error Handling
- Graceful degradation when Flutter SDK is not available
- Timeout handling for long-running commands
- Detailed error messages and suggestions
- Fallback mechanisms for different Flutter versions
- Comprehensive input validation for all tools
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
MIT License - see LICENSE file for details.
Support
For issues and questions:
- Check the documentation
- Review existing issues
- Create a new issue with detailed information
Current Status
ā ALL FEATURES IMPLEMENTED AND READY FOR PRODUCTION USE
- ā Core MCP server implementation
- ā Flutter system detection and analysis
- ā Complete UI tools and widget builder
- ā Full database creation and management
- ā Comprehensive debugging and analysis tools
- ā Advanced code generation capabilities
- ā Batch and parallel execution tools
- ā Error handling and logging
- ā Type-safe TypeScript implementation
- ā 40+ fully functional tools available
The Flutter MCP Server is production-ready with all advertised features fully implemented and working.