Imported from ArifZx/cocos-extension-mcp (
AGENTS.md). Install upstream withnpx skills add ArifZx/cocos-extension-mcp. Copyright stays with the author.
AGENTS.md
Purpose
This repository is a TypeScript MCP server for Cocos Creator extension tooling. The server exposes Cocos-aware tools that generate, inspect, and validate editor extension artifacts.
Commands
npm run buildcompiles the server with TypeScript and is the default validation command.npm run devruns the stdio MCP server from source viatsx.npm run startruns the compiled server fromdist/.npm testcurrently aliases tonpm run build.
Source Layout
src/index.tsis the stdio MCP entrypoint and tool registration surface.src/cocos-extension.tscontains the Cocos-specific schema and generation or validation logic.dist/is generated output. Prefer editingsrc/only.
Working Rules
- Keep the project ESM-compatible. Imports should target the emitted
.jspath style used by NodeNext. - Prefer small domain helpers in
src/cocos-extension.tsand keepsrc/index.tsfocused on MCP registration. - When adding a new MCP tool, return both
contentandstructuredContentwhen the result is structured. - Validate changes with
npm run buildimmediately after editing TypeScript files.
Cocos Extension Model
Tool behavior should follow the Cocos Creator 3.8 editor extension architecture documented here:
- Manual book index: https://docs.cocos.com/creator/3.8/manual/en/editor/extension/readme.html
- Basic index: https://docs.cocos.com/creator/3.8/manual/en/editor/extension/basic.html
- Extension infrastructure: https://docs.cocos.com/creator/3.8/manual/en/editor/extension/package.html
- Extension definition: https://docs.cocos.com/creator/3.8/manual/en/editor/extension/define.html
- Message system: https://docs.cocos.com/creator/3.8/manual/en/editor/extension/messages.html
- Configuration system: https://docs.cocos.com/creator/3.8/manual/en/editor/extension/profile.html
- Panel system: https://docs.cocos.com/creator/3.8/manual/en/editor/extension/panel.html
- UI components: https://docs.cocos.com/creator/3.8/manual/en/editor/extension/ui.html
Use these rules when implementing or validating Cocos-related outputs:
-
Treat the manual book index as the navigation hub for extension docs. Use it first when you need to discover the right child page for menus, panels, communication, installation, or contributions.
-
package.jsonis the primary contract for an extension:package_version,version,name,main,panels,contributions, andscriptsare the main control points. -
Cocos extensions are multi-process. Extension
mainruns separately from panel processes, so panel interactions should be modeled aroundEditor.MessageandEditor.Panelinstead of shared in-memory assumptions. -
Normal message names should use lowercase kebab-case, and broadcast messages should follow the
packageName:actionNamepattern. -
Panel definitions belong in
package.json > panels; panel implementation usually lives undersrc/panels/<name>/index.tsand compiles todist/panels/<name>. -
i18n-facing strings should prefer
i18n:keys when they represent user-visible labels in manifest-like data. -
Persistent settings should align with
contributions.profilefor editor or project configuration instead of ad hoc config shapes.
Scope Guidance
- Keep this repo focused on generating and validating extension artifacts, not on running Cocos Creator itself.
- If a behavior depends on undocumented Cocos internals, prefer emitting a conservative scaffold plus a warning rather than inventing unsupported fields.newline