# Connect Codex or Claude Code to Cocos Creator

Choose between the editor panel, a local CLI and an MCP server. Check which Creator project is connected, inspect its tools and find approvals.

Canonical page: https://gameagent.ink/en/docs/cocos-mcp-cli/
Updated: 2026-11-25

If you already develop a Cocos game in Codex or Claude Code, the Game Agent CLI lets your coding agent inspect tools in a running Creator project. If you prefer to describe a task, review a preview and handle approvals inside the editor, open the Game Agent chat panel. The author walks through both approaches in the [Cocos forum comparison (Chinese)](https://forum.cocos.org/t/topic/177799).

## Choose an integration

| What you want to do | Where to start | Where to check the result |
| --- | --- | --- |
| Build a menu with a working button inside Creator | Open Game Agent chat and specify the scene, button label and click behavior | Review tool activity in the panel and click the button in Creator Preview |
| Read the current scene from Codex or Claude Code | Enable the project's CLI service and install the client and agent skill | The external agent reads the command output. Direct calls use the CLI's tool policy and current project state |
| Use an existing MCP service from the Game Agent panel | Configure its MCP server in the panel settings | The connected client can discover the tools that server provides |

MCP specifies how clients and servers exchange tools and resources. The second row uses Game Agent's local CLI protocol. It works without a separate Cocos MCP server. To use a Codex account as the model inside the panel, see [Connect a model](https://gameagent.ink/en/docs/models/). [MCP architecture overview](https://modelcontextprotocol.io/docs/learn/architecture)

The author also recorded a [nine-minute walkthrough on choosing AI tools for a mini game (Chinese)](https://www.bilibili.com/video/BV1AbySzkEzn/).

## Check which Creator project your terminal is using

1. Get the plugin for your project from [Game Agent on the Cocos Store](https://store.cocos.com/app/en/detail/9114). Creator 2.4.7–2.4.15 and Creator 3.7.0 or later use different packages. Find the correct directory in [Install and activate Game Agent](https://gameagent.ink/en/docs/getting-started/).
2. Open the project from Dashboard. Under **Game Agent settings → General → External tools**, enable the **CLI service** and keep the project open.
3. Choose **Install integration tools** and select your coding agent. Plugin v0.4.3 recommends `@game-agent/cli` 0.1.3. The external client requires Node.js 22.20.0 or later.
4. Run the commands below. Replace the sample path with your project's absolute path. Use the project list to distinguish between open projects.

```sh
game-agent --help
game-agent projects list --json
game-agent doctor --project "/path/to/CreatorProject" --json
game-agent tools describe CreatorInspect --project "/path/to/CreatorProject" --json
```

The first command works offline. You can check the version and Node.js requirement against the [published CLI package](https://www.npmjs.com/package/@game-agent/cli/v/0.1.3). The last reads the live tool contract without editing the scene. If a project is missing, check that Creator is open, the plugin is enabled and the CLI service is running in that project. Read the diagnostics from `doctor` before querying its tools again.

## Check results and handle approvals

Try a read-only request in your coding agent first. Ask it to list the scene's root nodes and their components and name the project it inspected. Compare the output with the Hierarchy and Inspector in Creator. To have Game Agent plan the work, delegate it with `agent start`. Its task, questions and approvals appear in the plugin's chat panel. For a gameplay change, start the browser preview from Creator and follow [Test in preview](https://gameagent.ink/en/docs/preview/) to repeat the interaction.

## Sources

- [The author's comparison on the Cocos forum (Chinese)](https://forum.cocos.org/t/topic/177799)
- [Game Agent CLI 0.1.3 package](https://www.npmjs.com/package/@game-agent/cli/v/0.1.3)
- [MCP architecture overview](https://modelcontextprotocol.io/docs/learn/architecture)
