VidMage MCP in Codex lets you create images and videos from a Codex task using plain requests. To set it up, add the VidMage server to Codex's config.toml file with your API key, restart Codex, confirm the connection in a new task, and then ask Codex to price, generate, and save your first asset. Codex picks a fitting VidMage capability, gets a quote before any credits are consumed, and downloads the finished file into your working folder.

What You Need to Set Up VidMage MCP in Codex

What you need

Why it matters

An active VidMage subscription with credits

MCP access runs on an API key, and VidMage only issues working keys to subscribed accounts. Every generation draws from the same balance you use on vidmage.ai.

The Codex app, signed in

Codex calls the VidMage tools for you. Your Codex usage and your VidMage credits are billed separately.

A Mac with Terminal

The setup below uses Terminal and TextEdit. Step 3 also gives the Windows file location.

A folder Codex can write to

Codex saves the finished file in the task's working folder and needs your approval to run the download command.

How to Connect VidMage MCP to Codex

Step 1: Sign in to the VidMage Developer Console and open API keys in the left sidebar. Click Create API key, type a name, such as Codex MCP, and click Create key. VidMage displays the full key one time only, so copy it right away and keep it in a password manager or another private place. Codex reads the key from a settings file, which means it never has to appear in a chat. You can check out how to create your vidmage api key to learn how to create your API keys.

VidMage Developer Console name and create API key for Codex

Step 2: In the same console, click MCP connections and stay on the Codex tab. The card shows the block Codex needs and the file it belongs in, ~/.codex/config.toml.

Click Copy configuration. The note under the template says the key creation dialog also generates a ready-to-copy Codex configuration, so if you copied that version in Step 1, your key is already in it.

VidMage Developer Console MCP connections Codex tab copy configuration

The template looks like this:

[mcp_servers.vidmage]
url = "https://vidmage.ai/api/mcp"
http_headers = { Authorization = "Bearer YOUR_API_KEY" }
enabled = true
required = false
startup_timeout_sec = 30
tool_timeout_sec = 120

required = false lets Codex open normally even when VidMage cannot be reached. The two timeout lines here show how long Codex waits for the server to start and for each tool call to answer.

Step 3: Codex keeps its MCP servers in a plain-text file named config.toml inside a hidden .codex folder in your home folder. The Codex app, the Codex CLI, and the IDE extension all read this same file, so one entry works everywhere.

Press Command + Space, type Terminal, press Return, and run these lines one at a time:

mkdir -p ~/.codex
touch ~/.codex/config.toml
open -e ~/.codex/config.toml

The first two lines create the folder and file if they don't exist yet, and the third opens the file in TextEdit.

IMPORTANT: If you see a formatting toolbar, choose Format > Make Plain Text before you paste.

Move to the end of the file, paste the block, and swap YOUR_API_KEY for your real key. Leave Bearer and the single space after it exactly as they are, and keep the straight quotation marks. Press Command + S to save, then run this line so only your Mac account can read the file:

chmod 600 ~/.codex/config.toml

On Windows, the file is at %USERPROFILE%\.codex\config.toml.

If you have set a custom CODEX_HOME, use the config.toml inside that folder instead. VidMage signs you in with the key in this file, so you do not need to run codex mcp login.

If the codex command works in your Terminal, codex mcp get vidmage prints the saved entry with the key masked. That confirms Codex can read the file, but it does not prove VidMage accepts your key.

Step 4: Quit Codex completely with Command + Q, open it again, and start a new task. In the new task, send this message:

Check my VidMage MCP connection. Use the vidmage MCP server to call list_capabilities with a limit of 3 and show me the capability names it returns. Don't upload or generate anything. If the server or tool isn't available, tell me instead of trying another route.

Codex calls the tool and reports that the connection succeeded, followed by three capability names, such as Photo Face Swap, Photo Head Swap, and Multiple Face Swap. Your names or their order may differ, and that's fine. Any list that comes back from VidMage means Codex reached the server with your key. To see every connected server at a glance, type /mcp in the Codex composer.

Codex VidMage MCP connection check with list capabilities

Generate and Save Your First Image in Codex

Step 5: Give Codex a real job, and ask for the price before anything gets made. Describe the image, its purpose, and the settings you want:

I need a homepage hero image for an independent coffee roaster: an unbranded coffee bag and a ceramic cup on a light stone counter, soft morning window light, warm natural colors, and clear space on the right for a heading. No text, logos, people, or watermark.

Use VidMage MCP to find a text-to-image capability that fits, check its supported inputs, and estimate the credits for one 16:9 PNG at 1k. Show me the capability, the settings, and the exact quote. Don't generate anything yet.

Codex browses VidMage's image capabilities, reads the current rules for the one it picks, and requests an estimate. For a brief like this one, it may choose Grok AI Image Generator, since that model supports 16:9, PNG, and a 1k tier. The reply lists each setting next to the exact quote, which is currently 10 credits for one Grok image at 1k.

Ask Codex to show you the final generation prompt so you can review it before approving the charge.

VidMage MCP exact credit quote and supported settings in Codex

Step 6: Once the quote looks right, approve it and tell Codex where the file should go:

Generate one image with the quoted prompt and settings, for up to 10 VidMage credits. Save it as outputs/coffee-roaster-hero.png in this task's working folder. Keep the task ID, check that same task until it finishes, and download the completed result. Verify that the file exists, then show me the image and where it's saved. Don't submit another generation if the download or preview needs a retry.

Codex submits the task once and holds on to the task ID that VidMage sends back. While VidMage reports the task as running, Codex waits the interval VidMage suggests, about 10 seconds for an image like this, and then checks the same task again. When the task completes, Codex runs the download command VidMage provides, confirms the file on disk, and shows you a preview with the file details.

If Codex asks for approval to run a command or write to the folder, go ahead and approve it.

Codex shows saved VidMage image with verified size and dimensions

The saved PNG from this request:

Coffee roaster hero image generated with VidMage MCP in Codex

Step 7: To see the charge for yourself, open the Developer Console and select the task in your recent tasks. Task details list the capability, a billing status of recorded, the credits charged, and the task ID. That ID matches the one Codex kept in Step 6, so you can tie the charge to the exact request.

VidMage Developer Console task details with recorded billing and task ID

How to Use VidMage MCP for AI Video Generation in Codex

The same entry gives Codex access to VidMage's video capabilities, so AI video generation in Codex follows the same process: quote, approve, then generate and save. A first request could look like this:

Use VidMage MCP to find a text-to-video capability for a 6-second 16:9 clip at 720p of steam rising from a fresh pour-over coffee. Show me the supported settings and the exact quote. Don't generate anything yet.

NOTE: Video costs more and takes longer than an image. For example, Grok Video Generator currently charges 10 credits per second in text-to-video mode, so a 6-second clip comes to 60 credits, and a clip often needs a couple of minutes.

Give Codex a credit limit that matches your requirement, and name an .mp4 file when you approve. Mention camera movement in your description too, such as a slow push toward the cup.

VidMage MCP Codex Troubleshooting

What you see

Likely cause

What to do

Codex doesn't list any VidMage tools

Codex hasn't reloaded its settings, or config.toml has an error

Check for one [mcp_servers.vidmage] section, the exact URL, enabled = true, and straight quotes. Quit with Command + Q, reopen Codex, and test in a new task.

An authentication error

The placeholder is still there, Bearer is missing, or the key was revoked

Make sure the header reads Bearer, one space, and your full key. For a revoked or lost key, create a new one, update the same section, and restart Codex.

An access or subscription error

The VidMage subscription isn't active

Confirm your subscription in your VidMage account. A valid key alone doesn't grant MCP access.

Terminal says codex: command not found

The Codex CLI isn't on your Terminal's path

This doesn't mean the app connection failed. Skip the optional check and use the Step 4 test in the app.

The connection times out

Your network, VPN, proxy, or firewall blocks the server

Check your internet connection and make sure nothing blocks https://vidmage.ai/api/mcp.

Generation doesn't start

A setting the model doesn't support, a prompt outside its length limit, or too few credits

Ask Codex to show the estimate and the capability's rules, then adjust the request or add credits.

The image finished, but no file appeared

Codex didn't get permission to run the download command or write to the folder

Approve the command or folder access, and ask Codex to download the same task again. Don't submit a new one.

PUT IT INTO PRACTICE

Try it in VidMage

Open the tool and follow the steps above.

Open Developer resources ↗