codex - 💡(How to fix) Fix MCP tool invocation regressed for custom/local providers (Ollama Responses API) in v0.117.0+ [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#19871Fetched 2026-04-28 06:35:48
View on GitHub
Comments
2
Participants
3
Timeline
11
Reactions
0
Timeline (top)
labeled ×5commented ×2cross-referenced ×2renamed ×1

Root Cause

  • 0.116.0 for Ollama/custom-provider profiles because MCP calls still work there
  • a newer Codex build for the OpenAI gpt-5.5 profile because the older binary is no longer a practical OpenAI runtime

Fix Action

Fix / Workaround

I am currently pinning 0.116.0 only as a workaround for the custom/local provider path.

I also reproduced the same class of failure with other Ollama-served models through the same Codex provider/config shape, including qwen3.5:122b, qwen3.6:35b-a3b-bf16, and gemma4:31b. One vision model profile can also stall in some runs, but the simpler text-model repro is enough to show the MCP dispatch regression.

On regressed versions, the model frequently answers without making the MCP call, or otherwise fails to dispatch the registered tool despite it being available.

Code Example

printf '%s\n' '<prompt>' | CODEX_HOME=/tmp/codex-local codex exec \
  --profile=local-ollama \
  --cd /path/to/workspace \
  --skip-git-repo-check \
  --dangerously-bypass-approvals-and-sandbox \
  -

---

tool brave_search.brave_web_search({...})

---

model_provider = "remoteollama"
model = "gpt-oss:120b"

[model_providers.remoteollama]
name = "Ollama"
base_url = "http://<ollama-host>:11434/v1"
wire_api = "responses"

[profiles.local-ollama]
model_provider = "remoteollama"
model = "gpt-oss:120b"
model_context_window = 131072
model_catalog_json = "/path/to/model-catalog.json"
approval_policy = "never"
sandbox_mode = "danger-full-access"

[mcp_servers.brave_search]
startup_timeout_sec = 60
command = "<brave-search-mcp-command>"
args = ["..."]

---

printf '%s\n' 'Use the brave_search tool, not shell, to find the special comedian guest for the 2026 White House Correspondents Dinner. Return only the name and one source URL.' \
  | CODEX_HOME=/tmp/codex-local codex exec --profile=local-ollama --cd /path/to/workspace -

---

printf '%s\n' 'Reply with exactly READY.' \
  | CODEX_HOME=/tmp/codex-local codex exec --profile=local-ollama --cd /path/to/workspace -
RAW_BUFFERClick to expand / collapse

What version of Codex CLI is running?

Bisected with the same Codex config and MCP server set:

  • 0.115.0: good
  • 0.116.0: good
  • 0.117.0 through 0.125.0: MCP tool invocation becomes unreliable for custom/local model providers
  • 0.126.0-alpha variants tested during investigation: still reproduced

I am currently pinning 0.116.0 only as a workaround for the custom/local provider path.

What subscription do you have?

Not applicable to the repro. This is a custom model provider path using a remote Ollama/OpenAI-compatible endpoint, not an OpenAI-hosted model invocation.

Which model were you using?

Primary repro: gpt-oss:120b served by Ollama through an OpenAI-compatible /v1 endpoint with wire_api = "responses".

I also reproduced the same class of failure with other Ollama-served models through the same Codex provider/config shape, including qwen3.5:122b, qwen3.6:35b-a3b-bf16, and gemma4:31b. One vision model profile can also stall in some runs, but the simpler text-model repro is enough to show the MCP dispatch regression.

What platform is your computer?

Linux x86_64. The current deployed host reports Linux 6.8.0-100-generic.

What terminal emulator and version are you using (if applicable)?

The clearest repro is non-interactive codex exec from a shell. My local helper script is not intended to be the interesting part of the report: it renders config.toml, sets CODEX_HOME, chooses a profile, and then execs Codex.

The important command shape is equivalent to:

printf '%s\n' '<prompt>' | CODEX_HOME=/tmp/codex-local codex exec \
  --profile=local-ollama \
  --cd /path/to/workspace \
  --skip-git-repo-check \
  --dangerously-bypass-approvals-and-sandbox \
  -

What issue are you seeing?

For custom/local model providers using the Responses wire API, Codex 0.117.0+ often fails to invoke registered MCP tools even when the prompt explicitly requires tool use.

The session starts, the MCP server list can show the relevant server as ready, and other tool surfaces such as shell execution may still work. The failure is that Codex does not emit the expected MCP tool call. With the same config and prompt on 0.115.0 or 0.116.0, the transcript includes a real tool call such as:

tool brave_search.brave_web_search({...})

On regressed versions, the model frequently answers without making the MCP call, or otherwise fails to dispatch the registered tool despite it being available.

This looks like a Codex custom-provider/tool-routing regression rather than a generic MCP server startup issue. The same MCP servers and same model-provider config are usable on the known-good versions, and the regression starts at 0.117.0 in my bisect.

What steps can reproduce the bug?

Use a custom provider backed by Ollama or another OpenAI-compatible endpoint, with the Responses wire API and at least one MCP server that is easy to force from the prompt.

Representative config shape:

model_provider = "remoteollama"
model = "gpt-oss:120b"

[model_providers.remoteollama]
name = "Ollama"
base_url = "http://<ollama-host>:11434/v1"
wire_api = "responses"

[profiles.local-ollama]
model_provider = "remoteollama"
model = "gpt-oss:120b"
model_context_window = 131072
model_catalog_json = "/path/to/model-catalog.json"
approval_policy = "never"
sandbox_mode = "danger-full-access"

[mcp_servers.brave_search]
startup_timeout_sec = 60
command = "<brave-search-mcp-command>"
args = ["..."]

The catalog entries mark these models as API-supported and define their context windows/reasoning metadata; they are ordinary Codex model catalog entries, not special wrapper logic.

Then run an explicit MCP-forcing prompt:

printf '%s\n' 'Use the brave_search tool, not shell, to find the special comedian guest for the 2026 White House Correspondents Dinner. Return only the name and one source URL.' \
  | CODEX_HOME=/tmp/codex-local codex exec --profile=local-ollama --cd /path/to/workspace -

If MCP startup is slow on the first invocation, run a simple warm-up prompt first and judge the second run:

printf '%s\n' 'Reply with exactly READY.' \
  | CODEX_HOME=/tmp/codex-local codex exec --profile=local-ollama --cd /path/to/workspace -

Expected comparison:

  • 0.115.0 / 0.116.0: after MCP startup, the transcript emits a real brave_search MCP tool call and returns the sourced answer.
  • 0.117.0+: MCP startup may still show brave_search ready, but Codex no longer reliably emits the MCP tool call for the same prompt/config/provider.

What is the expected behavior?

Once an MCP server is started and available, a prompt that explicitly requires brave_search or web_search should reliably produce a real MCP tool call for custom/local provider models, matching the behavior seen in 0.115.0 and 0.116.0.

The custom-provider path should not require pinning an older Codex binary solely to preserve MCP tool invocation.

Additional information

My deployment has extra scaffolding that I do not think is essential to the bug: a VM image build, envsubst/envconsul config rendering, Dockerized MCP server images, persistent CODEX_HOME, and a small wrapper script used to select profiles. Those details explain why I noticed the regression, but the wrapper is not doing tool dispatch. It ultimately renders normal Codex config and runs codex exec --profile=... --cd ... -.

The current workaround in my environment is to install two Codex binaries:

  • 0.116.0 for Ollama/custom-provider profiles because MCP calls still work there
  • a newer Codex build for the OpenAI gpt-5.5 profile because the older binary is no longer a practical OpenAI runtime

This is only a compatibility bridge. It is not evidence that newer versions restored custom-provider MCP tool calling.

Related upstream signals that may be relevant:

  • Closed issues in the same general area: #1558, #7517, #8829
  • Open issue from the same release window: #16335
  • MCP/tool-routing PRs around this period: #17556 and #18413

extent analysis

TL;DR

The issue can be temporarily worked around by pinning the Codex CLI version to 0.116.0 for custom/local model providers.

Guidance

  • Verify that the issue is specific to custom/local model providers using the Responses wire API by testing with different providers and APIs.
  • Check the MCP server startup and availability to ensure it's not a server-side issue.
  • Test with different models and prompts to confirm the regression is consistent.
  • Review the related upstream issues and PRs (#1558, #7517, #8829, #16335, #17556, #18413) for potential insights into the cause.

Example

No code snippet is provided as the issue is related to a specific version regression and not a code-specific problem.

Notes

The issue seems to be a regression introduced in version 0.117.0 and is specific to custom/local model providers using the Responses wire API. The workaround of pinning the version to 0.116.0 is not a permanent solution and may not be feasible for all users.

Recommendation

Apply the workaround of pinning the Codex CLI version to 0.116.0 for custom/local model providers, as it is the only known version that works reliably with MCP tool invocation for these providers.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix MCP tool invocation regressed for custom/local providers (Ollama Responses API) in v0.117.0+ [2 comments, 3 participants]