Flutter MCP Suite:作者分享以編碼智能體協作維護的 5 個 Dart 與 Flutter AI 智能體套件
Orchestrating a 5-Package Dart & Flutter AI Agent Suite (MCP, A2UI 1.0 Express, On-Device LLMs) with Coding Agents
Laszlo Schäffer 分享開源 Flutter MCP Suite,內含 5 個 Dart 與 Flutter 套件,用於建構支援 MCP、A2UI 及本機裝置端模型的 AI 智能體。
I want to share my open-source Flutter MCP Suite — a set of 5 Dart and Flutter packages for building AI agents with Model Context Protocol (MCP), generative UI (A2UI), and local on-device models.
To be honest, I did not write all this code by hand. I designed the structure, guided the work, and maintain the packages using AI coding agents — mainly Antigravity, and now also my own open-source tool TealKit Coder, which is built on top of dart_mcp_core.
Using the packages every day inside a real coding agent helped find many real bugs quickly — like context compression loops, local model template errors, and Android file-saving issues — so we could fix them and add tests right away.
1. Pure Dart Core (dart_mcp_core)
The base package is dart_mcp_core. It is pure Dart with no Flutter dependencies (160/160 pub.dev points, 99+ unit tests).
Because it does not depend on Flutter, the same agent engine works everywhere:
- Pure Dart CLI tools and backend apps (like TealKit Coder)
- Flutter Desktop (Windows, macOS, Linux) with local
stdioMCP servers (npx,uvx) - Flutter Mobile (Android, iOS) and Web with remote HTTP/SSE MCP servers and local Dart tools
Main Features
- 7 LLM Providers with one API: OpenAI, Anthropic Claude, Google Gemini, Ollama, Mistral, OpenAI-compatible servers (like DeepInfra or vLLM), and local on-device models.
-
Automatic Context Compression: When a long chat or tool session gets too big,
ContextCompressorsummarizes older messages and saves them inEpisodicMemoryStore. The model can still look up old details with theretrieve_memorytool. -
On-Demand Tool Discovery: Instead of sending all tool definitions on every message,
McpListToolsToolandMcpCallToolToollet the model search and call tools only when needed. -
Safety & Approvals:
ToolLoopGuardstops repeated tool loops, andAgentHooklets you ask the user before running a tool. -
Image Generation Tool: Built-in
GenerateImageToolsupporting OpenAI, Gemini, DeepInfra (FLUX), or a custom handler.
2. Dynamic Flutter UI with flutter_a2ui_mcp and A2UI 1.0 Express
With flutter_a2ui_mcp (using a2ui_flutter ^0.5.0 and a2ui_core ^0.9.0), the AI can show interactive Flutter widgets directly inside the chat instead of only plain text.
In v1.2.1, it uses A2UI 1.0 Express by default:
<a2ui>
surface("weather_vienna")
root = WeatherCard(city="Vienna", temp=18)
</a2ui>
Express uses about half as many tokens as raw JSON, checks the output against your widget catalog, and still falls back to normal JSON if a smaller model outputs JSON instead.
3. Offline Local Models with flutter_ui_mcp_embedded
If you want to run models offline on Android, iOS, or Desktop, flutter_ui_mcp_embedded connects llamadart (^0.21.0) to dart_mcp_core. It supports both GGUF (llama.cpp) and LiteRT-LM (.litertlm) models, and includes a HuggingFace model search dialog.
Links
- GitHub (with 20+ Flutter & A2UI examples + CI): https://github.com/lschaffer/flutter_mcp_suite
- Pure Dart core: https://pub.dev/packages/dart_mcp_core
- Flutter chat UI: https://pub.dev/packages/flutter_ui_mcp
- A2UI generative UI: https://pub.dev/packages/flutter_a2ui_mcp
- On-device LLM plugin: https://pub.dev/packages/flutter_ui_mcp_embedded
If you try it out or have any feedback, feel free to leave a comment or open an issue on GitHub!
來源:DEV Community · dev.to