OpenLens MCP + Codex CLI: Integration Guide
Wire the OpenLens Model Context Protocol server into OpenAI Codex CLI with one terminal command. After that, Codex can drive AI visibility scans, fetch citations, manage topics, and schedule recurring runs against your OpenLens workspace, all without leaving the shell.
TL;DR
| Server URL | https://openlens.com/mcp |
| Transport | Streamable HTTP |
| Auth | OAuth 2.1 (browser flow) |
| Install command | codex mcp add openlens ... |
Install
Run this in any shell where the codex CLI is on your path:
codex mcp add openlens --url https://openlens.com/mcpCodex CLI stores the server in its local config. To remove later, run codex mcp remove openlens.
Complete OAuth
Start a Codex CLI session with codex. The first time you invoke an OpenLens tool, Codex opens a browser tab for the Clerk OAuth handshake. Sign in with your OpenLens account and approve. The token is cached and reused on every subsequent call.
Verify it works
From a Codex CLI session, ask:
“List my OpenLens projects.”
Codex should call list_projects and return at least one row. If the call hangs, see Troubleshooting below.
What you can do once connected
The OpenLens MCP server exposes ~40 tools across project setup, brands, topics, prompts, runs, visibility analytics, citations, workstreams, and scheduling. Useful prompts from Codex CLI:
- “Spin up a new project for Helio Labs. Brand is Helio, competitors are Sunray and Photonix. Seed 4 topics focused on solar installer SaaS.”
- “Run every active prompt for Helio across all platforms and tail the status. Write the run id to a file when it starts.”
- “What domains are most-cited for Helio over the last month? Group by domain category and rank by mention count.”
- “Schedule a daily scan for Helio at 6am UTC and stop the old weekly schedule.”
Troubleshooting
- OAuth window never opens: kill the cached token with
rm -rf ~/.mcp-auth/and trigger another OpenLens tool call. - Server not registered: confirm the entry with
codex mcp list. Re-add if missing. - Tools missing in session: exit and relaunch
codex. The CLI loads MCP servers on startup. - Anything else: email [email protected] with your Codex CLI version and the exact error.