codex-cua-mcp: Instructions file for Claude Code

CLAUDE.md

codex-cua-mcp CLAUDE.md is an instructions file for Claude Code from RS-Nocsi/codex-cua-mcp. It costs 928 tokens per session, scanned A, original, MIT.

Repository instructions for Codex CUA MCP, a server that lets compatible AI agents control Windows desktop applications through screenshots, clicks, typing, and keyboard input. They describe its commands, components, startup flow, and JSON-RPC communication.

In plain words
What is it for?
Building or running the TypeScript MCP server, configuring agent-specific runtime settings, starting the Windows executable, and working with its standard-input and standard-output message protocol.
Why use it?
They help developers understand how the server connects agents to the Windows automation program and how separate agent processes avoid interfering with one another.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md; mentions Claude Code; mentions Codex.

This is RS-Nocsi/codex-cua-mcp's own configuration. It tells Claude Code how to work on codex-cua-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 codex-cua-mcp configures →

Reuse

Borrowing it

Nothing to install: this file belongs to RS-Nocsi/codex-cua-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/RS-Nocsi/codex-cua-mcp/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/RS-Nocsi/codex-cua-mcp

Made for: Claude Code.

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 codex-cua-mcp CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/rs-nocsi/codex-cua-mcp/claude-md/github.svg)](https://agentmods.dev/instructions/rs-nocsi/codex-cua-mcp/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/rs-nocsi/codex-cua-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/rs-nocsi/codex-cua-mcp/claude-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 codex-cua-mcp CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/rs-nocsi/codex-cua-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/rs-nocsi/codex-cua-mcp/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 928 This file is loaded in full into every session.
When invoked 928 The same file — it is already loaded in full.
Security scan A 0 findings. 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.00928 $0.00928
Opus 5 $0.00464 $0.00464
Sonnet 5 $0.00186 $0.00186
Haiku 4.5 $0.00093 $0.00093

Measured 9d ago against content hash 7f06bafbe3c0, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

codex-cua-mcp CLAUDE.md scanned grade A with 0 findings 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 9d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 55 lines

How it starts

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

CLAUDE.md

本文档为 Claude Code(claude.ai/code)在此仓库中工作时提供指导。

项目概述

Codex CUA MCP 将 Codex 的 codex-computer-use.exe 封装为标准 MCP 服务器,使任何支持 MCP 的智能体(Claude Code、Cursor、Windsurf 等)能够通过截图、点击、打字和键盘输入来控制 Windows 桌面应用程序。

命令

npm run build          # 将 TypeScript 编译到 dist/
npm start              # 启动 MCP 服务器(需要 dist/ 已存在)

架构

智能体(Claude Code、Cursor 等)
  ↓ MCP 协议(stdio)
src/index.ts            # MCP 服务器入口,stdio 传输层,读取 clientInfo
  ↓
src/server.ts           # CodexCuaServer - 定义 13 个工具,懒启动 exe
  ↓
src/agent-name.ts       # 解析调用方显示名(env > 映射表 > Title Case > 兜底)
src/runtime-config.ts   # 为每个 Agent 渲染独立 config 到 config-runtime/<slug>/
  ↓
src/transport/sky.ts    # SkyTransport - 启动 exe,通过 stdin/stdout 进行 JSON-RPC 通信
  ↓
bin/codex-computer-use.exe  # 原生 Windows 二进制文件(SendInput、UI Automation)

关键流程:MCP 握手完成 → 首次工具调用时 server.ts 解析 Agent 名、渲染运行时 config、懒启动 exe → sky.ts 发送 JSON-RPC → exe 在 Windows 上执行 → 返回响应。多个 Agent 各自启动独立 exe 进程与 CODEX_HOME,互不冲突。

通信协议

exe 通过 stdin/stdout 使用换行分隔的 JSON-RPC 协议:

  • 请求:{"id": N, "method": "...", "params": {...}}
  • 成功:{"id": N, "ok": true, "result": {...}}
  • 需要审批:{"id": N, "ok": false, "approvalRequest": {"app": "...", "displayName": "...", "riskLevel": "low"}}
  • 审批响应:重新发送原始请求并附带 meta: {"x-oai-cua-approved-app": "<app>"}

重要实现细节

  • 懒启动:exe 在首次工具调用时才 spawn(CodexCuaServer.ensureStarted()),握手阶段不启动。index.ts 通过 getClientInfo 回调把 server.getClientVersion() 传入,供名字解析使用。
  • 动态 Agent 名agent-name.ts 按优先级解析调用方显示名——CUA_AGENT_NAME 环境变量 > MCP clientInfo.name 映射表 > Title Case 兜底 > "AI Agent"。名字写入桌面操作浮层文案。
  • 审批处理:每个操作(launch_app、get_window_state、click、type_text 等)在首次使用某个应用时会触发审批请求。SkyTransport 默认自动审批,并重新发送带有审批元数据的请求。
  • 窗口状态要求:输入操作(click、type、press_key、scroll、drag)需要先对目标窗口调用 get_window_state
  • 配置隔离runtime-config.tsconfig/computer-use/config.json 模板(含 {{AGENT_NAME}} 占位符)渲染到 config-runtime/<slug>/computer-use/config.jsonCODEX_HOME 指向该目录。每个 Agent 独立目录,多 Agent 互不冲突。
  • exe 搜索顺序SKY_EXE_PATH 环境变量 → 捆绑的 bin/codex-computer-use.exe → Codex 安装目录。

Read the full file on GitHub · 55 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. 9d ago First seen · 55 lines · 928 tokens per session scan A 7f06bafbe3c0

Subscribe to this mod's changes

codex-cua-mcp CLAUDE.md is an instructions file published in the GitHub repository RS-Nocsi/codex-cua-mcp (10 stars, last pushed 2mo ago), licensed MIT. It adds 928 tokens to every session, about $0.0046 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other instructions, from other repositories

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,153 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,469 tokens

deepseek-harness AGENTS.md

AGENTS.md instructions for deepseek-ai/deepseek-harness, covering agents.md, pre-stable apis and released session data, repository layout, commands and host sandbox failures.

deepseek-ai/deepseek-harness · 3,735 tokens