Codex MCP setup for rConfig: connect OpenAI Codex CLI to your network configs
OpenAI’s Codex CLI connects to rConfig’s MCP server over Streamable HTTP, reading the bearer token from an environment variable. For teams on OpenAI models it is the way to use rConfig with an agent, because ChatGPT can’t connect.
Best for: OpenAI-based teams, terminal work, scheduled checks on a server or CI runner.
Connect
Add rConfig to ~/.codex/config.toml, then set the variable in the environment Codex runs in:
[mcp_servers.rconfig]url = "https://<your-rconfig-server>/mcp"bearer_token_env_var = "RCONFIG_MCP_TOKEN"default_tools_approval_mode = "writes"export RCONFIG_MCP_TOKEN="..."codex mcp add rconfig --url https://<your-rconfig-server>/mcp creates the table too, but has no flag for the token, so add bearer_token_env_var by hand. The MCP server page is the reference for the connection settings.
Check it: run codex mcp list, or /mcp inside a session, and confirm rconfig and its eight tools.
Approvals
default_tools_approval_mode = "writes" makes Codex prompt only for tools that aren’t marked read-only. rConfig marks all seven of its tools read-only (the MCP readOnlyHint), so they run without stopping. Two related settings for the same table:
enabled_toolsanddisabled_toolslimit which rConfig tools Codex loads, if you want a narrower agent.tool_timeout_sec(default 60) is ample: rConfig’s config search stops itself after about five seconds.
Things to ask
- Estate search: “Using rConfig, find every device with
ip http serverin its latest config. Read each matched line, becauseno ip http servermatches too, and list only the devices where it’s enabled.” - Script against reality: “Write a Python script that exports every device in the Branch group with its last backup time. Check the field names against rConfig’s
get_devicesoutput first.” - Explain history: “Show the last five config versions of
edge-fw-02in rConfig and summarise how its NAT rules evolved.”
Run it unattended
codex exec runs a prompt without the interactive interface, so a cron job or CI pipeline can produce a report. Use a token for a dedicated rConfig user scoped to the devices the job covers, and keep the approval mode at writes so read-only calls don’t wait for a person.
Data handling
Tool results, including configs with secrets obfuscated, go to OpenAI’s models as part of the conversation. Check that your OpenAI agreement suits your configuration data before connecting production devices.
Related reference
- Connect an AI agent over MCP
- Which AI agents can connect to rConfig?
- ChatGPT and Claude on the web
- Find devices exposed to a security advisory
Frequently asked questions
How do I connect OpenAI Codex to rConfig?
Add an [mcp_servers.rconfig] table to ~/.codex/config.toml with url set to https://<your-rconfig-server>/mcp and bearer_token_env_var set to the name of an environment variable holding your rConfig MCP token.
ChatGPT can't connect to rConfig. Can I still use OpenAI models?
Yes. Codex CLI runs on your machine or server and sends rConfig's bearer token, which ChatGPT's connectors can't. It's the supported route for teams on OpenAI models.
How do I stop Codex prompting for every rConfig tool?
Set default_tools_approval_mode to writes for the rconfig server. That mode only prompts for tools not marked read-only, and every rConfig tool is marked read-only.