#Codex IDE, devcontainer, MCP
1 messages ยท Page 1 of 1 (latest)
Codex IDE doesn't seem to pick up my MCP definitions in config.toml, but it might be because I haven't logged out and in for a while? Codex CLI seems to recognise them when I install them via the CLI. This indicates the IDE extension just hasn't picked them up yet. Does tihs sound correct?
Also, I'm not sure if I should attempt to use VSCode's "MCP Servers - Installed" UI for managing my MCP servers for Codex. I installed the Resend MCP server which showed up in that panel, but I'm not sure if anything is using it. I also have a MCP server definition in my toml file. Maybe the VSCode panel is mainly for Copilot usage?
I want to use Chrome DevTools MCP Server, but also don't want it to spin up a new Chrome window each time, I want it to connect to my long-running tab. Since I'm using a devcontainer and have an existing tab, I think I need to manage the ports for both the server and the tab.
Has anyone successfully used this kind of workflow and have any wisdom on how it needs to be configured? My searches are showing a lot of stuff about each of these things but not all together...
Maybe I can boil this down to a few key questions:
- When running in a devcontainer, should I expect Codex to pick up the MCP servers I install in VSCode the "Copilot" way? Or do I need to install them specifically within Codex CLI?
- Any tricks to getting Codex IDE (not CLI) to pick up MCP servers from the devcontainer? Do I need to open ports for them to work?
Any insights here would be a great start. Thanks.
Need to know a few things:
- Host Operating System
- Are you utilizing host<->guest volumn mounts? For example:
{
"name": "My Dev Container",
"image": "debian:bookworm-slim",
"mounts": ["source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached", "source=/home/zdgmivrxtmxd/.cargo,target=/home/vscode/.cargo,type=bind"
]
}
Hey there!
- MacOS
- I can just share the devcontainer definition files since there's nothing particularly sensitive in there. I have a volume mount for the container but I'm not sure if it's what you are referring to. You can see I have quite a few forwarded ports. (You may also be able to tell I had some help from AI to create the first version of this).
Giving the dockerfile a txt extension so you don't need to download it.
Good choice! This'll be an easy fix!
In your docker-compose.dev.yml, add the following volume:
- ~/.codex:/root/.codex
If that doesn't work try
- /Users/<insert username>/.codex:/root/.codex
What that does is it bind mounts your host codex configs (and all the other stuff like global AGENTS, rollout logs, authentication) into the container. Otherwise since it's not mounted, every time you start up the container it creates that folder internally. It probably asked you to log in when you launched the container the first time, despite being logged in outside the container, which would be proof that the container cannot access your host configs.
So I did a container rebuild and restart just now (before applying the change) and realised that yep, my codex config got obliterated because it's all local inside the container. So when I add your suggested change, I think what you're saying is it'll use a host folder which will be populated by the container first time I rebuild, but will then retain across builds? Because I currently have no codex installation on the host as such.
When that persists, Codex should find my MCP defs at login and across builds I guess. But it still won't use the ones that VSCode has built into its extensions panel. Those seem to be completely alien to Codex.