I’ve been switching between Codex and Claude lately quite a bit for my side project, rippleroom.net, even though for some reason I keep Claude as my go-to for most stuff. But when I run out of tokens I remember about Codex, which is being quite good for me.
Nevertheless, Claude’s configuration flexibility seems to be a whole other level.
My last experience with this has been trying to keep an MCP configuration scoped to the project.
Rippleroom exposes an MCP so that agents can post about their considerations and decisions as they go along during the implementation, in a way to facilitate the surfacing of knowledge which otherwise would die buried in the agent’s conversation history.
For example, this is a test message the agent posted after I managed to configure the MCP connection in Codex.
Enough with the preamble. TIL that .gitignored paths are not carried over into the new worktree, so if you have a project-specific MCP configuration with credentials it won’t be available in your worktree’d session. This was a bummer for me as I’m dogfooding Rippleroom and try to have my agents regularly post updates.
I settled on direnv after a bit of research. Here’s how you do it.
1. Install direnv
On a mac, brew install direnv. If you use zsh like I do, you also need to append the following to your ~/.zshrc.
# direnv
eval "$(direnv hook zsh)"
2. Configure your MCP
This in your project-specific .codex/config.toml:
[mcp_servers.rippleroom]
url = "https://app.rippleroom.net/api/mcp/rippleroom/rippleroom"
bearer_token_env_var = "RIPPLEROOM_BEARER_TOKEN"
http_headers = {
X-Rippleroom-Harness = "codex",
}
required = true
A couple of things to notice. bearer_token_env_var is a built-in property for HTTP MCP server configuration in Codex. You use it to specify the bearer token, of course. RIPPLEROOM_BEARER_TOKEN is the name of a shell env variable I came up with.
3. Configure the .envrc file
Put an .envrc file inside the project directory as well.
export RIPPLEROOM_BEARER_TOKEN="export RIPPLEROOM_BEARER_TOKEN="rrct_Wh4t3V3rT0k3nY0un33dH3r3!"
4. Enable direnv
Finally, direnv allow . to make sure direnv is active in your project director.
You are good to go now. Fire up your codex and inspect your mcp configuration (/mcp). It’ll show your correctly configured MCP, scoped to a project. Needless to say, this was waaay easier with Claude Code where you can just pass in a --scope option to your mcp config flags.
Bonus content!
As I was writing this blog post, I noticed dev teams are independently adding support to a .worktreeinclude file (here or here) that’s supposed to help you carry over gitinored files into new worktrees.
I wonder whether support for this will land officially in Git.
See ya!
Leave a Reply