Labsco
adamsmaka logo

Flutter MCP

β˜… 72

from adamsmaka

A real-time MCP server providing Flutter/Dart documentation and pub.dev package information to AI assistants, supporting over 50,000 packages on demand.

πŸ”₯πŸ”₯πŸ”₯FreeQuick setup

Flutter MCP: Give Your AI Real-Time Flutter Superpowers πŸš€

A real-time MCP server providing Flutter/Dart documentation and pub.dev package info to AI assistants β€” supports ALL 50,000+ packages on demand.

Stop fighting with hallucinated widgets and deprecated APIs. Flutter MCP connects your AI assistant to real-time documentation, ensuring the Flutter code it generates actually works.

<p align="center"> <a href="https://www.npmjs.com/package/flutter-mcp"><img src="https://img.shields.io/npm/v/flutter-mcp.svg" alt="npm version"></a> <a href="https://www.npmjs.com/package/flutter-mcp"><img src="https://img.shields.io/npm/dm/flutter-mcp.svg" alt="npm downloads"></a> </p> <p align="center"> <img src="https://img.shields.io/badge/Flutter-02569B?style=for-the-badge&logo=flutter&logoColor=white" alt="Flutter"> <img src="https://img.shields.io/badge/Dart-0175C2?style=for-the-badge&logo=dart&logoColor=white" alt="Dart"> <img src="https://img.shields.io/badge/Python-3776AB?style=for-the-badge&logo=python&logoColor=white" alt="Python"> <img src="https://img.shields.io/badge/MCP-Protocol-green?style=for-the-badge" alt="MCP"> </p> <p align="center"> <a href="#-quick-start">Quick Start</a> β€’ <a href="#-demo">Demo</a> β€’ <a href="#-features">Features</a> β€’ <a href="#-how-it-works">How it Works</a> β€’ <a href="#-contributing">Contributing</a> </p>

🎬 Demo

<p align="center"> <img src="https://github.com/flutter-mcp/flutter-mcp/assets/demo.gif" alt="Flutter MCP Demo" width="800"> </p>

See it in action: From npx flutter-mcp to getting real-time Flutter documentation in 20 seconds.

The Problem: Your AI is Stuck in 2021

<table> <tr> <td width="50%" align="center">

😑 Without Flutter MCP

// User: "How do I use Riverpod to watch a future?"

// AI generates (outdated):
final userProvider = FutureProvider((ref) async {
  return fetchUser();
});

// WRONG! Missing autoDispose, family, etc.

Result: Deprecation warnings, confused debugging, time wasted on Google

</td> <td width="50%" align="center">

βœ… 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);
});

// Correct, version-specific, actually works!

Result: Code works immediately, you ship faster

</td> </tr> </table>

πŸ“š Available Tools

🎯 NEW: Simplified Tools (Context7-style)

Flutter MCP now provides just 2 main tools, making it easier for AI assistants to use:

1. flutter_search - Universal Search

Search across Flutter/Dart documentation and pub.dev packages with intelligent ranking.

{
  "tool": "flutter_search",
  "arguments": {
    "query": "state management",
    "limit": 10  // Optional: max results (default: 10)
  }
}

Returns multiple options for the AI to choose from, including Flutter classes, Dart libraries, pub packages, and concepts.

2. flutter_docs - Smart Documentation Fetcher

Get documentation for any Flutter/Dart identifier with automatic type detection.

{
  "tool": "flutter_docs",
  "arguments": {
    "identifier": "Container",              // Auto-detects as Flutter widget
    "topic": "examples",                    // Optional: filter content
    "max_tokens": 10000                     // Optional: limit response size
  }
}

Supports various formats:

  • "Container" - Flutter widget
  • "material.AppBar" - Library-qualified class
  • "provider" - pub.dev package
  • "dart:async.Future" - Dart core library

3. flutter_status - Health Check (Optional)

Monitor service health and cache statistics.

{
  "tool": "flutter_status",
  "arguments": {}
}

πŸ“¦ Legacy Tools (Deprecated but still functional)

The following tools are maintained for backward compatibility but internally use the new simplified tools:

<details> <summary>View legacy tools</summary>

get_flutter_docs (Use flutter_docs instead)

{
  "tool": "get_flutter_docs",
  "arguments": {
    "class_name": "Container",
    "library": "widgets"
  }
}

get_pub_package_info (Use flutter_docs instead)

{
  "tool": "get_pub_package_info",
  "arguments": {
    "package_name": "provider",
    "version": "6.0.5"
  }
}

search_flutter_docs (Use flutter_search instead)

{
  "tool": "search_flutter_docs",
  "arguments": {
    "query": "material.AppBar"
  }
}

process_flutter_mentions (Still functional)

{
  "tool": "process_flutter_mentions",
  "arguments": {
    "text": "I need help with @flutter_mcp riverpod state management"
  }
}

health_check (Use flutter_status instead)

{
  "tool": "health_check",
  "arguments": {}
}
</details>

🎯 Features

  • ✨ NEW: Simplified Tools: Just 2 main tools instead of 5 - following Context7's successful pattern
  • πŸ“¦ Real-Time Documentation: Fetches the latest docs for any pub.dev package on-demand
  • 🎯 Version-Specific Docs: Request exact versions, ranges, or use keywords like latest/stable
  • πŸš€ Zero Configuration: Automatically detects packages from your pubspec.yaml
  • ⚑ Lightning Fast: Intelligent caching means instant responses after first fetch
  • πŸ”’ 100% Private: Runs locally - your code never leaves your machine
  • 🎨 Smart Context: Provides constructors, methods, examples, and migration guides
  • ♾️ Unlimited Packages: Works with all 50,000+ packages on pub.dev
  • πŸ€– AI-Optimized: Token limiting and smart truncation for efficient LLM usage

πŸ’‘ How It Works

Flutter MCP is a local MCP server (think of it as a "RAG sidecar" for Flutter) built on the battle-tested Python MCP SDK. It enhances your AI with real-time documentation:

graph LR
    A[Your Prompt] --> B[AI Assistant]
    B --> C{Flutter/Dart Content?}
    C -->|Yes| D[Query Flutter MCP]
    D --> E[Check Local Cache]
    E -->|Hit| F[Return Cached Docs]
    E -->|Miss| G[Fetch from pub.dev]
    G --> H[Process & Cache]
    H --> F
    F --> I[Enhanced Context]
    I --> J[AI Generates Accurate Code]
    C -->|No| J

The Magic Behind the Scenes

  1. MCP Integration: Your AI assistant automatically detects when you're asking about Flutter/Dart packages
  2. Smart Detection: No special syntax required - just mention package names naturally
  3. Lightning Cache: First request fetches from pub.dev (1-2 seconds), subsequent requests are instant
  4. Context Injection: Documentation is seamlessly added to your AI's knowledge before it responds
  5. Privacy First: Everything runs locally - your code and queries never leave your machine

Performance Notes

  • ⚑ First Query: 1-2 seconds (fetching from pub.dev)
  • πŸš€ Cached Queries: <50ms (from local SQLite cache)
  • πŸ’Ύ Cache Duration: 24 hours for API docs, 12 hours for packages
  • 🧹 Auto-Cleanup: Expired entries cleaned on access

Error Handling

If documentation isn't available or a fetch fails, Flutter MCP gracefully informs your AI, preventing it from generating incorrect or hallucinated code based on missing information. Your AI will let you know it couldn't find the docs rather than guessing.

πŸ“Š What Gets Indexed

When you request a package, Flutter MCP extracts:

  • βœ… API Documentation: Classes, methods, properties with full signatures
  • βœ… Constructors: All parameters, named arguments, defaults
  • βœ… Code Examples: From official docs and README files
  • βœ… Migration Guides: Breaking changes and upgrade paths
  • βœ… Package Metadata: Dependencies, platform support, versions

🀝 Contributing

We love contributions! This is an open-source project and we welcome improvements.

β†’ Read our Contributing Guide

Quick Ways to Contribute

  • πŸ› Report bugs - Open an issue
  • πŸ’‘ Suggest features - Start a discussion
  • πŸ“– Improve docs - Even fixing a typo helps!
  • πŸ§ͺ Add tests - Help us reach 100% coverage
  • 🌐 Add translations - Make Flutter MCP accessible globally
  • ⭐ Star the repo - Help others discover Flutter MCP

πŸš€ What's New & Coming Soon

Recently Released:

  • βœ… Simplified Tools: Reduced from 5 tools to just 2 main tools (Context7-style)
  • βœ… Smart Detection: Auto-detects Flutter widgets, Dart classes, and pub packages
  • βœ… Token Limiting: Default 10,000 tokens with smart truncation
  • βœ… Topic Filtering: Focus on specific sections (examples, constructors, etc.)

On our roadmap:

  • πŸ“š Stack Overflow integration for common Flutter questions
  • 🎯 Natural language activation: "use flutter docs" pattern
  • 🌍 Offline mode for airplane coding
  • πŸš€ Hosted service option for teams

Want to help build these features? Join us!

❀️ Spread the Word

Help other Flutter developers discover AI superpowers:

<p align="center"> <a href="https://twitter.com/intent/tweet?text=Just%20gave%20my%20AI%20assistant%20Flutter%20superpowers%20with%20%40flutter_mcp!%20Real-time%20docs%20for%20any%20pub.dev%20package.%20No%20more%20outdated%20code!%20%23Flutter%20%23AI&url=https://github.com/flutter-mcp/flutter-mcp"> <img src="https://img.shields.io/twitter/url?style=social&url=https%3A%2F%2Fgithub.com%2Fflutter-mcp%2Fflutter-mcp" alt="Tweet"> </a> </p>

Add the badge to your project:

[![Flutter MCP](https://img.shields.io/badge/Enhanced%20by-Flutter%20MCP-blue)](https://github.com/flutter-mcp/flutter-mcp)

πŸ“„ License

MIT Β© 2024 Flutter MCP Contributors

πŸ—οΈ Built With

  • Python MCP SDK - The most popular MCP implementation (14k+ stars)
  • FastMCP - High-level Python framework for MCP servers
  • SQLite - Built-in caching with zero configuration
  • npm/npx - Simple one-line installation and execution
  • BeautifulSoup - Robust HTML parsing
  • httpx - Modern async HTTP client

<p align="center"> <strong>Ready to give your AI Flutter superpowers?</strong> <br><br> <a href="#-quick-start">Get Started</a> β€’ <a href="https://github.com/flutter-mcp/flutter-mcp/issues">Report Bug</a> β€’ <a href="https://github.com/flutter-mcp/flutter-mcp/discussions">Request Feature</a> <br><br> Made with ❀️ by the Flutter community </p>