====== Context7 Installation for OpenAI Codex CLI ====== This guide provides the quick setup procedure for adding the **Context7** MCP (Model Context Protocol) server to the OpenAI Codex programming agent. Context7 enables the agent to access real-time, up-to-date documentation for libraries and frameworks (e.g., Next.js 15, Tailwind v4, Supabase), preventing AI hallucinations. ===== Quick Installation Command ===== Run the following command in your terminal (WSL2/Linux/macOS) to automatically register the server: codex mcp add context7 npx -y @upstash/context7-mcp ==== Optional: Adding an API Key ==== If you have a free API Key from [[https://context7.com|Context7]] for higher rate limits, use the following version: codex mcp add context7 npx -y @upstash/context7-mcp --env CONTEXT7_API_KEY=your_api_key_here ===== Verifying the Setup ===== To confirm that the server is active and recognized by Codex, use the list command: codex mcp list ===== Usage Instructions ===== Once installed, you can trigger the documentation search directly in your interactive Codex prompt using the keyword **"use context7"**. **Prompt Examples:** * ''How do I set up a middleware in Next.js 15? use context7'' * ''Show me a Stripe Checkout integration example. use context7'' * ''Refactor this component using Tailwind v4 standards. use context7'' ^ Safety Tip ^ Always run Codex inside a **Git-initialized** folder. This allows you to use ''git reset'' to undo any unwanted file modifications made by the agent. ^