For the ChatGPT app, see OpenAI instead. This page covers the
codex command-line tool.Prerequisites
- Codex CLI installed (installation guide)
- A HeyGen account with Video Agent access
Adding the MCP Server
Run the following command in your terminal (not inside the Codex CLI):--urlis required. Without it, Codex treats the address as a command to launch a local process rather than a remote HTTP server.- Omit the trailing slash. Codex builds the OAuth discovery path from the URL you supply, and a trailing slash produces a path that redirects rather than resolving directly.
Alternative: Direct Config Edit
You can also add the server by editing~/.codex/config.toml directly:
url. A command key registers the server as a local process and OAuth will not run. After editing, authenticate with:
Authentication
HeyGen uses browser-based OAuth, so no API key is needed. Codex opens the authorization page on first setup. If you skipped it or your session expired, runcodex mcp login heygen and complete the flow in your browser. Tokens are stored encrypted under ~/.codex/.
To sign out:
Verifying the Connection
heygen with Auth: OAuth:
codex mcp get heygen. A correctly configured server reports transport: streamable_http.
Usage
Once connected, prompt Codex with a video generation request:mcp__heygen__ prefix, covering video generation, avatar and voice creation, translation, lipsync, and asset management. Completed videos are accessible from the Projects page in your HeyGen dashboard.
Loading HeyGen Skills (Recommended)
For better prompt structure and higher-quality output, instruct Codex to read HeyGen’s prompt engineering guidelines before generating:~/.codex/skills/ setup.
Configuration Scoping
Codex stores MCP servers globally. There is no project-scoped equivalent, soheygen is available in every directory once added.

