MCP servers in Codex are configured once and shared everywhere. The Codex CLI, Codex Desktop, and the IDE extension all read the same
~/.codex/config.toml, so adding Context7 in one place enables it in the others. See the Codex MCP documentation for more details.Installation
Run the setup command to configure Context7 for Codex:~/.codex/config.toml and AGENTS.md. You can choose between CLI or MCP mode. Login uses the OAuth device flow — it shows a verification link and short code you open on any device, so it works the same locally or on a remote, headless, or SSH host.
Create or manage API keys in the Context7 dashboard. For manual configuration or other clients, see All MCP Clients.
Codex surfaces
Codex CLI
The local coding agent that runs in your terminal. Add Context7 with
codex mcp add or by editing config.toml.Codex Desktop
The Codex app for macOS and Windows. Enable Context7 from the app’s MCP settings, or rely on the shared
config.toml.Codex Cloud
The web-based agent that runs tasks in cloud environments. Add Context7 to the tools for an environment from the Codex web app.
Codex CLI
Add Context7 from the terminal with thecodex mcp add command:
~/.codex/config.toml (use a project-scoped .codex/config.toml for trusted projects):
Codex Desktop
The Codex app (macOS and Windows) shares the same MCP configuration as the CLI and IDE extension. Enable Context7 from the app’s MCP settings, or add it to~/.codex/config.toml using the snippets above — it’s picked up automatically.
Codex Cloud
Codex Cloud delegates tasks to OpenAI’s agent in managed cloud environments, so they can run in the background without your local machine. Each environment defines the repo, setup steps, and tools Codex uses — configure Context7 as part of an environment from the Codex web app. Cloud environments also have configurable internet access, which Context7 needs to reach the documentation API.Using Context7
Withctx7 setup, a skill is installed that triggers automatically when you ask about libraries. You can also invoke it explicitly:
AGENTS.md file:
AGENTS.md
Tips
Getting Better Results
Getting Better Results
- Be specific about what you’re trying to do, not just which library
- Mention versions when they matter
- If the first result isn’t right, ask for a different part of the docs
Startup timed out or program not found
Startup timed out or program not found
If you see a startup “request timed out” or “not found program” error, increase
startup_timeout_ms to 40_000 and retry. On Windows, point command at the absolute npx.cmd path and set SystemRoot and APPDATA explicitly — npx requires them, but some Codex MCP clients don’t set them by default.