适合谁?
适合需要为 STDIO MCP 服务生成 Codex TOML 配置的用户。
配置路径和示例
~/.codex/config.toml
[mcp_servers."filesystem"]
command = "npx"
args = ["-y", "@modelcontextprotocol/server-filesystem", "./"]安装步骤
1
Create an mcp_servers table
Each MCP server gets its own TOML table under mcp_servers.
[mcp_servers."filesystem"]
command = "npx"
args = ["-y", "@modelcontextprotocol/server-filesystem", "./"]2
Use command and args
STDIO MCP servers need a command plus args array.
3
Alternatively use Codex CLI
You can add a server with codex mcp add.
codex mcp add filesystem -- npx -y @modelcontextprotocol/server-filesystem ./4
Restart Codex
Reload the CLI or IDE session after changing config.toml.
常见问题
Unquoted server name
If the server name contains special characters, quote it in the TOML table.
Args not an array
Codex expects args as a TOML array, for example ["-y", "package"].
FAQ
Where do I put Codex MCP config?
Use ~/.codex/config.toml globally, or .codex/config.toml in a project.
Can I generate TOML automatically?
Yes. Use the MCP config generator and choose Codex.