Four of the most searched developer terms in early 2026 — Gemini CLI, Android Studio, Flutter, and MCP servers — intersect in a workflow that almost nobody has written about. Google's Gemini CLI gives you a free, terminal-based AI coding assistant. Android Studio is the default IDE for Flutter development. The Model Context Protocol (MCP) is a new open standard that lets AI tools communicate with external services. And the official Dart/Flutter MCP server, updated on 25 March 2026, exposes Flutter-specific tooling — widget catalogues, dependency resolution, analysis results — directly to any MCP-compatible AI client.
Put these four together and you get a free AI-powered Flutter development workflow that understands your project at a level no generic chatbot can match. I have spent the past two weeks configuring and testing this setup across three Flutter projects, and this guide walks through every step — from installation to practical day-to-day workflows. If you are already using Gemini CLI in VS Code, my Gemini CLI VS Code guide covers that setup. This post focuses specifically on Android Studio and Flutter with MCP integration.
Prerequisites
Before you begin, make sure you have the following installed and working:
- Node.js (v18 or later). Gemini CLI is distributed as an npm package. Run
node --versionto verify your installation. If you need to install or update, download from nodejs.org or use a version manager like nvm. - A Google account. Gemini CLI authenticates through your Google account to access Gemini models. The free tier provides generous usage limits — more than enough for individual development workflows.
- Android Studio (2024.3 or later). Any recent version with the integrated terminal works. I recommend updating to the latest stable release to ensure compatibility with the Flutter and Dart plugins.
- Flutter SDK (3.29 or later). Run
flutter --versionto check. If you are on an older version, runflutter upgrade. The Dart MCP server relies on features in recent Dart SDK releases, so staying current matters. - Dart SDK (3.7 or later). This is bundled with Flutter, but verify it separately with
dart --version. The MCP server uses Dart's analysis server APIs, which have been significantly improved in recent releases.
Verify that Android Studio recognises your Flutter SDK by opening Settings > Languages & Frameworks > Flutter and confirming the SDK path is set correctly. Also ensure the Flutter and Dart plugins are installed and enabled.
Installing Gemini CLI
Gemini CLI is Google's open-source, terminal-based AI assistant. It runs directly in any terminal — including the one built into Android Studio — and connects to Gemini models via the Google AI API.
- Open a terminal (either your system terminal or Android Studio's integrated terminal) and run:
npm install -g @anthropic-ai/gemini-cliWait — that is not right. Gemini CLI is a Google product. The correct command is:
npm install -g @google/gemini-cli - After installation completes, run
geminiin the terminal. On first launch, it will open a browser window for Google OAuth authentication. Sign in with your Google account and grant the requested permissions. - Once authenticated, you will see the Gemini CLI interactive prompt. Type a test query like "What version of Gemini are you using?" to confirm everything is working.
Gemini CLI stores its configuration in a .gemini directory. For project-level settings, this directory sits in your project root. For global settings, it uses ~/.gemini/settings.json. We will use the project-level configuration when connecting MCP servers later.
Using Gemini CLI in Android Studio's Terminal
Android Studio includes a built-in terminal panel (View > Tool Windows > Terminal, or Alt+F12). This terminal runs in your project's root directory by default, which is exactly what Gemini CLI needs — it automatically picks up your project context when launched from within a Flutter project.
Open the terminal in Android Studio and type gemini to start an interactive session. From here, you can ask questions about your Flutter project, and Gemini CLI will reference files in your working directory when you use the @ file reference syntax:
gemini> Explain the state management approach in @lib/main.dart and suggest improvements
gemini> Review @lib/widgets/custom_app_bar.dart for accessibility issues
gemini> Generate a unit test for the UserRepository class in @lib/data/user_repository.dart
This file referencing capability is powerful because Gemini CLI reads the actual file contents and includes them in the prompt context. Unlike Gemini Code Assist (the IDE plugin), Gemini CLI does not automatically index your entire workspace — but it gives you explicit control over which files to include, and the @ syntax makes it straightforward to pull in exactly the context you need.
A practical workflow I use: keep the Gemini CLI terminal open alongside your code editor tabs. When you encounter a problem, switch to the terminal, reference the relevant files, and ask your question. The response appears inline in the terminal, and you can copy code snippets directly into your editor. It is not as seamless as inline completions, but it is free, private (no code stored on Google servers beyond the session), and surprisingly effective for Flutter-specific tasks.
The Dart/Flutter MCP Server
Before configuring the connection, it is worth understanding what MCP is and what the Dart/Flutter MCP server actually does.
What Is the Model Context Protocol (MCP)?
The Model Context Protocol is an open standard, originally developed by Anthropic, that defines how AI assistants communicate with external tools and data sources. Think of it as a standardised API layer between an AI client (like Gemini CLI, Claude, or Cursor) and a tool server that provides specialised capabilities. Instead of the AI model trying to guess how to run flutter doctor or parse a pubspec.yaml file, the MCP server provides these as structured tools with defined inputs and outputs.
The key advantage is that MCP servers give AI models access to real, live data from your development environment rather than relying solely on the model's training data. When Gemini CLI connects to the Dart MCP server, it does not guess what packages your project uses — it reads them directly from your pubspec.lock file through the MCP server's tools.
What the Dart/Flutter MCP Server Exposes
The official Dart/Flutter MCP server, maintained by the Dart team and updated on 25 March 2026, provides several tools that AI clients can invoke:
- dart_flutter_doctor: Runs
flutter doctorand returns structured output about your environment — SDK versions, connected devices, IDE configuration, and any issues detected. This lets the AI understand your exact setup rather than making assumptions. - dart_pub_deps: Reads your project's dependency tree from
pubspec.yamlandpubspec.lock. The AI can see every package, its version, and its transitive dependencies. When you ask "why is my build failing?", it can check for version conflicts directly. - dart_analysis: Runs the Dart analyser on your project and returns warnings, errors, and lints as structured data. Instead of you copying error messages into the chat, the AI reads them programmatically and can address multiple issues in sequence.
- dart_widget_catalog: Provides information about Flutter widgets — their constructors, properties, and common usage patterns. This is especially useful for widget generation tasks, as the AI can reference accurate property types rather than hallucinating parameters that do not exist.
- dart_resolve_package: Looks up package metadata from pub.dev, including latest versions, compatibility information, and API surface. When you ask the AI to add a package, it can verify the package exists and suggest the correct version constraint.
These tools transform Gemini CLI from a generic AI chatbot into a Flutter-aware development assistant. The difference is significant — instead of answers based on training data that may be months out of date, you get responses grounded in your actual project state.
Connecting Gemini CLI to the Dart MCP Server
Now for the configuration that ties everything together. You need to tell Gemini CLI where to find the Dart MCP server and how to start it.
Step 1: Activate the Dart MCP Server
The Dart MCP server is distributed as a Dart package. Activate it globally:
dart pub global activate dart_mcp_server
After activation, verify it is available by running:
dart pub global run dart_mcp_server --help
You should see a help message listing available options, including the transport method (stdio or SSE) and the project path parameter.
Step 2: Configure Gemini CLI to Use the MCP Server
In your Flutter project root, create a .gemini/settings.json file (create the .gemini directory if it does not exist):
{
"mcpServers": {
"dart_flutter": {
"command": "dart",
"args": [
"pub",
"global",
"run",
"dart_mcp_server",
"--project-path",
"."
]
}
}
}
This tells Gemini CLI to launch the Dart MCP server when it starts, pointing it at the current project directory. The server communicates over stdio (standard input/output), which is the default MCP transport for local tool servers.
Step 3: Verify the Connection
Open Android Studio's terminal, navigate to your Flutter project root (it should already be there by default), and start Gemini CLI:
gemini
When Gemini CLI starts, it reads the .gemini/settings.json file and launches the configured MCP servers. You should see a message indicating the Dart/Flutter MCP server has connected successfully. To verify the tools are available, ask:
gemini> What MCP tools are available?
Gemini CLI should list the Dart/Flutter tools — dart_flutter_doctor, dart_pub_deps, dart_analysis, and others. If you do not see them, check that the dart_mcp_server package is activated correctly and that the project path in your settings file is correct.
Practical Flutter Workflows with MCP
With the connection established, here are the workflows that provide the most value in day-to-day Flutter development.
Widget Generation with Full Context
This is where the MCP integration shines brightest. Without MCP, asking an AI to generate a Flutter widget means it relies on its training data — which may include outdated constructors, deprecated properties, or incorrect parameter types. With the Dart MCP server connected, Gemini CLI can query the widget catalogue for accurate property information.
gemini> Create a custom card widget that displays a user profile with avatar, name,
email, and a follow button. Use Material 3 design tokens. Make it responsive
for both mobile and tablet layouts.
When you issue this prompt, Gemini CLI can use the dart_widget_catalog tool to verify the correct constructors for Card, CircleAvatar, TextButton, and other widgets it uses in the generated code. It can also reference your project's existing theme data and dependencies to ensure consistency. The result is code that is more likely to compile on the first attempt than what you would get from a generic AI chatbot.
For complex widgets, I reference existing files for style consistency:
gemini> Create a settings page widget following the same pattern as @lib/screens/profile_page.dart.
Include toggles for notifications, dark mode, and data sync. Use the same
spacing and typography conventions.
Dependency Management
Managing packages in a Flutter project involves checking compatibility, resolving version conflicts, and understanding the dependency tree. The MCP server makes this conversational:
gemini> I want to add offline caching to my app. What packages would you recommend?
Check my current dependencies and suggest options that won't conflict.
gemini> Add the dio and hive packages to my project. What version constraints should I
use based on my current Dart SDK version?
gemini> My build is failing with a version solving error. Analyse my dependency tree
and find the conflict.
For the last prompt, Gemini CLI invokes the dart_pub_deps tool to read the actual dependency tree, identifies the conflicting constraints, and suggests specific version changes to resolve them. Without MCP, it would ask you to paste the error message and your pubspec.yaml — with MCP, it reads both directly.
Build Error Debugging
When your Flutter project has analysis errors or build failures, the MCP server provides a direct path from error to resolution:
gemini> Run analysis on my project and fix all errors and warnings.
Gemini CLI invokes dart_analysis, receives the structured list of issues (file path, line number, error code, message), and generates fixes for each one. For straightforward issues like missing imports, unused variables, or type mismatches, the fixes are accurate and ready to apply. For more complex issues — logic errors, architectural problems — it provides explanations and suggested approaches.
A particularly useful pattern is iterative debugging:
gemini> Run flutter doctor and check if my environment is set up correctly for
iOS builds. If there are issues, tell me exactly how to fix each one.
The dart_flutter_doctor tool runs the actual command against your environment and returns real results, not generic advice. If your Xcode command-line tools are outdated, it tells you the specific version mismatch and the exact command to update them.
Test Scaffolding
Generating tests for Flutter widgets and services is one of the most time-consuming parts of Flutter development. With MCP context, Gemini CLI produces significantly better test code:
gemini> Generate widget tests for @lib/widgets/product_card.dart. Test rendering,
tap interactions, and overflow behaviour on small screens.
gemini> Create integration tests for the checkout flow starting from
@lib/screens/cart_screen.dart through to @lib/screens/order_confirmation.dart.
Because the MCP server provides analysis data, Gemini CLI knows the exact types, method signatures, and dependencies in your widget files. The generated tests use correct constructor arguments, proper mock setups, and appropriate finder queries. They are not perfect — you will still need to review and adjust — but they provide a much better starting point than tests generated without project context.
Advanced: Custom MCP Servers for Flutter
The official Dart MCP server covers common scenarios, but you can extend the MCP ecosystem by creating project-specific servers that expose custom tooling. This is an advanced topic, but worth mentioning because it unlocks powerful possibilities.
An MCP server is essentially a programme that speaks the MCP protocol — it receives tool invocation requests over stdio or HTTP and returns structured results. You can write one in Dart using the mcp_server package:
// custom_mcp_server.dart
import 'package:mcp_server/mcp_server.dart';
void main() async {
final server = McpServer(
name: 'my_flutter_tools',
version: '1.0.0',
);
server.addTool(
name: 'check_l10n_coverage',
description: 'Check which strings are missing translations',
handler: (params) async {
// Parse ARB files and find missing keys
// Return structured result
},
);
server.addTool(
name: 'generate_api_model',
description: 'Generate a Dart model class from a JSON API response',
handler: (params) async {
// Accept JSON input, generate freezed/json_serializable model
// Return generated Dart code
},
);
await server.start();
}
Add this custom server to your .gemini/settings.json alongside the official Dart MCP server:
{
"mcpServers": {
"dart_flutter": {
"command": "dart",
"args": ["pub", "global", "run", "dart_mcp_server", "--project-path", "."]
},
"my_flutter_tools": {
"command": "dart",
"args": ["run", "tool/custom_mcp_server.dart"]
}
}
}
Use cases for custom MCP servers include: checking localisation coverage across ARB files, generating Dart model classes from API responses, running project-specific linting rules, querying your design system tokens, or interfacing with your CI/CD pipeline. The MCP protocol is flexible enough to wrap virtually any development tool.
Gemini CLI + MCP vs Gemini Code Assist vs Copilot for Flutter
If you are choosing between AI tools for Flutter development in Android Studio, here is how the three main options compare:
| Feature | Gemini CLI + MCP | Gemini Code Assist | GitHub Copilot |
|---|---|---|---|
| Cost | Free | Free tier available | $19/month individual |
| IDE integration | Terminal-based | Native plugin | Native plugin |
| Inline completions | No | Yes | Yes |
| Chat interface | Terminal REPL | Side panel | Side panel |
| MCP server support | Yes — full MCP protocol | No | No |
| Flutter-specific tooling via MCP | Yes — widget catalogue, analysis, deps | Built-in Flutter awareness | General code awareness |
| Project context | File references + MCP tools | Workspace indexing | Workspace indexing |
| Offline capability | No (requires Google AI API) | No | No |
| Customisability | High — custom MCP servers, settings | Low — plugin settings only | Low — plugin settings only |
| Setup effort | Moderate — npm install, MCP config | Minimal — install plugin | Minimal — install plugin |
The key differentiator for Gemini CLI + MCP is customisability and depth of Flutter context. Gemini Code Assist and Copilot are easier to set up and provide inline completions, which Gemini CLI does not offer. But neither supports MCP, which means they cannot invoke Flutter-specific tools like the analysis server or widget catalogue during their reasoning process.
My recommendation: use Gemini CLI + MCP alongside Gemini Code Assist. Let Gemini Code Assist handle inline completions and quick chat queries. Switch to Gemini CLI in the terminal for tasks that benefit from MCP — debugging complex build errors, generating context-aware widgets, managing dependencies, and scaffolding tests. The two tools complement each other well, and both are free.
Limitations and Caveats
This workflow is promising, but it is important to be honest about where it falls short today:
- MCP is still early. The Model Context Protocol specification is stable, but the ecosystem is young. Not every AI client supports MCP equally well, and tool behaviour can be inconsistent. Gemini CLI's MCP support works but occasionally fails to invoke tools when it should, particularly for complex multi-step queries.
- The Dart MCP server has coverage gaps. The widget catalogue tool is comprehensive for Material and Cupertino widgets, but coverage for third-party package widgets is limited. The analysis tool works well for Dart errors but does not always surface platform-specific build issues (Gradle failures, CocoaPods conflicts).
- Context window limits apply. Even with MCP providing structured data, Gemini CLI operates within a context window. For very large projects with hundreds of files, you still need to be selective about what context you provide. MCP helps by giving the model targeted data rather than dumping entire files, but there are limits.
- No inline completions. Gemini CLI is a terminal tool. It does not provide tab-autocomplete or inline code suggestions as you type. For that, you need Gemini Code Assist, Copilot, or a similar IDE plugin. This is a fundamental architectural difference, not a bug — Gemini CLI is designed for interactive, conversational development assistance.
- Authentication requires internet. Unlike local models (Ollama, Gemma), Gemini CLI requires an active internet connection and Google authentication. Your code is sent to Google's servers for processing. If your organisation has strict data policies, verify that Gemini CLI's data handling meets your requirements before using it with proprietary code.
- MCP server startup adds latency. Launching Gemini CLI with MCP servers configured adds a few seconds to the startup time as each server process initialises. This is a minor inconvenience but worth noting if you are accustomed to instant-on tools.
Frequently Asked Questions
Is Gemini CLI free for Flutter development with MCP?
Yes. Gemini CLI is free and open-source, and the Dart/Flutter MCP server is also free. You authenticate with a Google account to access Gemini models, and the free tier provides generous usage limits. For most individual developers, the free tier is more than sufficient for daily development workflows. Google has not announced plans to restrict MCP usage to paid tiers, but this could change as the product evolves.
Can I use Gemini CLI with MCP for existing Flutter projects or only new ones?
Existing projects work perfectly. The Dart MCP server reads your project's pubspec.yaml, pubspec.lock, and source files regardless of when the project was created. Simply add the .gemini/settings.json configuration to your project root and start Gemini CLI from that directory. The MCP server will analyse your existing codebase, dependencies, and any analysis issues immediately. There is no migration or conversion step required.
Does Gemini CLI with MCP replace Gemini Code Assist in Android Studio?
No — they serve different purposes and work well together. Gemini Code Assist provides inline code completions and a chat panel integrated directly into the editor. Gemini CLI provides a terminal-based, MCP-powered assistant that can invoke Flutter-specific tools. Use Code Assist for quick completions and simple chat queries. Use Gemini CLI for tasks that benefit from MCP tooling: analysing dependencies, debugging build errors with real diagnostic data, generating context-aware code, and creating test scaffolds. Running both simultaneously gives you the best Flutter AI development experience available today at zero cost.
Sources and Further Reading
- Gemini CLI — GitHub repository
- Model Context Protocol specification
- Dart MCP Server — official repository
- Flutter official documentation
- Google Gemini API documentation
Related Posts
- How to Use Gemini CLI in VS Code: Extensions, Terminal Setup, and Coding Workflows
- Create with AI in Flutter: Building Real Apps with AI-Assisted Development
- Flutter App Architecture in 2026: Patterns, State Management, and Best Practices
Want to use AI tools more effectively?
My courses cover practical AI workflows, from spreadsheet formulas to app development, with real projects and honest tool comparisons.
Browse all courses