Codex prioritizes MCP server tools over native tools when Claude Code is configured as MCP server

Resolved 💬 3 comments Opened Nov 5, 2025 by adnichols Closed Nov 5, 2025
💡 Likely answer: A maintainer (gpeal, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

codex-cli 0.55.0

What subscription do you have?

Plus

Which model were you using?

gpt-5-codex

What platform is your computer?

Darwin 25.1.0 arm64 arm

What issue are you seeing?

When Claude Code is configured as an MCP server in Codex, Codex preferentially routes tool calls to Claude's MCP-provided tools (e.g., claude.Grep, claude.Glob) instead of using its own native/local equivalents. This creates unnecessary overhead and unexpected behavior, as Codex should prefer its own optimized tools for local filesystem operations.

Ordinarily, I have to specifically tell codex to use claude for actions. The reason claude is configured this way is to provide an easy way to have the two agents work together on issues.

What steps can reproduce the bug?

Config Example:

[mcp_servers.claude]
command = "claude"
args = ["mcp", "serve"]

Example:

➜  fp-vercel git:(main) codex exec "find notes for issue nod-000"
OpenAI Codex v0.55.0 (research preview)
--------
workdir: /Users/anichols/code/fp-vercel
model: gpt-5-codex
provider: openai
approval: never
sandbox: workspace-write [workdir, /tmp, $TMPDIR]
reasoning effort: high
reasoning summaries: auto
session id: 019a54a8-c62f-7942-aa46-b646baf42bbb
--------
user
find notes for issue nod-000
deprecated: `experimental_use_rmcp_client` is deprecated. Use `rmcp_client` instead.
  You can either enable it using the CLI with `--enable rmcp_client` or through the config.toml file with `[features].rmcp_client`

thinking
**Searching for issue nod-000 notes**
tool claude.Grep({"pattern":"nod-000","path":".","output_mode":"content","n":true,"head_limit":20})
claude.Grep({"pattern":"nod-000","path":".","output_mode":"content","n":true,"head_limit":20}) success in 16ms:
{
  "content": [
    {
      "text": "{\"mode\":\"content\",\"numFiles\":0,\"filenames\":[],\"content\":\"\",\"numLines\":0,\"appliedLimit\":20}",
      "type": "text"
    }
  ]
}

thinking
**Checking for case and format variations**
tool claude.Grep({"pattern":"nod[-_]000","path":".","output_mode":"content","i":true,"n":true,"head_limit":20})
claude.Grep({"pattern":"nod[-_]000","path":".","output_mode":"content","i":true,"n":true,"head_limit":20}) success in 36ms:
{
  "content": [
    {
      "text": "{\"mode\":\"content\",\"numFiles\":0,\"filenames\":[],\"content\":\"\",\"numLines\":0,\"appliedLimit\":20}",
      "type": "text"
    }
  ]
}

What is the expected behavior?

Codex uses it's native tools instead of MCP:

➜  fp-vercel git:(main) ✗ codex exec "find notes for issue nod-000"
OpenAI Codex v0.55.0 (research preview)
--------
workdir: /Users/anichols/code/fp-vercel
model: gpt-5-codex
provider: openai
approval: never
sandbox: workspace-write [workdir, /tmp, $TMPDIR]
reasoning effort: high
reasoning summaries: auto
session id: 019a54b0-5631-7f03-81b3-ae66687f5528
--------
user
find notes for issue nod-000
deprecated: `experimental_use_rmcp_client` is deprecated. Use `rmcp_client` instead.
  You can either enable it using the CLI with `--enable rmcp_client` or through the config.toml file with `[features].rmcp_client`

thinking
**Searching repository for nod-000 issue**
exec
bash -lc 'rg -n "nod-000"' in /Users/anichols/code/fp-vercel exited 1 in 182ms:


thinking
**Trying alternative match cases**
exec
bash -lc 'rg -ni "nod-000"' in /Users/anichols/code/fp-vercel exited 1 in 27ms:

Additional information

This has been configured in codex for weeks and was working fine - but just surfaced in the last day or so as a new behavior, so seems related to the 0.54/0.55 release changes.

View original on GitHub ↗

3 Comments

gpeal contributor · 9 months ago

Feel free to provide more specific guidance in your AGENTS.md

adnichols · 9 months ago

I always feel free to do that. I don't love burning context to tell codex to follow a sensible default. Not the first time with this tool though.

adnichols · 9 months ago

For anyone else who finds this - adding this to my ~/.codex/AGENTS.md did address this for a minute. However the next day codex fell back to using claude.Read. It's not clear how to steer this behavior reliably with AGENTS.md.

Unfortunately, each tool type needs to be listed, so for example if you remove the line Use native Task tool... it'll call claude.Task despite the directions below indicating otherwise.

Full AGENTS.md below - despite this, still getting tool calls choosing claude.Read

# AGENTS.md — Tool Selection (Generic)

When you need to call tools from the shell, use this rubric:

- Find files by file name: `fd`
- Find files with path name: `fd -p <file-path>`
- List files in a directory: `fd . <directory>`
- Find files with extension and pattern: `fd -e <extension> <pattern>`
- Find Text: `rg` (ripgrep)
- Find Code Structure: `ast-grep`
  - Default to TypeScript when in TS/TSX repos:
    - `.ts` → `ast-grep --lang ts -p '<pattern>'`
    - `.tsx` (React) → `ast-grep --lang tsx -p '<pattern>'`
  - Other common languages:
    - Python → `ast-grep --lang python -p '<pattern>'`
    - Bash → `ast-grep --lang bash -p '<pattern>'`
    - JavaScript → `ast-grep --lang js -p '<pattern>'`
    - Rust → `ast-grep --lang rust -p '<pattern>'`
    - JSON → `ast-grep --lang json -p '<pattern>'`
- Select among matches: pipe to `fzf`
- JSON: `jq`
- YAML/XML: `yq`

If `ast-grep` is available, avoid plain‑text searches (`rg`/`grep`) when you need syntax‑aware matching. Use `rg` only when a plain‑text search is explicitly requested.

## Tool Selection Priority (Codex Environment)

When agents run within Codex, they MUST prioritize native Codex tools over MCP server tools:

**DO:**
- Use native `Grep` tool (not `claude.Grep`)
- Use native `Glob` tool (not `claude.Glob`)
- Use native `Read` tool (not `claude.Read`)
- Use native `Task` tool (not `claude.Task`)
- Use direct bash commands (`rg`, `find`, etc.) when appropriate

**DO NOT:**
- Call MCP-prefixed tools for basic filesystem operations
- Route through Claude Code MCP server for searches or file reads
- Use `claude.*` tool variants when native equivalents exist

**Rationale:** MCP tool wrapping introduces unnecessary latency and may produce inconsistent results. Native Codex tools are optimized for the local filesystem and provide superior performance.```