Flet文档服务器

为Flet 0.28.3提供准确版本特定文档的模型上下文协议服务器。

  • by Pedro77339
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 Pedro77339/flet-mcp-server

使用说明

📚 Flet 0.28.3 MCP服务器

模型上下文协议服务器为Flet 0.28.3提供准确的版本特定文档

🎯 为什么选择MCP?

LLMs经常提供 语法错误 对于Flet 0.28.3:

  • ❌ ft.icons.HOME (0.28.3中不存在)
  • ❌ ft.colors.BLUE (0.28.3中不存在)
  • ❌ dialog.open = True (在0.28.3中不起作用)

此MCP提供 正确的、特定于版本的文档:

  • ✅ 图标为字符串: "home", "settings"
  • ✅ 颜色为十六进制: "#2196F3", "#4CAF50"
  • ✅ 正确的对话框语法: page.open(dialog)

🚀 快速开始

1.安装

git clone https://github.com/Pedro77339/flet-mcp-server.git
cd flet-mcp-server
npm install

2.配置您的MCP客户端

克劳德桌面 (%APPDATA%\Claude\claude_desktop_config.json):

{
  "mcpServers": {
    "flet-docs": {
      "command": "node",
      "args": ["/absolute/path/to/flet-mcp-server/index.js"]
    }
  }
}

光标/风帆/VS代码 (参见 配置_customers.md)

3.重新启动客户端

4.与LLM一起使用

从以下位置复制提示 PROMPT_COPIAR_PEGAR.txt 并将其粘贴到您的法学硕士对话中。


🛠️ 可用工具

工具 说明 示例
get_treeview_info 完整的TreeView文档 “显示TreeView信息”
search_flet_docs(query) 搜索Flet 0.28.3文档 “搜索‘AlertDialog’”

📖 文件化控制

标准控制(17)

AlertDialog、SnackBar、图标、IconButton、TextField、ElevatedButton、TextButton、容器、列、行、ListTile、文本、图像、卡片、标签、分隔符、AppBar

自定义控件(3)

TreeView、TreeViewItem、图标配置


⚠️ 关键跳蚤0.28.3规则

✅ 语法正确

# Icons as strings
ft.Icon("home", color="#2196F3")
ft.IconButton(icon="settings")

# Colors as hex strings
ft.Container(bgcolor="#4CAF50")

# Dialogs with page.open()
dialog = ft.AlertDialog(title=ft.Text("Title"))
page.open(dialog)  # ✅ Correct

# SnackBar with overlay
snackbar = ft.SnackBar(content=ft.Text("Message"))
page.overlay.append(snackbar)
snackbar.open = True
page.update()

❌ 语法不正确

ft.Icon(ft.icons.HOME)        # ❌ Doesn't exist
ft.Container(bgcolor=ft.colors.BLUE)  # ❌ Doesn't exist
dialog.open = True            # ❌ Doesn't work

📁 项目结构

flet-mcp-server/
├── index.js                      # MCP server
├── package.json                  # Dependencies
├── README.md                     # This file
├── LICENSE                       # MIT License
├── PROMPT_COPIAR_PEGAR.txt      # Ready-to-use prompt
├── GUIA_PARA_LLMS.md            # Complete LLM guide
├── CONFIGURACION_CLIENTES.md    # Client configs
├── QUE_COMPARTIR.md             # Sharing guide
└── docs/                         # JSON documentation
    ├── controls_standard.json
    ├── controls_custom.json
    ├── examples.json
    └── icons_colors.json

🎯 使用不同的LLM

克劳德桌面

已经在工作了!只是使用它。

光标

  1. 在中配置 ~/.cursor/mcp.json
  2. 重新加载窗口
  3. 粘贴提示来自 PROMPT_COPIAR_PEGAR.txt

帆板运动

  1. 在中配置 ~/.codeium/windsurf/mcp_config.json
  2. 重新启动Windsurf
  3. Cascade中的粘贴提示

看 配置_customers.md 了解详情。


✅ 验证安装

设置后,询问您的法学硕士:

"Search for 'icon' in Flet documentation"

预期响应:

  • 图标:材质设计图标
  • IconButton:带图标的按钮
  • IconConfig:TreeView的图标配置

如果正确,MCP正在工作! ✅


🐛 故障排除

服务器未启动

# Check Node.js
node --version

# Reinstall dependencies
npm install

LLM中“找不到工具”

  1. 验证JSON配置
  2. 完全重新启动客户端
  3. 检查客户端日志

回答不正确

确保LLM正在使用MCP工具。粘贴提示来自 PROMPT_COPIAR_PEGAR.txt.


📊 统计

  • 工具: 2
  • 资源: 2
  • 文件控制: 20+
  • 代码示例: 20+
  • 尺寸: ~50KB JSON文档

🤝 贡献

在文档中发现错误?想添加更多控件吗?

  1. 在中编辑JSON文件 docs/
  2. 测试用 node index.js
  3. 提交PR

📝 许可证

MIT许可证 -个人和商业用途免费。


🔗 链接

  • 存储库: https://github.com/Pedro77339/flet-mcp-server
  • MCP协议: https://modelcontextprotocol.io/
  • Flet框架: https://flet.dev/

📞 支持

文档:


创建: 2025年11月
版本: 1.0.0
公寓: 0.28.3