Guides

How do I give Codex access to my production errors?

Connect an error tracker's MCP server to Codex. With Runheed, run codex mcp add with the server URL, then codex mcp login to sign in. Codex can then list, read and resolve the exceptions your app reports, and a few lines in AGENTS.md tell it to check them before it debugs. Codex gets no access to your servers.

Connect it

  1. Install the Runheed SDK in the app that throws the errors and initialize it at startup (setup by framework).
  2. Run the three commands below. codex mcp add writes the server to ~/.codex/config.toml, so every project gets it.
  3. codex mcp login opens a runheed.com sign-in page. Sign in, check the workspace and click Allow.
  4. Start a new Codex session and ask "List unresolved Runheed errors from the last 24 hours."
terminalbash
codex mcp add runheed --url https://runheed.com/api/mcp
codex mcp login runheed
codex mcp list

To edit the file yourself, the Codex setup page has the config.toml table. It also has the local server with an agent key, for machines where nobody can sign in through a browser.

Make it check errors first

The server gives Codex the tools, but Codex won't use them unless something tells it to. It reads AGENTS.md at the root of your repository before it starts work, so the instruction goes there.

AGENTS.mdmarkdown
## Production errors

Production errors from this app are in Runheed, available through the runheed MCP tools.

- Before debugging a bug report or a failing request, call runheed_search_errors or
  runheed_get_recent and read the stack trace with runheed_get_error.
- Write a failing test that reproduces the error before changing any code.
- After the fix is committed, call runheed_resolve_error with the commit hash.
- Never ignore an error unless I ask you to.

Cursor reads AGENTS.md too, and Claude Code has CLAUDE.md, so the same instructions work in all three.

Run it without a chat

codex exec runs one prompt and exits, so you can put it in a script or a scheduled job. It reads the same ~/.codex/config.toml, which means the runheed server is already there:

terminalbash
codex exec "Read the newest unresolved Runheed error, find the cause in this repository and propose a fix."

A CI runner has no browser for the sign-in. Use the local server with an agent key there, kept in a secret, as shown on the Codex setup page. The GitHub Action guide does the same job with Claude: new production errors become issues on a schedule.

Prompts to try

  • "What broke in production since the last deploy? Fix the top one and resolve it with the commit hash."
  • "Show me the stack trace, request and breadcrumbs for the newest TypeError."
  • "Did errors go up after yesterday's release?"
  • "Which errors came back after we marked them resolved?"

Questions

Can Codex read my production logs this way?
No. It reads the exceptions your app reports to Runheed, grouped and counted, with their stack traces. Log files stay where they are.
Does Codex need a key or access to my servers?
Not with the remote server. codex mcp login signs you in, and the server has no route to your machines; its tools read errors and change their status. The local server uses an agent key from Settings > Agent keys instead.
Can I keep Codex from changing anything?
Yes. Choose Read only on the sign-in consent page, or create a read-only agent key for the local server. Codex can then read errors but not resolve or ignore them.
Which languages are covered?
The SDKs cover Node.js, TypeScript and Python. Other languages and the browser report through their Sentry SDKs with a Runheed DSN, and anything else can post JSON to the ingest endpoint.
What does it cost?
Plans start at $29/month for 50,000 events a month, 3 projects and 30 days of history.

Related