Skip to main content
Use smolagents’ native MCPClient to discover Magic Hour tools, verify API authorization, and retrieve an existing image project’s status. This connection walkthrough needs no model or provider API key and submits no new generation.

Install and configure

Requires Python 3.12+ for this pinned adapter combination:
Use these tested dependency versions together. The MCP extra does not require a local model or Torch. Provide a Magic Hour API key through your secret manager as MAGIC_HOUR_API_KEY. Set MAGIC_HOUR_IMAGE_PROJECT_ID to an image project ID already saved from an accepted generation. Keep keys, account details, and signed download URLs private.

Verify access and retrieve a saved project

Save this as your application entry point and run it with Python. Hugging Face telemetry and implicit cached-token use are disabled before import. The context manager closes the MCP client.
Discovery is public, so it does not establish authorization. The account payload check verifies API access without printing private fields. This adapter unwraps structured content; validate the expected payload rather than treating any returned value as success. The project read reuses your accepted ID without another creation or generation charge. If a job is still queued or rendering, keep the same ID and retrieve it again later. Completed project metadata contains temporary download URLs; preserve them exactly, including query parameters.

Scope

The context provides named callable smolagents tools that can be supplied to your normal agent. This recipe covers direct tool-client access and completed-project metadata recovery. Model-driven tool selection, new generation, inline rendering, and binary downloads are not demonstrated here. Generation sends authorized prompts and media to Magic Hour and spends credits. Save every accepted project ID before waiting, then resume that job instead of repeating creation. See Magic Hour MCP for generation, uploads, and exact download handling, our privacy policy, and the released MCPClient source. Native validation discovered 48 callable tools, verified the account payload, and retrieved an existing completed image project with the exact saved ID. Context cleanup finished with no remaining task threads. No model, new generation, or additional credits were used. Inline media and binary downloads remain unverified.