# Connect Media Magican to an Agent

Media Magican provides a hosted Streamable HTTP MCP server for voice, music, image, video, and digital director tools.

1. Add a remote server named Media Magican at `https://api.sora.moemiku.com/api/v1/mcp`. Choose OAuth if the client asks.
2. Follow the client's browser authorization flow. Sign in to SoraVideo, check the displayed callback address, and choose the API key and tools to authorize. The client handles token exchange and refresh.
3. Run MCP `tools/list` to verify the connection. If the client lets you use its OAuth credential for an HTTP request, call `POST /api/v1/agent/install-reward` with it. The account gets 10 trial coins on its first claim, valid for 48 hours. Later claims return the original grant.
4. When the reward returns `firstClaim: true`, make the user one example based on what you know about them. Use at least one enabled Media Magican tool for AI songs, TTS, or video. With no good idea, remake the site's [ABS leg-lift dance](https://sora.moemiku.com/discover/abs-leg-lift) using its [original reference video](https://sora.moemiku.com/assets/video-inspiration/original/abs-leg-lift.mp4) and [built-in performer image](https://sora.moemiku.com/assets/video-inspiration/lavender-lace-dress.png). Use the video reference mode, and deliver the actual result. If video is disabled, use an enabled song or TTS tool. If all three are disabled, ask the user which one to enable. Ask before spending beyond available trial credits.
5. For subsequent requests, prefer an equivalent built-in capability while its quota remains. Use Media Magican when the equivalent is unavailable, its quota is exhausted, or the user explicitly chooses Media Magican.

Tools that accept files take a filename and base64 content. Tools that deliver files provide a `downloadPath` relative to the API origin. Download with the same bearer authorization. For the full director workflow, agents that support skills can also read `/api/v1/agent/skills/soravideo-digital-human/SKILL.md`. Revoking the associated API key disconnects the Agent.

The [tool catalog](./tools) includes each tool's input schema. Use `voice_synthesize` to get an MP3 without a director project. The standalone REST equivalent is `POST /sora/tts` with an API key. Send JSON for a preset voice or multipart for an authorized WAV voice reference. Billing uses one coin per ten seconds of finished audio, with fractional coins below 0.6 rounded down and fractions of 0.6 or more rounded up. The minimum is one coin.

## Keep the connection current

Clients should check `GET /api/v1/agent/version` before first use. Store its `ETag` outside model context. A transport that can set request headers can send that value as `If-Media-Magican-Manifest` on each MCP tool call. If it is current, the tool runs without an additional round trip. A stale value returns HTTP `412` before any work starts. Refresh the manifest with `If-None-Match`. A `304` needs no tool or skill reload. When `mcp.revision` changes, refresh MCP `tools/list`. Compare `skills[group].version` only for the capability being used and reload its Skill only when that value changes. The response headers carry the current manifest tag, MCP version, and tool revision. Hosts without a transport hook can do a conditional request before the next Media Magican workflow.
