██████╗ ██╗ █████╗ ██╗ ██╗ ██████╗ █████╗ ███╗ ██╗██╗ ██╗ █████╗ ███████╗
██╔══██╗██║ ██╔══██╗╚██╗ ██╔╝██╔════╝██╔══██╗████╗ ██║██║ ██║██╔══██╗██╔════╝
██████╔╝██║ ███████║ ╚████╔╝ ██║ ███████║██╔██╗ ██║██║ ██║███████║███████╗
██╔═══╝ ██║ ██╔══██║ ╚██╔╝ ██║ ██╔══██║██║╚██╗██║╚██╗ ██╔╝██╔══██║╚════██║
██║ ███████╗██║ ██║ ██║ ╚██████╗██║ ██║██║ ╚████║ ╚████╔╝ ██║ ██║███████║
╚═╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═══╝ ╚═╝ ╚═╝╚══════╝
███╗ ███╗ ██████╗██████╗ ███████╗███████╗██████╗ ██╗ ██╗███████╗██████╗
████╗ ████║██╔════╝██╔══██╗ ██╔════╝██╔════╝██╔══██╗██║ ██║██╔════╝██╔══██╗
██╔████╔██║██║ ██████╔╝ ███████╗█████╗ ██████╔╝██║ ██║█████╗ ██████╔╝
██║╚██╔╝██║██║ ██╔═══╝ ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██╔══╝ ██╔══██╗
██║ ╚═╝ ██║╚██████╗██║ ███████║███████╗██║ ██║ ╚████╔╝ ███████╗██║ ██║
╚═╝ ╚═╝ ╚═════╝╚═╝ ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝用于自动化的MCP服务器 PlayCanvas编辑器 使用LLM。
\[!重要\]\ 目前,MCP服务器需要由Anthropic的Claude驱动。我们的经验表明,Claude的免费层无法提供足够大的聊天上下文来可靠地操作MCP服务器。因此,我们强烈建议订阅Pro Claude帐户。
可用工具
- 实体
- list_entities - create_entities - delete_entities - duplicate_entities - modify_entities - reparent_entity - add_components - remove_components - add_script_component_script
- 资产
- list_assets - create_assets - delete_assets - instantiate_template_assets - set_script_text - script_parse - set_material_diffuse
- 场景
- query_scene_settings - modify_scene_settings
- 商店
- store_search - store_get - store_download
- 视口
- capture_viewport - focus_viewport
安装
跑 npm install 安装所有依赖项。
安装Chrome扩展程序
- 访问
chrome://extensions/并启用开发人员模式 - 点击
Load unpacked并选择extension文件夹 - 加载PlayCanvas编辑器。应加载扩展名。
运行MCP服务器
MCP服务器可以由Cursor或Claude Desktop驱动。
\[!提示\]\ 我们发现Claude Desktop通常更可靠。
克劳德桌面
- 安装 克劳德桌面.
- 首选
Claude>Settings. - 选择
Developer然后Edit Config. - 这将打开
claude_desktop_config.json,您的MCP配置JSON文件。
光标
- 安装 光标.
- 选择
File>Preferences>Cursor Settings. - 点击
+ Add new global MCP server. - 这将打开
mcp.json,您的MCP配置JSON文件。
\[!提示\]\ 也在Cursor Settings,选择Features并滚动到Chat部分。激活Enable auto-run mode以允许LLM运行MCP工具而不需要持续授权。你这样做的风险由你自己承担(但我们更喜欢这样)!
\[!重要\]\ 在Cursor中,确保您有Agent挑选出来的。Ask和Edit模式将无法识别MCP服务器。
MCP配置JSON文件
你的配置应该是这样的:
视窗
{
"mcpServers": {
"playcanvas": {
"command": "cmd",
"args": [
"/c",
"npx",
"tsx",
"C:\\path\\to\\editor-mcp-server\\src\\server.ts"
],
"env": {
"PORT": "52000"
}
}
}
}macOS
{
"mcpServers": {
"playcanvas": {
"command": "npx",
"args": [
"tsx",
"/path/to/editor-mcp-server/src/server.ts"
],
"env": {
"PORT": "52000"
}
}
}
}将编辑器连接到MCP服务器
PlayCanvas编辑器不会自动连接到MCP服务器。要连接,请执行以下操作:
- 激活运行PlayCanvas编辑器的Chrome选项卡。
- 选择地址栏右侧的扩展图标。
- 选择PlayCanvas Editor MCP扩展以打开扩展弹出窗口。
- 选择
CONNECT(端口号应与MCP配置JSON文件中设置的端口号匹配)。
\[!注意\] 目前,您一次只能将PlayCanvas编辑器的一个实例连接到MCP服务器。
现在,您应该能够在Claude Desktop或Cursor中发出命令。
