MCP Server
Connect Claude Code, or Codex to MachGen and generate from your AI agent.
MachGen runs a remote MCP server, so an AI assistant can generate images and video, edit past generations, and browse your history directly - no copying prompts between windows.
https://mcp.machgen.aiAuthenticate with the same API key you would normally use. Create one under
Settings -> API keys; it looks like MGA_<key_id>:<secret>.
Claude Code
claude mcp add --transport http machgen https://mcp.machgen.ai \
--header "Authorization: Bearer MGA_<key_id>:<secret>"Run /mcp inside Claude Code to confirm the server shows as connected. The
command saves the configuration without checking the credential, so a bad key
shows up as failed here rather than at setup time.
Codex
To make both CLI and UI work, add the following to ~/.codex/config.toml:
[mcp_servers.machgen]
enabled = true
url = "https://mcp.machgen.ai"
[mcp_servers.machgen.http_headers]
Authorization = "Bearer <API_KEY>"What you can ask for
Once connected, ask in plain language - the assistant picks the tools:
- "What video models can do 1080p at 16:9, and what would 5 seconds cost?"
- "How much balance do I have left?"
- "Generate a product shot of a ceramic mug on a linen backdrop."
- "Make that warmer and move the mug left."
- "Animate it for 5 seconds with a slow push-in."
- "Save 1.25s through 3.75s of that video as a new clip."
- "Quote the exact cost, then upscale that video to 4K."
- "Download the finished audio as a file I can reuse."
- "Give me a link I can send to the team."
How generation works
Generation is asynchronous. The generate and upscale tools return a task_id
right away and the assistant polls get_task until it finishes - images in
seconds, video usually in minutes. You will see it check back a few times; that
is expected.
When an image or video completes, supported chat clients render it inline in a compact media card with native video controls. Images also include vision content, so the assistant can inspect the result and iterate instead of describing it blind. A time-limited download link remains available as a fallback for clients that do not support rich MCP Apps.
Video upscaling has a separate workflow. The assistant first reads the available
UPSCALE target tiers and engines, quotes the exact price for your owned source
video, submits only after the quote, and polls the returned task. You can point
it at a prior task id or MachGen asset URL; source resolution, frame rate, and
duration are resolved by the server. Some UPSCALE surfaces accept only sources
generated by specific models and tiers - list_models reports this as the
surface's source_requirement (MiniMax H3's 2K regeneration takes only its own
768p outputs); any other source is rejected.
Tools
| Tool | What it does |
|---|---|
list_models | Available models with their exact sizes, aspect ratios and durations |
get_price | What a generation would cost on your account, before you run it |
check_balance | Your account's current spendable balance |
generate_image | Text-to-image, or image-to-image with sources |
generate_video | Text-, image-, reference-, or video-to-video |
generate_audio | Speech, dialogue, sound effects, or music |
extract_video_clip | Save an exact subsection of an owned video as a reusable video, preserving audio |
edit_image | Edit a previous generation by task id |
quote_video_upscale | Exact cost to upscale an owned completed video to a supported tier |
upscale_video | Submit that source-aware video upscale |
get_task | Poll a task; attaches the image or video for inline preview when done |
get_task_params | The exact settings a past task used, to re-run with one change |
list_history | Your past generations |
get_asset | A finished asset's media preview, URL, size, and image vision bytes |
download_asset | A finished image, video, or audio as embedded bytes or a raw HTTPS download manifest |
create_asset_link | A shareable link that works without signing in |
Asset links
Every finished generation has a stable URL:
https://www.machgen.ai/api/v0/assets/<task_id>That URL requires your credentials, so it opens in your signed-in browser but
not for anyone else. To share a result, ask for a link - create_asset_link
mints a time-limited URL (24 hours by default, up to 7 days) that works without
signing in. It grants read access to that one asset and nothing else, so it is
safe to paste into a message; your API key never leaves your machine.
To save or reuse the actual file, ask the assistant to download the asset.
download_asset embeds files up to 8 MiB directly in the MCP result with their
filename and MIME type. Larger files return a time-limited raw HTTPS download
manifest without loading the whole file into the API server or injecting a
video/audio URL into model context. The assistant saves it with its local file
capability using the returned filename. Every path checks ownership and
preserves the stored file type, original bytes, and filename. Clients that
explicitly support MCP resources can still read the separately advertised
machgen://assets/<task_id> resource, but downloads do not depend on automatic
resource handling.
Rate limits
MCP calls draw on the same per-user budget as the REST API, so heavy tool use and heavy API use share one allowance.