View raw

Codex CLI#

Connect ClipKit to OpenAI Codex — the codex terminal agent — so it can author and preview ClipKit videos while it codes.

Two ways to use ClipKit#

Codex is a coding agent, so it can work with ClipKit two ways — call ClipKit's hosted MCP tools, or write code against ClipKit's npm packages right in your repo. Both are first-class; pick by where you want the video to live.

MCP tools (hosted)npm packages (code)
Wire-upcodex mcp add clipkit --url …npx @clipkit/cli init in your repo
The agentcalls tools (add_element, preview_still, render_video)edits a video.ts Source, runs clipkit validate / render
Your video isscratch state on clipkit.dev, shareable by linka video.ts in your repo — version-controlled, reviewable
Installsnothing@clipkit/cli, @clipkit/protocol, @clipkit/runtime
Best forquick authoring, preview stills inlinevideos that live in your codebase, CI renders, reuse

They're not exclusive — wire the MCP tools for fast iteration and keep finished videos as code. New to ClipKit? Start with the connector (Option A) — it's zero-install.

Option A — hosted MCP connector#

codex mcp add clipkit --url https://www.clipkit.dev/mcp

Or hand-edit ~/.codex/config.toml:

[mcp_servers.clipkit]
url = "https://www.clipkit.dev/mcp"
# optional — bump these if a cold start is slow:
startup_timeout_sec = 20
tool_timeout_sec = 120

Verify the connector#

codex mcp list should show clipkit with its URL. Start codex, run /mcp (or ask it to list MCP tools), and confirm the ClipKit tools appear.

Option B — npm packages (code)#

No MCP server involved — Codex writes ClipKit code directly in your project. Scaffold once:

npx @clipkit/cli init my-video
cd my-video && npm install

That pins @clipkit/cli, @clipkit/protocol, and @clipkit/runtime, writes a starter video.ts (a plain, typed Source object), and drops an AGENTS.md that Codex auto-loads as authoring context. Then ask Codex to:

  • edit video.ts — typed by @clipkit/protocol, so the schema drives its edits;
  • npx clipkit validate video.ts — the same Zod check the runtime and the MCP server run;
  • render@clipkit/renderer locally, or POST the Source to the hosted API.

Add @clipkit/patterns for prebuilt scene and data-viz units, @clipkit/lint for soft checks. Full walkthrough: Quickstart.

Notes#

  • Default connector timeouts are 10s startup / 60s per tool. If a cold start or a slow tool times out, raise startup_timeout_sec / tool_timeout_sec.
  • On older Codex builds, remote URL servers are gated behind a top-level key — add experimental_use_rmcp_client = true above the [mcp_servers.clipkit] block (not inside it), or just update Codex.
  • A CLIPKIT_API_KEY (Settings → API keys) is only needed for the paid render path in Option B (clipkit render / the hosted render API), never by the connector — the hosted server is open.

New to the tools? The MCP server overview has the full tool list and how projects work.