Connect AI Agents (MCP)
Let Claude Code, Codex, Cursor, and other MCP clients generate images and videos through EggAPI
EggAPI runs a remote Model Context Protocol server. Any MCP client that supports Streamable HTTP can list models, start image and video tasks, and read their results with your API key. Usage is billed to the key's account exactly like POST /v1/generate.
| Setting | Value |
|---|---|
| Endpoint | https://api.eggapi.ai/mcp |
| Transport | Streamable HTTP |
| Auth header | Authorization: Bearer YOUR_API_KEY |
Create a key in the dashboard and export it first:
export EGGAPI_API_KEY="egg_..."
Client Setup
Claude Code
claude mcp add --transport http eggapi https://api.eggapi.ai/mcp \ --header "Authorization: Bearer $EGGAPI_API_KEY"
Codex
Add to ~/.codex/config.toml:
[mcp_servers.eggapi] url = "https://api.eggapi.ai/mcp" bearer_token_env_var = "EGGAPI_API_KEY"
Cursor and other clients
Add to your client's mcp.json:
{
"mcpServers": {
"eggapi": {
"url": "https://api.eggapi.ai/mcp",
"headers": { "Authorization": "Bearer <EGGAPI_API_KEY>" }
}
}
}Step-by-step setup with a key generator is also on eggapi.ai/connect.
Tools
| Tool | Arguments | Returns |
|---|---|---|
list_models | kind? (image or video) | Model IDs with kind, generation_type, unit_price_usd, unit_price_by_resolution, and the tool that runs each one. |
generate_image | model, prompt, images?, negative_prompt?, aspect_ratio?, resolution?, num_outputs?, parameters?, nsfw_filter? | A task_id. images holds the source image URLs for edit models. |
generate_video | model, prompt, duration, image?, negative_prompt?, aspect_ratio?, resolution?, parameters?, nsfw_filter? | A task_id. image is the first frame URL for image-to-video models; duration is required. |
get_task | task_id | status (pending, processing, completed, failed), done, output urls, cost, and error. |
The agent's workflow is:
- Call
list_modelsto pick a valid model ID. - Call
generate_imageorgenerate_video. It returns atask_idimmediately; the output is not ready yet. - Poll
get_taskevery 5 to 15 seconds untildoneistrue. Images usually finish within a minute; videos usually take one to three minutes.
Tasks created over MCP also appear in GET /v1/tasks and in your usage records.
Dynamic UI tools
The same server also provides get_ui_catalog, render_ui, update_ui, get_ui_state, set_ui_values, and run_ui_action: the agent composes a form page from a short JSON description, the user fills it in inside the conversation (clients that support MCP Apps) or in a browser, and the agent reads the result to continue. See Dynamic UI.
Workflow Skills
For complete workflows on top of these tools, such as e-commerce image sets, ad creatives, and short films, install the ready-made workflow skills.