Codex fails to detect and use configured MCP gateway, repeatedly guessing binaries instead
What version of Codex is running?
codex-cli 0.46.0
Which model were you using?
gpt-5-codex with high reasoning
What platform is your computer?
Darwin 25.0.0 arm64 arm
What steps can reproduce the bug?
Prereqs
- Docker Desktop with the MCP Toolkit enabled and Notion MCP installed.
- Codex CLI installed and configured via
~/.codex/config.toml. - A Docker MCP server entry.
My config snippet
[mcp_servers.docker_desktop]
command = "docker"
args = [
"mcp",
"gateway",
"run"
]
MCP list via Codex CLI
/mcp
🔌 MCP Tools
• Server: docker_desktop
• Status: enabled
• Auth: Unsupported
• Command: docker mcp gateway run
Steps
- Run Codex CLI and issue a task that explicitly asks to use the Notion MCP, e.g.:
``bash``
codex> "Using Notion MCP, open [page] and summarize it"
- Observe that Codex fails to discover the Notion MCP via Docker and instead attempts to call local binaries and search the filesystem.
Note: Before this bug, the above prompt was enough for Codex to know that it needed to access Notion through the Docker MCP setup.
What is the expected behavior?
The expected behavior covers both the discovery and introspection phases when interacting with a Docker-backed Notion MCP through the Codex CLI.
Discovery:
When Codex receives a request that explicitly or implicitly mentions an MCP such as Notion, it should follow a clear, step-by-step process to resolve and connect to the appropriate service:
- Check the user's configuration file (e.g.,
~/.codex/config.tomlfor declared MCP servers, including any Docker-backed entries. - If a Docker MCP entry is found, Codex should immediately attempt to connect to the Docker MCP gateway using this configuration.
- Codex should avoid any fallback behaviors that probe for local executables named
notion,mcp,notion_mcp,mcp-notion, or perform ad-hoc filesystem searches for MCP-related content.
Even if the Docker MCP entry isn't found, if it checked the configuration file first, it would know that Notion didn't exist, and inform the user that it was not able to find any Notion MCP server entries.
- It should also avoid unnecessary attempts to list Python packages or run unrelated commands to discover MCP tools.
- This process should be automatic and transparent to the user, enabling seamless MCP discovery and connection without manual intervention or explicit commands.
Tool introspection:
Once connected to the Docker MCP gateway, Codex should automatically resolve the MCP connection and load the available tools exposed by the registry. This should happen without manually runing commands like docker mcp tools list or docker mcp tools inspect to "unlock" or discover the tools. These introspection commands should remain available as optional diagnostics or debugging aids, but they must not be prerequisites for the CLI to recognize and utilize the MCP. The CLI should maintain an internal cache or state reflecting the available tools, updating it as needed, so that tool invocation commands can be issued directly and reliably.
User experience expectations:
On startup and during usage, the CLI should proactively check the configuration file and auto-detect any accessible MCP servers, including those backed by Docker. This minimizes the need to perform manual discovery steps or troubleshoot why an MCP is not being recognized. The CLI should prioritize configured MCP entries over local binaries or heuristics, ensuring a smooth and predictable user experience.
What do you see instead?
- Codex ignored the Docker MCP config initially and attempted to:
- run
notion,mcp,npx notion,notion_mcp,mcp-notion(all missing), - search the working directory and
$HOMEfor Notion/MCP content, - list packages via
pip/python3 -m pip. - Only after being explicitly told that Notion MCP exists "through Docker" did it pivot to
docker mcp …subcommands, after which the Notion tool catalog became visible. - Additionally, when prompted that Docker MCP access was defined in its configuration file, Codex proceeded to manually locate and read the file rather than automatically recognizing and applying the existing configuration.
Below is the actual session output up to the point where it began taking action:
› Using Notion MCP, can you redefine my Visual Identity Lab page to better optimize it and make it clearer. Create a beautiful, engaging, and useful Visual Identity. Before you start, you can use the Notion MCP to familiarize yourself with my Notion. Read every page.
• Explored
└ List ls
Search Notion MCP
Read AGENTS.md
Search MCP
List ls -a
Search Notion
• Ran notion --help
└ bash: notion: command not found
• Ran mcp --help
└ bash: mcp: command not found
• Ran npx notion --help
└ npm error could not determine executable to run
npm error A complete log of this run can be found in: /Users/austinwells/.npm/_logs/2025-10-14T03_24_06_033Z-debug-0.log
• Explored
└ Search Notion
Search Notion MCP in ..
Search find . -maxdepth 2 -type d
Search notion
• Ran env | sort
└ __CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
__CFBundleIdentifier=dev.warp.Warp-Stable
… +7 lines
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
• Ran pip list | grep -i notion
└ bash: pip: command not found
• Ran python3 -m pip list | grep -i notion
└ (no output)
• Explored
└ Search *mcp* in ..
Search *notion* in ..
List ..
Search *notion* in Scripts
• Ran notion_mcp --help
└ bash: notion_mcp: command not found
• Ran mcp-notion --help
└ bash: mcp-notion: command not found
• Explored
└ Search *notion* in ~
List notion-mcp
Read package.json
■ Conversation interrupted - tell the model what to do differently
› You have access to the Notion MCP through Docker as defined in your config file.
• Explored
└ Search *codex* in ~
List .codex
Read config.toml
Search notion in .codex
• Ran docker mcp gateway run --help
└ Docker MCP Toolkit's CLI - Manage your MCP servers and clients.
… +7 lines
--watch Watch for changes and reconfigure the gateway (default true)
• Explored
└ Read config.yaml, docker-mcp.yaml
Search notion in docker-mcp.yaml
Search notion in docker-mcp.yaml
Read docker-mcp.yaml, registry.yaml
List mcp
• Ran docker mcp --help
└ Docker MCP Toolkit's CLI - Manage your MCP servers and clients.
… +7 lines
version Show the version information
• Ran docker mcp client --help
└ Docker MCP Toolkit's CLI - Manage your MCP servers and clients.
… +5 lines
ls List client configurations
• Ran docker mcp tools --help
└ Docker MCP Toolkit's CLI - Manage your MCP servers and clients.
… +7 lines
list List tools
• Ran docker mcp tools list --format json
└ [
{
… +7 lines
}
]
• Ran docker mcp tools call --help
└ Docker MCP Toolkit's CLI - Manage your MCP servers and clients.
Usage: docker mcp tools call
• Ran docker mcp tools call --help --verbose
└ Docker MCP Toolkit's CLI - Manage your MCP servers and clients.
Usage: docker mcp tools call
• Ran docker mcp tools inspect notion:API-post-search --format json
└ tool notion:API-post-search not found
• Ran docker mcp tools list | head
└ 193 tools:
- API-create-a-comment - Notion | Create comment
… +6 lines
- API-patch-block-children - Notion | Append block children
- API-patch-page - Notion | Update page properties
(We stop here because the next command actually succeeds and the model begins taking action.)
Additional information
- Environment hints (from the session): macOS (Warp terminal), no local
pipin PATH for the session, fresh shell. docker mcphelp output was accessible, confirming the Docker MCP Toolkit was installed.- First successful Notion interaction observed after discovery:
docker mcp tools call API-get-selfreturned the Notion bot profile for workspace. - Hypothesis (discovery): Codex CLI currently prioritizes local executables and file heuristics before honoring Docker MCP entries in
config.toml. When no local binaries are present, it doesn’t automatically fall back to the Docker MCP gateway.
12 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I've reviewed the linked issues and can confirm this report is not a duplicate.
The key difference is the stage at which the failure occurs:
My bug occurs at a more fundamental step in the process, before the failures described in the other issues could even happen.
I found this issue too, I think it has something to do with model reasoning ability, because after I switched model to gpt-5-high(before was gpt-5-codex-high), it never happens again
It seems they changed it so the only models available are
There's no reasoning level anymore!
Actually when you switch it, it would show up options to select reasoning level, and you can set it in ~/.codex/config.toml with “model_reasoning_effort = "high"”
Ah, you're right. I am on gpt-5-codex with high reasoning. I'll try the non-codex version. Thank you!
There are two separate things here:
Let's keep this issue focused on the first. The behavior for what the model will do in that sitaution is not something tangible to focus on in this PR but something I'll take to our research team for further discussion.
I just gave this a shot with 0.47 and had no issues using the docker mcp gateway to call the Notion MCP. Could you maybe try again?
<img width="2976" height="404" alt="Image" src="https://github.com/user-attachments/assets/9756ccb5-78e1-4bd4-873b-97a6b7013fd2" />
Understood! Thank you, I’ll try it again with 0.47.
To clarify the behavior I’m describing: the Docker MCP gateway itself does work when I explicitly tell the model to use it. It connects and can successfully call the Notion MCP. The issue isn’t that the gateway fails, but that the model doesn’t automatically recognize or use it unless explicitly instructed.
In other words, if I simply ask it to “use the Notion MCP,” it doesn’t appear to check its configured MCP servers first. Instead, it tries to locate local binaries or search the filesystem before eventually being told to use Docker. Once directed, everything works as expected.
So the gateway functionality looks fine; the concern is about discovery — how the model determines that it already has access to the MCP through its config, without needing to be told directly.
@stnwlls Could you try with 0.48? It includes some work that might help here.
Hello, I tried with 0.48 and it was not successful.
Same with 0.50:
Why don't you try using the Notion MCP directly?
It's not just Notion, Codex won't recognize any of the tools in Docker automatically.
It successfully searches it's config file first and probes deeper there, which does seem resolved from the last session, so if you'd like to close this, I would say it's resolved. Hopefully in future updates it can search deeper into Docker or other centralized containers that hold MCP servers to know what it can use.