
一个完整的本地模型上下文协议(MCP)服务器,纯Dart编写,用于自动化、审计和优化Flutter项目资产和本地化结构。
概览
一个完整的本地模型上下文协议(MCP)服务器,纯Dart编写,用于自动化、审计和优化Flutter项目资产及本地化结构。将其连接到像Cursor或Claude Desktop这样的AI客户端,让AI直接与你的项目资产和翻译结构交互。 AssetGenie 向大型语言模型(LLM)提供了五个强大的工具: 扫描项目的 pubspec.yaml 和物理文件夹以识别资产异常:- 标记 pubspec.yaml 中声明的缺失物理文件。- 标记未声明于 pubspec.yaml 的物理资产(未声明资产)。- 识别超出可配置文件大小阈值(默认:500 KB)的重资产。- 通过搜索 lib/源代码中的引用,自动检查未使用的物理文件。 安全地更新或注入翻译密钥到本地应用资源包(.arb)文件中:- 无需手动复制粘贴即可附加新的翻译。
概述(AI 翻译)
一个完整的本地模型上下文协议(MCP)服务器,纯Dart编写,用于自动化、审计和优化Flutter项目资产及本地化结构。将其连接到像Cursor或Claude Desktop这样的AI客户端,让AI直接与你的项目资产和翻译结构交互。
🚀 特色
AssetGenie 向大型语言模型(LLM)提供了五个强大的工具:
1.assetgenie_audit_health
扫描项目的pubspec.yaml和实体文件夹以识别资产异常:
- 在
pubspec.yaml中声明的缺失物理文件的标志。 - 标记未在
pubspec.yaml(未申报资产)中申报的实物资产。 - 识别超过可配置文件大小阈值(默认:500 KB)的重资产。
- 通过搜索
lib/源代码中的引用,自动检查未使用的物理文件。
2.assetgenie_sync_localization
安全地更新或注入转换密钥到本地应用资源包(.arb)文件中:
- 无需手动复制粘贴即可附加新译文。
- 标准化格式化,并将元数据键(
@key)与其各自属性分组。 - 按照标准ARB指南按按字母顺序排列密钥。
3.
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
AssetGenie 🧞♂️
A complete, local Model Context Protocol (MCP) server written in pure Dart to automate, audit, and optimize Flutter project assets and localization structure. Connect it to AI clients like Cursor or Claude Desktop to let the AI interact directly with your project’s assets and translation structures.
🚀 Features
AssetGenie exposes five powerful tools to the LLM context:
1. assetgenie_audit_health
Scans the project’s pubspec.yaml and physical folders to identify asset anomalies:
- Flags missing physical files declared in
pubspec.yaml. - Flags physical assets that are not declared in
pubspec.yaml(undeclared assets). - Identifies heavy assets exceeding a configurable file size threshold (default: 500 KB).
- Automatically checks for unused physical files by searching for references in
lib/source code.
2. assetgenie_sync_localization
Safely updates or injects translation keys into local Application Resource Bundle (.arb) files:
- Appends new translations without manual copying/pasting.
- Standardizes formatting and groups metadata keys (
@key) next to their respective properties. - Alphabetizes keys according to standard ARB guidelines.
3. assetgenie_generate_constants
Auto-generates clean, modern Dart constants from physical asset files:
- Recursively walks through the physical assets folders.
- Converts file paths into structured
camelCasevariable names. - Resolves identifier collisions and reserved keywords dynamically.
- Writes a safe config class
Assetsinsidelib/generated/to prevent typos and hardcoded string values.
4. assetgenie_audit_localization
Audits the project’s ARB localization files to ensure quality and consistency:
- Compares target locales against a primary locale to find missing translation keys.
- Detects extra translation keys defined in target locales but missing in the primary locale.
- Validates that parameterized placeholders (e.g.,
{name}) match between translations to prevent runtime formatting crashes. - Scans Dart code recursively in
lib/to identify unused translation keys.
5. assetgenie_app_harness
Connects to a running Flutter application via its Dart VM Service to inspect layout, capture state, or stream logs:
- Retrieves a clean, structured JSON Widget Summary Tree from the active application context.
- Requests a live PNG screenshot of the application’s current layout, returning it directly in the tool response.
- Streams and captures stdout/stderr console prints and runtime logging statements over WebSocket.
🛠️ Installation & Setup
Ensure you have Dart SDK installed on your system.
-
Clone the repository:
git clone https://github.com/aditzeb/AssetGenie.git cd AssetGenie -
Download package dependencies:
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →配置
{
"mcpServers": {
"assetgenie": {
"command": "dart",
"args": [
"run",
"C:\\path\\to\\AssetGenie\\bin\\main.dart"
]
}
}
}