cocos-mcp: Instructions file for Codex

AGENTS.md

cocos-mcp AGENTS.md is an instructions file for Codex, OpenCode from dekaic/cocos-mcp. It costs 1,867 tokens per session, scanned A, original, Apache-2.0.

Project instructions for using the cocos-mcp tools with Cocos projects, including allowed entry points and rules for selecting the active project instance.

In plain words
What is it for?
Use them when querying or editing Cocos scenes and assets, interacting with previews, using HTTP or offline tools, and validating extension changes.
Why use it?
They prevent the agent from operating on the wrong open project or using an unsupported access path.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions AGENTS.md.

This is dekaic/cocos-mcp's own configuration. It tells Codex and OpenCode how to work on cocos-mcp itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything cocos-mcp configures →

Reuse

Borrowing it

Nothing to install: this file belongs to dekaic/cocos-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/dekaic/cocos-mcp/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/dekaic/cocos-mcp

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cocos-mcp AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/dekaic/cocos-mcp/agents-md/github.svg)](https://agentmods.dev/instructions/dekaic/cocos-mcp/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/dekaic/cocos-mcp/agents-md"><img src="https://agentmods.dev/badge/instructions/dekaic/cocos-mcp/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for cocos-mcp AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/dekaic/cocos-mcp/agents-md"><img src="https://agentmods.dev/badge/instructions/dekaic/cocos-mcp/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,867 This file is loaded in full into every session.
When invoked 1,867 The same file — it is already loaded in full.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.01867 $0.01867
Opus 5.5 $0.00747 $0.00747
Sonnet 5.5 $0.00373 $0.00373
Haiku 4.5 $0.00187 $0.00187

Measured 2mo ago against content hash eaa175661016, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

cocos-mcp AGENTS.md scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -sS -X POST http://127.0.0.1:<mcp-port>/mcp \
AGENTS.md · 173 lines

How it starts

The opening of the file, as written. The whole thing — 173 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AGENTS.md

本文是 cocos-mcp 的 agent 使用规则。只写插件级规则;项目自己的预览参数、业务本地服地址、测试账号和验证步骤写在项目文档里。

允许入口

使用本插件时,只允许从下面这些入口进入:

入口 用途
当前项目 MCP 实例 scene / asset-db / preview / local 域操作
当前项目 HTTP MCP endpoint 当前 agent 没注入 MCP tool 时的等价入口
cocos-mcp-cli offline 命令 .prefab 查询和修改、.anim 查询
Playwright / Chrome 浏览器里真实游戏页面的交互验证
.dev/refresh 的 restart-package 重启本扩展代码

其它入口不作为本插件使用路径。项目文档可以补充项目自己的只读兜底信息,但不能覆盖本文件的入口规则。

绑定当前项目 MCP

同机可能同时打开多个 Cocos 项目。agent 必须先按项目根目录绑定 MCP 实例,再执行后续操作。

实例注册文件:

~/.cocos-mcp/editors/*.json

绑定规则:

  1. 扫描 ~/.cocos-mcp/editors/*.json。
  2. 只保留 projectPath 与当前项目根目录一致的记录。
  3. 校验 pid 仍存活。
  4. 多个匹配时取 updatedAt 最新的记录。
  5. 后续所有 HTTP MCP 请求都使用该记录的 url。
  6. 验证扩展代码变化时同时核对 runtimeBuildId、toolSchemaHash 和 loadedAt;工作树当前 HEAD/dirty 不能证明进程已加载新代码。

快速确认脚本:

python3 - <<'PY'
import glob
import json
import os
from pathlib import Path

def find_project_root(start):
    cur = Path(start).resolve()
    for item in [cur, *cur.parents]:
        if (item / 'assets').is_dir() and (item / 'settings').is_dir() and (item / 'extensions').is_dir():
            return str(item)
    return str(cur)

PROJECT = os.environ.get('PROJECT_ROOT') or find_project_root(os.getcwd())
items = []

for path in glob.glob(os.path.expanduser('~/.cocos-mcp/editors/*.json')):
    try:
        with open(path, 'r', encoding='utf-8') as f:
            data = json.load(f)
        if os.path.realpath(data.get('projectPath', '')) != os.path.realpath(PROJECT):
            continue
        os.kill(int(data['pid']), 0)
        items.append((data.get('updatedAt', ''), path, data))
    except Exception:
        pass

for _, path, data in sorted(items)[-3:]:
    print(path, data.get('url'), data.get('previewUrl') or '')
PY

Tool 与 HTTP MCP

如果当前 agent 已注入 router 暴露的 MCP tool,使用带项目名前缀的 tool:

forest__preview_query_url
forest__asset_reimport
forest__preview_refresh_and_reload

如果当前 agent 没注入这些 tool,按上节解析当前项目 MCP,再直接调用 HTTP endpoint。

Read the full file on GitHub · 173 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 173 lines · 1,867 tokens per session scan A eaa175661016

Subscribe to this mod's changes

cocos-mcp AGENTS.md is an instructions file published in the GitHub repository dekaic/cocos-mcp (0 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 1,867 tokens to every session, about $0.0075 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

cocos-mcp AGENTS.md compared with instructions from other repositories

cocos-mcp AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
cocos-mcp AGENTS.mddekaic/cocos-mcpInstructions file01mo agoApache-2.0A1,867Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,461Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA5,685GitHub Copilot
langchain AGENTS.mdlangchain-ai/langchainInstructions file149ktodayMITA4,680Codex, OpenCode
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA3,093GitHub Copilot
vscode model-prompts.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA2,022GitHub Copilot