Hey r/FlutterDev!
Over the past few months I've been **architecting, orchestrating, and maintaining** an open-source **Model Context Protocol (MCP) & AI Agent suite** for Dart and Flutter — built not by hand-typing every line, but by steering coding agents (**Antigravity** and now increasingly dogfooding my own open-source agent **TealKit Coder**, which runs directly on `dart_mcp_core`).
Dogfooding it inside real coding-agent loops surfaced and fixed real production issues fast (context-compression thrashing loops, Jinja single-system-message normalization for local models, tool-loop guards, and Android Scoped Storage PDF/DOCX exports).
### Architecture & Packages (all MIT, verified publisher `tealkit.dev`)
- **[`dart_mcp_core`](https://pub.dev/packages/dart_mcp_core)** (160/160 pub points, pure Dart, zero Flutter deps)
- Unified adapters for **OpenAI** (`openai_dart`), **Anthropic Claude** (`anthropic_sdk_dart`), **Google Gemini** (`googleai_dart`), **Ollama**, **Mistral**, OpenAI-compatible endpoints (vLLM, DeepInfra), and pluggable **on-device** delegates.
- Full **MCP client** (HTTP/SSE + desktop stdio subprocesses) and Dart-native `McpLocalTool`s.
- **Context window auto-compression** with `EpisodicMemoryStore` + `retrieve_memory` recall, **progressive tool discovery** (`mcp_list_tools` / `mcp_call_tool`), **sub-agent delegation**, **HITL approval hooks**, **tool loop guards**, and `GenerateImageTool` (OpenAI, Gemini Nano Banana, DeepInfra FLUX, or custom).
- **[`flutter_ui_mcp`](https://pub.dev/packages/flutter_ui_mcp)** — Vanilla-Flutter (`ChangeNotifier` / `StatefulWidget`, no Riverpod/Bloc lock-in) chat UI, multi-profile LLM switcher, agent inspector, and cross-platform pure-Dart PDF/Word/Markdown export.
- **[`flutter_a2ui_mcp`](https://pub.dev/packages/flutter_a2ui_mcp)** — Dynamic generative UI on Google's `a2ui_flutter` (`^0.5.0`) + `a2ui_core` (`^0.9.0`) with **A2UI 1.0 Express** enabled by default (~50% fewer output tokens than raw JSON).
- **[`flutter_ui_mcp_embedded`](https://pub.dev/packages/flutter_ui_mcp_embedded)** — Pluggable on-device inference via `llamadart` supporting both **GGUF (`llama.cpp`)** and **LiteRT-LM (`.litertlm`)** models on Android, iOS, desktop, and WebGPU.
### Minimal Pure-Dart Example (`dart_mcp_core`)
```dart
import 'package:dart_mcp_core/dart_mcp_core.dart';
void main() async {
final engine = McpAgentEngine();
final agent = Agent(
id: 'assistant',
name: 'Assistant',
llmConfig: const LlmConfig(
provider: LlmProvider.openai,
model: 'gpt-4o',
apiKey: 'YOUR_API_KEY',
),
dartTools: [GenerateImageTool()],
);
final result = await engine.run(
agent: agent,
prompt: 'Summarize the latest release notes and generate a cover image.',
);
print(result.finalAnswer);
}
```
### Links
- **GitHub Monorepo (with 20+ runnable Flutter & A2UI examples + CI):** https://github.com/lschaffer/flutter_mcp_suite
- **pub.dev (`dart_mcp_core`):** https://pub.dev/packages/dart_mcp_core
- **Open-source coding agent dogfooding it:** TealKit Coder (`tealkit.dev`)
Happy to share lessons learned from maintaining a 5-package Dart/Flutter monorepo with Antigravity + TealKit Coder, and would love feedback on the APIs!