Per-project MCP server configuration in .codex/config.toml or mcp.json (avoid wrapper scripts)

Open 💬 4 comments Opened Feb 27, 2026 by wachterjohannes

What variant of Codex are you using?

Codex CLI (with project-level .codex/config.toml)

What feature would you like to see?

I’d like first-class support for configuring MCP servers per project/directory, either in .codex/config.toml and/or via mcp.json.

Today, the current config level is not enough for workflows where MCP servers need to be started with directory-specific context. Tools like ai-mate use a per-directory MCP server model, but in Codex this is hard to express cleanly.

Current workaround: wrapper scripts that inject the project path or dynamic context before launching the MCP server. This works, but it adds setup complexity and is not a great UX.

A concrete example is this Symfony AI integration PR, which needed a wrapper-based approach:
https://github.com/symfony/ai/pull/1682

Requested outcome:

  1. Allow native per-project/directory MCP server configuration.
  2. Support this cleanly through .codex/config.toml and/or mcp.json.
  3. Remove the need for wrapper scripts in common integrations.
  4. Make MCP behavior more predictable and ergonomic across projects.

This came up in the PR discussion here (which was closed):
https://github.com/openai/codex/pull/12718
I understand why that PR was closed, but I think this use case still needs a proper configuration-level solution.

Additional information

If helpful, I can propose concrete config shape options (for example, project-scoped server entries, per-workspace overrides, or variable interpolation for the current directory) and help test them against real integrations.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗