Flutter MCP Server
Flutter MCP servers enable AI models to interact with Flutter projects, providing capabilities for code analysis, formatting, testing, and documentation retrieval.
Overview
The Flutter MCP Server is an open-source implementation of the Model Context Protocol (MCP) for the Dart and Flutter ecosystem. It acts as a bridge between AI assistants, developer tools, and automated workflows, enabling secure, programmable, and context-aware automation of Dart and Flutter development tasks. It provides AI agents with real-time Flutter/Dart documentation and pub.dev package information, helping to generate accurate and up-to-date Flutter code.
Key Features
Real-time Documentation
Provides up-to-date Flutter/Dart documentation and pub.dev package info to AI assistants.
SDK Tool Exposure
Exposes Dart & Flutter SDK tools (analyze, format, fix, create, run, test) as programmable endpoints.
Automated Workflows
Enables AI-driven workflows, automation, and remote development for Dart/Flutter projects.
Docker Support
Easily build and run in a containerized environment for reproducibility and security.
Available Tools
Quick Reference
| Tool | Purpose | Category |
|---|---|---|
analyze | Analyze Dart/Flutter code | Code Analysis |
format | Format Dart/Flutter code | Code Formatting |
fix | Apply automated fixes to Dart/Flutter code | Code Refactoring |
create | Create new Flutter projects | Project Management |
run | Run Flutter applications | Application Execution |
test | Run tests for Flutter projects | Testing |
get_app_errors | Retrieves precise and condensed error information from your Flutter app | Error Monitoring |
view_screenshot | Captures screenshots of the running application | Debugging |
get_view_details | Get details about views in the app (size, pixel ratio) | UI Inspection |
Detailed Usage
analyze▶
Analyzes Dart and Flutter code for potential issues and best practices.
use_mcp_tool({
server_name: "flutter",
tool_name: "analyze",
arguments: {
path: "./lib/main.dart"
}
});
format▶
Formats Dart and Flutter code according to style guidelines.
use_mcp_tool({
server_name: "flutter",
tool_name: "format",
arguments: {
path: "./lib/main.dart"
}
});
fix▶
Applies automated fixes to Dart and Flutter code.
use_mcp_tool({
server_name: "flutter",
tool_name: "fix",
arguments: {
path: "./lib/main.dart"
}
});
create▶
Creates a new Flutter project.
use_mcp_tool({
server_name: "flutter",
tool_name: "create",
arguments: {
projectName: "my_new_app"
}
});
run▶
Runs a Flutter application on a connected device or emulator.
use_mcp_tool({
server_name: "flutter",
tool_name: "run",
arguments: {
deviceId: "emulator-5554"
}
});
test▶
Runs tests for a Flutter project.
use_mcp_tool({
server_name: "flutter",
tool_name: "test",
arguments: {
path: "./test/widget_test.dart"
}
});
get_app_errors▶
Retrieves precise and condensed error information from your Flutter app.
use_mcp_tool({
server_name: "flutter",
tool_name: "get_app_errors",
arguments: {}
});
view_screenshot▶
Captures screenshots of the running application.
use_mcp_tool({
server_name: "flutter",
tool_name: "view_screenshot",
arguments: {
outputPath: "/tmp/screenshot.png"
}
});
get_view_details▶
Get details about views in the app (size, pixel ratio).
use_mcp_tool({
server_name: "flutter",
tool_name: "get_view_details",
arguments: {}
});
Installation
{
"mcpServers": {
"flutter-docs": {
"command": "npx",
"args": [
"flutter-mcp"
]
}
}
}
Common Use Cases
1. AI-powered Code Generation
Enable AI to generate correct and up-to-date Flutter code by providing real-time documentation.
// Example of AI generating Riverpod code with Flutter MCP
// User: "How do I use @flutter_mcp riverpod:^2.5.0 to watch a future?"
// AI generates (using v2.5.1 docs):
// final userProvider = FutureProvider.autoDispose
// .family<User, String>((ref, userId) async {
// return ref.watch(apiProvider).fetchUser(userId);
// });
2. Automated Code Review and Refactoring
Automate code analysis, formatting, and application of fixes using AI agents.
use_mcp_tool({
server_name: "flutter",
tool_name: "analyze",
arguments: {
path: "./lib/my_feature.dart"
}
});
use_mcp_tool({
server_name: "flutter",
tool_name: "fix",
arguments: {
path: "./lib/my_feature.dart"
}
});
3. CI/CD Integration
Integrate Flutter MCP into CI/CD pipelines for automated testing and code quality checks.
use_mcp_tool({
server_name: "flutter",
tool_name: "test",
arguments: {
path: "./test/"
}
});
Connection String Format
The Flutter MCP server primarily uses command-line arguments for configuration. For HTTP transport, you can specify the port.
- HTTP Transport:
npx flutter-mcp --transport http --port 8000
Sources
Related Articles
Accessibility Scanner MCP Server
Accessibility Scanner MCP servers enable AI models to perform WCAG compliance checks, capture annotated screenshots, and generate detailed accessibility reports.
Development Tools & DevOps MCP Servers
Streamline your development workflow with our Development Tools & DevOps integrations. Connect with version control systems, CI/CD pipelines, container platforms, and more to build, test, and deploy your AI applications faster and more reliably.
Tasks Organizer MCP Server
A local Model Context Protocol (MCP) server providing backend tools for client-driven project and task management using a SQLite database.