Use Medux MCP in Codex
Connect the hosted Medux MCP server to OpenAI Codex and call its media tools from your prompts.
Before you start
Tools use the shared Medux credits system. See pricing.
Codex CLI (npm i -g @openai/codex) or the Codex IDE extension, already signed in.
Step-by-step setup
Get your API key
Sign in at medux.io/account/api-keys and create a key. It looks like sk-medux-.... Copy it once and store it safely.
Add Medux MCP to Codex
The remote MCP endpoint is the same for every tool: https://mcp.medux.ai. Medux hosts it, so there is nothing to install or run locally.
Codex reads MCP servers from ~/.codex/config.toml. First export your key so it isn't stored in the file:
export MEDUX_API_KEY="sk-medux-..." # add to ~/.zshrc or ~/.bashrc to persist
Then add the server. Open ~/.codex/config.toml (create it if missing) and append:
[mcp_servers.medux]
url = "https://mcp.medux.ai"
bearer_token_env_var = "MEDUX_API_KEY"
If your Codex version doesn't support bearer_token_env_var, use a static header instead (the key will then live in the file):
[mcp_servers.medux]
url = "https://mcp.medux.ai"
http_headers = { "Authorization" = "Bearer sk-medux-..." }
Alternatively, add it from the CLI:
codex mcp add medux --url https://mcp.medux.ai --bearer-token-env-var MEDUX_API_KEY
Restart Codex after editing the config. The CLI and IDE extension share the same file.
Verify the connection
Start Codex in the folder holding your videos and check the server is loaded:
codex mcp list
Inside a Codex session, type /mcp to list connected servers and their tools — medux should show as enabled.
You should see tools prefixed with medux_, for example:
| Tool | Purpose |
|---|---|
medux_text_to_image | Generate an image from a text prompt. |
medux_video_generate_text_to_video | Generate a video from a text prompt. |
medux_speech_create_audio | Convert text to speech. |
medux_file_create_upload_url | Get a signed upload URL and file_id so local files can be used as input. |
medux_task_query | Check an async task by task_id and get the result URL. |
Browse every tool in the MCP overview.
Use it from a prompt
Just ask in natural language and mention Medux so the agent picks the right tools:
Use Medux to generate a 1024x1024 image of a red fox in watercolor style.
Use Medux to turn this text into speech: "Welcome to Medux." Give me the audio link.
Use Medux to remove the background from photo.png in this folder.
Under the hood the agent chooses a medux_* tool and fills in its parameters. For a local file it first calls medux_file_create_upload_url, uploads the file with an HTTP PUT to the returned upload_url using the returned content_type, and passes the file_id to the tool. Most tools run as async tasks, so the agent polls medux_task_query until the task completes and then shows you the result URL.
Troubleshooting
| Symptom | Fix |
|---|---|
| 401 Unauthorized | The key is missing or wrong. Re-copy it, confirm the Bearer prefix, and make sure any environment variable is set in the shell that launched Codex. |
No medux_* tools listed | Restart Codex, run codex mcp list, and check config.toml for TOML typos. Remote HTTP servers need a recent Codex release — update with npm i -g @openai/codex@latest. |
| Local-file upload fails | Upload URLs expire. Request a fresh one and send the exact content_type returned. |
| Insufficient credits | Top up or upgrade on the pricing page. |
Next
Using the other client? Read the Claude Code setup guide, or browse all tutorials.