Release v0.4.0
This commit is contained in:
+28
-16
@@ -65,16 +65,17 @@ Funplay > MCP Server
|
||||
|
||||
服务默认运行在 `http://127.0.0.1:8765/`。
|
||||
|
||||
如果配置端口已被占用,扩展会自动回退到下一个可用本地端口,并在一键客户端配置时使用实际运行端口。
|
||||
如果配置端口已被占用,扩展会先检查已有 listener 是否属于同一个 Cocos 项目;同项目 listener 会被安全复用,无关 listener 才会自动回退到下一个可用本地端口。
|
||||
|
||||
面板刻意保持精简:
|
||||
|
||||
- 启用或停用 MCP Server
|
||||
- 修改服务端口
|
||||
- 在 `core` / `full` / `custom` 工具暴露模式之间切换
|
||||
- 保存、套用、导入和导出命名工具 profile
|
||||
- 检查当前安装版本是否落后于 GitHub 最新 Release
|
||||
- 查看最近工具调用和运行日志预览
|
||||
- 按工具分类或单个工具调整暴露范围
|
||||
- 通过分类控制或单个工具名调整暴露范围
|
||||
- 一键配置 AI 客户端,并随目标客户端预览对应配置
|
||||
- 复制 `/health` 和 `/tools` 的快速 `curl` 排障命令
|
||||
- 需要时再展开 Debug Output
|
||||
@@ -234,12 +235,13 @@ curl http://127.0.0.1:8765/tools
|
||||
|
||||
- 这是一个 **仅限 Editor** 的扩展,用于自动化 Cocos Creator,不会给最终游戏包添加运行时依赖。
|
||||
- MCP Server 默认监听 `http://127.0.0.1:8765/`。
|
||||
- 如果配置端口被占用,服务会自动回退到下一个可用端口,面板与一键客户端配置会使用实际运行端口。
|
||||
- 如果配置端口被占用,服务会先通过项目身份识别同项目已有 listener;无法确认同项目时才会自动回退到下一个可用端口,面板与一键客户端配置会使用实际运行端口。
|
||||
- `GET /health` 和 `GET /tools` 是只读调试端点,方便不用 MCP 客户端也能快速检查本地服务。
|
||||
- 默认 `core` profile 暴露 34 个高频工具;如果需要完整工具集,可在面板切到 `full`,暴露全部 89 个工具;也可以用 `custom` 按分类或工具名增删。
|
||||
- 默认 `core` profile 暴露 37 个高频工具;如果需要完整工具集,可在面板切到 `full`,暴露全部 101 个工具;也可以用 `custom` 按分类或工具名增删。
|
||||
- 面板提供手动更新检查,会对比当前安装版本和 GitHub 最新 Release。
|
||||
- Streamable HTTP 响应已补齐 MCP 传输层要求,包括 `Accept`、`MCP-Protocol-Version`、JSON-RPC notification/response,以及可选 `Mcp-Session-Id` session。
|
||||
- 工具列表会包含 MCP `outputSchema` 和 `annotations`;结构化工具结果统一使用包含 `ok`、`tool`、`callId`、`summary`、`data`、`refs` 的标准 envelope。
|
||||
- `execute_javascript` 安全检查默认开启,会拦截明显高风险的文件系统和 shell 模式,例如删除/截断调用、原始写入流、路径穿越、用户/系统绝对路径和 `child_process`。这是防护栏,不是完整沙箱;确认风险后可在单次调用中显式传入 `safety_checks: false`。
|
||||
- 所有已暴露的 MCP 工具都会直接执行,Cocos 扩展里没有额外 approval 开关。
|
||||
- 文件工具和 `cocos://asset/path/...` 资源默认只能访问当前 Cocos 项目根目录内的路径。
|
||||
- 推荐工作流是优先使用 `execute_javascript`,再配合截图、诊断、资产、检查类工具。
|
||||
@@ -251,12 +253,12 @@ curl http://127.0.0.1:8765/tools
|
||||
- **嵌入式 Cocos 扩展** — Cocos 侧不需要单独 Python 守护进程或外部 bridge
|
||||
- **一键客户端配置** — 在 Cocos Creator 内直接配置 Claude Code、Cursor、VS Code、Trae、Kiro、Codex
|
||||
- **内建项目上下文** — 直接暴露项目、场景、选择、脚本诊断、日志和交互历史资源
|
||||
- **默认聚焦,必要时全量** — `core` 降低工具列表噪音,需要时切到 `full` 暴露全部工具;`custom` 可按分类或工具名调整
|
||||
- **默认聚焦,必要时全量** — `core` 降低工具列表噪音,需要时切到 `full` 暴露全部工具;`custom` 与保存的 profile 可按分类或工具名调整并恢复
|
||||
- **可视化验证** — 截图和输入模拟让 AI 能验证 UI 与玩法改动
|
||||
|
||||
## 核心特性
|
||||
|
||||
- **89 个内置工具** — 覆盖场景层级、编辑器状态、选择工作流、Prefab、资产、项目指令、UI 创建、组件、文件、日志、脚本诊断、截图、运行态控制和输入模拟
|
||||
- **101 个内置工具** — 覆盖场景层级、编辑器状态、选择工作流、Prefab、资产、资产依赖、项目指令、UI 创建、组件、文件、日志、脚本诊断、截图、运行态控制、构建/预览辅助、编辑器偏好、事件绑定和输入模拟
|
||||
- **统一主工具** — `execute_javascript` 同时支持 `scene` 和 `editor` 两种上下文
|
||||
- **Resources 与 Prompts** — 实时项目/日志资源,以及脚本修复、场景验证、可玩原型等可复用工作流
|
||||
- **Cocos 图形面板** — `Funplay > MCP Server` 提供服务管理、更新检查、工具暴露、最近活动、日志、curl 排障和 MCP 客户端配置
|
||||
@@ -273,22 +275,22 @@ Funplay MCP for Cocos 延续 Funplay MCP for Unity 的设计原则,并针对 C
|
||||
| 内置服务 | 内嵌 HTTP MCP Server | 内嵌 HTTP MCP Server |
|
||||
| 主执行工具 | `execute_javascript` | `execute_code` |
|
||||
| 主语言 | 场景/编辑器上下文中的 JavaScript | Unity 编辑器/运行态中的 C# |
|
||||
| 默认工具集 | `core`,34 个工具 | 聚焦版 `core` 工具集 |
|
||||
| 完整工具集 | 89 个工具,并支持 `custom` 暴露 | 79 个工具 |
|
||||
| 默认工具集 | `core`,37 个工具 | 聚焦版 `core` 工具集 |
|
||||
| 完整工具集 | 101 个工具,并支持 `custom` 暴露 | 79 个工具 |
|
||||
| 客户端配置 | 一键配置面板 | 一键配置窗口 |
|
||||
|
||||
## MCP 能力结构
|
||||
|
||||
当前包提供四层能力:
|
||||
|
||||
- **Tools** — `core` 下 34 个工具,`full` 下 89 个工具,并支持 `custom` include/exclude 规则
|
||||
- **Tools** — `core` 下 37 个工具,`full` 下 101 个工具,并支持 `custom` include/exclude 规则和命名工具 profile
|
||||
- **Primary execution** — `execute_javascript` 用于场景/运行态和编辑器/browser 自动化
|
||||
- **Prompts** — `fix_script_errors`、`create_playable_prototype`、`scene_validation`、`auto_wire_scene`
|
||||
- **Resources** — 项目上下文、场景摘要、当前选择、脚本诊断、资产选择、日志和 MCP 交互历史
|
||||
|
||||
自动生成的工具参考文档见 [docs/TOOLS.md](./docs/TOOLS.md),里面包含工具分类、profile 和读写/变更提示。
|
||||
|
||||
当前默认 `core` 工具集刻意保持精简,只包含:`execute_javascript`、`execute_scene_script`、`execute_editor_script`、`get_editor_state`、`get_tool_catalog`、`check_for_updates`、`get_selection`、`list_project_instructions`、`read_project_instruction`、`set_selection`、`get_project_info`、`get_scene_info`、`get_hierarchy`、`list_scenes`、`open_scene`、`inspect_prefab`、`validate_prefab_references`、`inspect_prefab_instance`、`list_assets`、`inspect_asset`、`open_asset`、`select_asset`、`run_script_diagnostics`、`get_recent_logs`、`search_project_logs`、`clear_logs`、`validate_scene`、`get_performance_snapshot`、`get_script_diagnostic_context`、`get_runtime_state`、`capture_editor_screenshot`、`capture_scene_screenshot`、`capture_preview_screenshot`、`list_editor_windows`。
|
||||
当前默认 `core` 工具集刻意保持精简,只包含:`execute_javascript`、`execute_scene_script`、`execute_editor_script`、`get_editor_state`、`get_tool_catalog`、`check_for_updates`、`get_selection`、`list_project_instructions`、`read_project_instruction`、`set_selection`、`get_project_info`、`get_build_status`、`get_scene_info`、`get_hierarchy`、`list_scenes`、`open_scene`、`inspect_prefab`、`validate_prefab_references`、`inspect_prefab_instance`、`list_assets`、`inspect_asset`、`inspect_asset_dependencies`、`validate_asset_dependencies`、`open_asset`、`select_asset`、`run_script_diagnostics`、`get_recent_logs`、`search_project_logs`、`clear_logs`、`validate_scene`、`get_performance_snapshot`、`get_script_diagnostic_context`、`get_runtime_state`、`capture_editor_screenshot`、`capture_scene_screenshot`、`capture_preview_screenshot`、`list_editor_windows`。
|
||||
|
||||
## 内置 Resources
|
||||
|
||||
@@ -307,24 +309,25 @@ Funplay MCP for Cocos 延续 Funplay MCP for Unity 的设计原则,并针对 C
|
||||
|
||||
## 内置工具
|
||||
|
||||
Funplay MCP for Cocos 当前在 `full` profile 下提供 **89 个工具函数**:
|
||||
Funplay MCP for Cocos 当前在 `full` profile 下提供 **101 个工具函数**:
|
||||
|
||||
| 分类 | 工具 |
|
||||
|------|------|
|
||||
| **脚本执行** | `execute_javascript`, `execute_scene_script`, `execute_editor_script` |
|
||||
| **编辑器状态** | `get_editor_state`, `get_tool_catalog`, `check_for_updates`, `get_selection`, `set_selection`, `get_editor_selection` |
|
||||
| **项目指令** | `list_project_instructions`, `read_project_instruction`, `write_project_instruction`, `create_project_skill` |
|
||||
| **项目指令** | `list_project_instructions`, `read_project_instruction`, `write_project_instruction`, `create_project_skill`, `create_cocos_mcp_project_skill` |
|
||||
| **项目与场景** | `get_project_info`, `get_scene_info`, `get_hierarchy`, `find_nodes`, `inspect_node`, `list_scenes`, `open_scene`, `run_scene_asset` |
|
||||
| **节点编辑** | `create_node`, `delete_node`, `set_node_transform` |
|
||||
| **资产与 Prefab** | `list_assets`, `inspect_asset`, `open_asset`, `select_asset`, `delete_asset`, `list_prefabs`, `inspect_prefab`, `validate_prefab_references`, `duplicate_prefab`, `edit_prefab_json`, `create_prefab_instance`, `inspect_prefab_instance`, `apply_prefab_instance`, `revert_prefab_instance`, `instantiate_prefab` |
|
||||
| **资产与 Prefab** | `list_assets`, `inspect_asset`, `inspect_asset_dependencies`, `validate_asset_dependencies`, `open_asset`, `select_asset`, `delete_asset`, `list_prefabs`, `inspect_prefab`, `validate_prefab_references`, `duplicate_prefab`, `edit_prefab_json`, `create_prefab_instance`, `inspect_prefab_instance`, `apply_prefab_instance`, `revert_prefab_instance`, `instantiate_prefab` |
|
||||
| **组件** | `list_components`, `inspect_component`, `add_component`, `remove_component`, `set_component_property`, `reset_component_property` |
|
||||
| **UI** | `create_canvas`, `create_label`, `create_button`, `create_sprite` |
|
||||
| **相机** | `list_cameras`, `create_camera`, `set_camera_properties` |
|
||||
| **动画** | `list_animations`, `add_animation_clip`, `play_animation`, `stop_animation` |
|
||||
| **文件** | `read_file`, `get_file_snippet`, `write_file`, `replace_in_file`, `search_files`, `list_directory`, `exists`, `refresh_assets` |
|
||||
| **诊断与日志** | `run_script_diagnostics`, `get_script_diagnostic_context`, `get_recent_logs`, `search_project_logs`, `clear_logs`, `validate_scene`, `get_performance_snapshot` |
|
||||
| **构建与编辑器** | `get_build_status`, `open_build_panel`, `run_project_preview`, `save_current_scene`, `get_editor_preference`, `set_editor_preference`, `broadcast_editor_message` |
|
||||
| **运行态** | `get_runtime_state`, `pause_runtime`, `resume_runtime`, `set_time_scale` |
|
||||
| **交互** | `emit_node_event`, `simulate_button_click`, `invoke_component_method`, `simulate_mouse_click`, `simulate_mouse_drag`, `simulate_key_press`, `simulate_key_combo`, `simulate_preview_input` |
|
||||
| **交互与事件** | `emit_node_event`, `simulate_button_click`, `list_button_click_events`, `bind_button_click_event`, `invoke_component_method`, `simulate_mouse_click`, `simulate_mouse_drag`, `simulate_key_press`, `simulate_key_combo`, `simulate_preview_input` |
|
||||
| **截图与窗口** | `capture_desktop_screenshot`, `capture_editor_screenshot`, `capture_scene_screenshot`, `capture_game_screenshot`, `capture_preview_screenshot`, `list_editor_windows` |
|
||||
|
||||
## 主工具示例
|
||||
@@ -365,8 +368,11 @@ Editor 上下文脚本可以访问 `Editor`、`fs`、`path`、`os`、`require`
|
||||
"enabledTools": [],
|
||||
"disabledTools": [],
|
||||
"enableSessions": false,
|
||||
"executeJavascriptSafetyChecks": true,
|
||||
"autostart": true,
|
||||
"maxInteractionLogEntries": 50
|
||||
"maxInteractionLogEntries": 50,
|
||||
"activeToolProfileName": "",
|
||||
"savedToolProfiles": []
|
||||
}
|
||||
```
|
||||
|
||||
@@ -376,7 +382,7 @@ Editor 上下文脚本可以访问 `Editor`、`fs`、`path`、`os`、`require`
|
||||
- `COCOS_MCP_PORT`
|
||||
- `COCOS_MCP_PROFILE`
|
||||
|
||||
`toolProfile: "custom"` 会从 `core` 集合开始,再加入 `enabledToolCategories` / `enabledTools`,并移除 `disabledToolCategories` / `disabledTools`。`enableSessions` 默认关闭,因为常规编辑器自动化不需要跨请求客户端状态。
|
||||
`toolProfile: "custom"` 会从 `core` 集合开始,再加入 `enabledToolCategories` / `enabledTools`,并移除 `disabledToolCategories` / `disabledTools`。面板可以把这些暴露设置保存为命名 `savedToolProfiles`,方便恢复或分享。`enableSessions` 默认关闭,因为常规编辑器自动化不需要跨请求客户端状态。
|
||||
|
||||
## 架构
|
||||
|
||||
@@ -394,6 +400,12 @@ Cocos Creator Extension
|
||||
│ └─ Minimal MCP Server panel
|
||||
└─ lib/
|
||||
├─ assets, diagnostics, screenshots, input
|
||||
├─ tool-profiles, javascript-safety
|
||||
├─ tools/
|
||||
│ ├─ files
|
||||
│ ├─ assets-advanced
|
||||
│ ├─ cocos-project
|
||||
│ └─ scene-events
|
||||
└─ server, resources, prompts, tool registry
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user