This page is about the MegaLens connector inside your coding tool. To review pull requests, use the GitHub Action.
Integrations/Codex CLI

MegaLens + Codex CLI

A check on what Codex CLI writes, before it reaches your git history. Reviewers from different AI companies check your code, and a second AI check confirms the quoted line appears in the code you sent.

How it works

1

Write code in Codex CLI

Use Codex CLI as your primary coding environment. Write, edit, and iterate as you normally would.

2

Ask Codex for a MegaLens review

Review my latest changes with MegaLens. If you cannot access them, ask me to paste the code.

3

MegaLens reviews your code

Standard is the default. Each result shows which model and setting ran.

4

A judge checks each finding against the code

A finding is marked quote-matched only when the quoted line appears in the code you sent. Otherwise it is marked unconfirmed or disputed.

5

Codex CLI receives the structured result

The result includes findings, severity levels, and a fix roadmap. Codex reads the findings and decides what to fix.

Setup

The quickest way is the one-command setup. It configures Codex CLI and asks before updating your global AGENTS.md file.

Setup command
npx megalens-mcp setup codex

You can also add the configuration and AGENTS.md lines yourself:

~/.codex/config.toml

Codex configuration
[mcp_servers.megalens]
url = "https://megalens.ai/api/mcp?ide=codex"
http_headers = { "Authorization" = "Bearer ml_tok_your_token_here" }

~/.codex/AGENTS.md

Add these two lines to ~/.codex/AGENTS.md (or $CODEX_HOME/AGENTS.md if you set CODEX_HOME). These lines tell Codex when to offer a MegaLens review and limit it to one offer per task.

Instructions for Codex
Offer a MegaLens review at most once per task, even if the task has both a plan and code changes. Skip the offer if the task came from a MegaLens fix prompt or the user says “just fix it” or otherwise asks you to proceed without a review. After changing code that handles money, sign in, user data or database migrations, you can offer a review before the user commits. Wait for the user to say yes before running an offered review. You can run a review the user asks for directly or has already asked you to run automatically.
You can also offer a MegaLens review before a decision that is hard to undo, a new project or deep research. Follow the same rules for offers and permission. Skip small questions and routine edits.

Get your token at megalens.ai/app/settings/mcp. Source: github.com/megalens/mcp.

Good to know

A few things to keep in mind before your first review.

1.

MegaLens runs when you or Codex ask for a review. For every pull request, add the GitHub Action.

2.

Looks for bugs that change what your app does, not formatting: logic, security and behaviour bugs.

3.

A review takes a few minutes and checks the code and context your tool sends.

4.

You stay in control. MegaLens reports what could break, and you decide what to change.

Pricing

Standard reviews

Free to start

3 reviews free, no card. Applies to Standard reviews. Then 5 credits for $2.99.

Plus, Pro and Max

Monthly plans

Plans: Plus $19 a month for 20 credits, Pro $69 a month for 80 credits, Max $199 a month for 250 credits. Or pay as you go at $1.25 a credit, from $5. A Standard review uses 1 credit and a Deep review uses 8. Cancel any time.

How model costs are paid

On a plan, credits come with it every month. Otherwise, pay as you go with credits that never expire. See all plans and rates

Check Codex CLI code before it reaches git history.

Add one config block and get independent reviews from different AI companies.