Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .codex-plugin/mcp.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"command": "node",
"args": ["./start.mjs"],
"cwd": ".",
"env": {
"CONTEXT_MODE_PLATFORM": "codex"
},
"default_tools_approval_mode": "approve"
}
}
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,9 @@ The Codex plugin manifest provides MCP via `.codex-plugin/mcp.json`, skills via

[mcp_servers.context-mode]
command = "context-mode"

[mcp_servers.context-mode.env]
CONTEXT_MODE_PLATFORM = "codex"
```

3. Create `$CODEX_HOME/hooks.json` (or `~/.codex/hooks.json` when `CODEX_HOME` is unset):
Expand Down
9 changes: 9 additions & 0 deletions tests/plugins/codex-manifest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ describe(".codex-plugin/mcp.json", () => {
expect(entry.cwd).toBe(".");
});

it("sets CONTEXT_MODE_PLATFORM=codex for the MCP server process", () => {
// Codex hook wrappers already set this before loading shared hook code.
// The MCP server needs the same signal so storage and doctor output do
// not fall back to ~/.claude on machines that have both agents installed.
const servers = mcp.mcpServers as Record<string, { env?: Record<string, string> }>;
const entry = servers["context-mode"];
expect(entry.env?.CONTEXT_MODE_PLATFORM).toBe("codex");
});

it("does NOT use `${CODEX_PLUGIN_ROOT}` placeholders (no var expansion happens)", () => {
const raw = readFileSync(resolve(REPO_ROOT, ".codex-plugin/mcp.json"), "utf8");
expect(raw).not.toMatch(/\$\{[^}]*PLUGIN_ROOT[^}]*\}/);
Expand Down
Loading