Give Codex Real-Time Web Search with MCP Tools
Codex CLI is good at understanding and generating code, but it works from a fixed snapshot of the world. Real-time web search via MCP gives it the ability to check the current state of things before acting — without interrupting your terminal workflow.
Why This Matters
The Model Context Protocol gives Codex a structured way to call external tools mid-task. When you add a search MCP server, Codex can decide on its own when a search would be useful and call it without being explicitly told to. That’s different from you pasting documentation into the prompt — the agent is actively pulling in what it needs.
For coding workflows, this is most useful when you’re working with fast-moving libraries, troubleshooting obscure errors, or trying to understand the current state of a spec or standard. Codex can search Google or Bing, parse the results, and use them to inform its next action.
Setup
Add AgentPatch to ~/.codex/config.toml:
[mcp_servers.agentpatch]
url = "https://agentpatch.ai/mcp"
bearer_token_env_var = "AGENTPATCH_API_KEY"
Then set your API key:
export AGENTPATCH_API_KEY=your_api_key
Replace your_api_key with your actual key from the AgentPatch dashboard. Codex discovers all AgentPatch tools automatically on next start.
Example
You ask Codex to help with a deployment issue:
“Our GitHub Actions workflow is failing with a deprecation warning about
set-output. Fix it.”
Codex searches to confirm the current recommended syntax:
Searching Google for "GitHub Actions set-output deprecated replacement 2025"...
`set-output` was deprecated in 2022 and removed in 2024. The replacement is
writing to $GITHUB_OUTPUT:
echo "name=value" >> $GITHUB_OUTPUT
Updating your workflow file now...
Codex found the current guidance, understood the change, and applied the fix. If it had relied on training data alone it might have suggested the old syntax — or been uncertain which version of the change was relevant.
The same flow works for things like checking whether a Docker base image still has active support, or verifying a specific API’s current rate limit before writing code that depends on it.
Wrapping Up
One MCP config block gives Codex access to real-time web search and every other tool AgentPatch offers. It’s a low-effort way to make your Codex sessions more accurate for anything time-sensitive. More tools and details at agentpatch.ai.