Skip to main content

Magic Hour MCP and API integration guide

Connect Magic Hour to MCP clients or the API, authenticate safely, upload media, monitor projects, and understand credits.

Choose MCP or the API

  • MCP: connect your AI client to Magic Hour to create images, video, and audio.

  • API: call Magic Hour directly from your application using HTTPS requests and an API key.


​
​

Media-generation MCP

The current hosted media-generation MCP address is:

https://mcp.magichour.ai/

Its current tool catalog includes supported image and video creation, music generation, source-file uploads, project retrieval, and download links. You can also turn text into speech and clone voices you have permission to use.
​
​

Connect from Claude web or desktop

  1. Open Settings, then Connectors.

  2. Add a custom connector.

  3. Enter https://mcp.magichour.ai/.

  4. Add the connector, then select Connect.

  5. Sign in to Magic Hour if asked, then select Allow on the authorization page.

  6. Verify real API authorization by asking Claude to call get_account_info. A returned credit balance confirms the connector can use the Magic Hour API.

Follow the current instructions at magichour.ai/mcp. Treat the API key like a password because MCP requests can spend account credits.
​
​

Claude Code: media-generation MCP

For media creation rather than documentation lookup, use the hosted media server with bearer authentication. The official setup command supports --header:

claude mcp add --scope user --transport http magic-hour https://mcp.magichour.ai/ --header "Authorization: Bearer YOUR_MAGIC_HOUR_API_KEY"

Replace the placeholder with your own API key only in your local client configuration; never send the key in a support message or commit it. If substituting a shell environment variable instead, double quotes allow expansion; single quotes send the variable name literally. Start a new Claude Code session and ask it to call get_account_info to confirm API access without generating media. A successful public tool listing or ping alone does not prove authorization. Do not generate or repeatedly retry paid media just to test the connection. Follow the official media-generation MCP setup. The documentation-only server below is a different connection.

Cursor: media-generation MCP

Set MAGIC_HOUR_API_KEY in the environment Cursor uses. Add this server to your user mcp.json and restart Cursor if it was open before the variable was set.

{
  "mcpServers": {
    "magic-hour": {
      "url": "https://mcp.magichour.ai/",
      "headers": {
        "Authorization": "Bearer ${env:MAGIC_HOUR_API_KEY}"
      }
    }
  }
}

VS Code: media-generation MCP

Run MCP: Open User Configuration from the Command Palette, then add this configuration. Enter your key in the masked prompt when the server starts.

{
  "inputs": [
    {
      "type": "promptString",
      "id": "magic-hour-api-key",
      "description": "Magic Hour API key",
      "password": true
    }
  ],
  "servers": {
    "magic-hour": {
      "type": "http",
      "url": "https://mcp.magichour.ai/",
      "headers": {
        "Authorization": "Bearer ${input:magic-hour-api-key}"
      }
    }
  }
}

If you already added a Docs MCP server called Magic Hour, remove or rename that entry. Start the media server and ask it to call get_account_info to verify authorization without spending credits. Then ask it to make the image, video, or audio you need.

Documentation MCP

For API reference and code examples, connect Magic Hour API Docs at https://docs.magichour.ai/mcp. It searches the docs. For image, video, or audio creation, use the media-generation connection above.

API setup

  1. Sign in and open /developer.

  2. Create an API key.

  3. Store it in a secret manager or environment variable.

  4. Send it as a Bearer token.

Authorization: Bearer YOUR_MAGIC_HOUR_API_KEY

The production API base address is:

https://api.magichour.ai

Never place a secret key in client-side code, screenshots, public repositories, or support messages.
​
​

If an API key was exposed

Creating a replacement key does not revoke an existing key, including a Quickstart key. If a key appeared in a screenshot, repository, or message, remove the exposed key explicitly:

  1. Sign in and open Developer Hub → API Keys. Match the intended key by its name and last four characters.

  2. Select its trash icon (Delete API Key), then confirm Delete key. Check that the key disappears from the list. Deleting it disables that key for subsequent API authentication; it does not cancel jobs already accepted.

  3. Create a replacement, save it when shown, and update the affected integrations or environment variables. Keep it private; never send either key to support.

If deletion fails or you cannot identify the exposed key, contact support with the key’s name or last four characters and the error, without sharing the secret. A request to revoke a key is not confirmation that it has been revoked.

​

Current API coverage

Video creation

Documented routes include AI Talking Photo, AI Video Editor, AI Video Translator, Animation, Audio to Video, Auto Subtitle, Character Replace, Face Swap, Image to Video, Lip Sync, Text to Video, Video to Video, and AI Video Upscaler.
​
​

Image creation and editing

Documented routes include AI Clothes Changer, Face Editor, GIF Generator, Headshot Generator, Image Editor, Image Generator, Image Upscaler, Meme Generator, QR Code Generator, Body Swap, photo Face Swap, Head Swap, Background Remover, and Photo Colorizer.
​
​

Audio

Documented routes include AI Voice Generator, AI Voice Cloner, and AI Music Generator.
​
​

Project management

The API includes routes to retrieve and delete video, image, and audio projects. Creation requests generally return a project ID. Use the matching project-details route or a configured webhook to follow completion.

See the current API reference overview for exact request fields and endpoint pages.
​
​

Uploading files

For API and MCP workflows that need source media:

  1. Request an upload URL.

  2. Upload the image, video, or audio bytes to that URL.

  3. Pass the returned file path to the creation request.

Do not pass raw media bytes as an MCP text argument. Follow the upload tools exposed by the connected server.
​
​

Credits and billing

  • API and media-generation MCP requests use the connected Magic Hour account. Supported API integrations may serve paying end users, subject to the Terms of Service and commercial-use requirements. Keep API keys private; this does not permit sharing account credentials or reselling account access.

  • Supported creation responses include the project ID and charged credits.

  • Cost varies by tool and options. Use the API credit estimates or the matching MCP estimate tool to check a request before generating. Estimating uses no credits and does not confirm plan access or your balance.

  • Review current account billing and the endpoint documentation rather than relying on one universal MCP or API price.

Magic Hour does not publish one consolidated universal table for every rate, concurrency limit, upload limit, polling interval, or download-link lifetime. Use endpoint-specific documentation and current account prompts. Do not promise an undocumented limit.
​
​

Troubleshooting MCP

  • Connection fails: confirm the exact server address and that the client supports HTTP MCP connections.

  • Authorization fails: for Claude connectors, reconnect and complete sign-in and Allow. For API-key clients, create a current key and relaunch the client with its bearer-token configuration. Never paste the key into chat.

  • Ping works but generation fails: check the tool input, account credits, and returned error.

  • Upload fails: request a new upload URL and use the returned file path.


​
​

Troubleshooting the API

Send support the endpoint, request time, response status, returned message, project ID if available, and a redacted request example. Remove the Authorization header and all secrets first.
​
​

401 or 402: check the error before buying credits

401 Unauthorized is an authentication error, not evidence that you need to buy more credits. Check that the key is valid and loaded into the deployed server environment. An SDK token value contains the key itself; raw HTTP requests use Authorization: Bearer YOUR_MAGIC_HOUR_API_KEY. Never paste the key into a support message. Follow API authentication troubleshooting.

​

For 402, read the structured error code and message. Insufficient credits, a required subscription, and an upgrade-required setting are different conditions. Buying credits alone does not unlock subscription-only models or resolutions. If Image-to-Video reports that Auto Reload is processing, check the API account balance and wait until it covers the request before resubmitting. Send support the redacted response if the reason remains unclear, without changing purchases or deleting a project just to troubleshoot.

​

Official references


​
​

A timeout does not mean the generation stopped

Creation and completion are separate events. If the creation response returned a project ID, retain it and use the matching project-details endpoint or configured webhook to check completion. Download only after the project reports completion and output URLs are available.

If a project create request timed out before you received an ID and originally included an Idempotency-Key, retry the same request with the same key within 24 hours. If you did not send a key or 24 hours have passed, check request logs, project history, and any configured webhook before resubmitting. Adding a key to the retry cannot recover the original request. If the outcome is still unknown, contact support with the endpoint, approximate time, redacted request details, and any request or project identifier.

Use the current API reference for exact status values and response fields. Never include your API key in a support message.

Did this answer your question?