Agents
MCP server
| Property | Value |
|---|---|
| Endpoint | https://<your-host>/api/mcp |
| Transport | Streamable HTTP (stateless, JSON responses) |
| Protocol version | 2025-11-25 (also 2025-06-18, 2025-03-26, 2024-11-05) |
| Auth | Authorization: Bearer aio_…, the same API key as the REST API |
Claude Code#
claude mcp add --transport http pixwellai https://<your-host>/api/mcp \
--header "Authorization: Bearer aio_..."Run /mcp inside Claude Code to confirm the server is connected. For local development against next dev the URL is http://localhost:4200/api/mcp.
Claude Desktop#
Settings → Connectors → Add custom connector works for servers that do not need a header. For key-based auth, add the server to claude_desktop_config.json through the mcp-remote bridge:
{
"mcpServers": {
"pixwellai": {
"command": "npx",
"args": [
"-y", "mcp-remote", "https://<your-host>/api/mcp",
"--header", "Authorization: Bearer ${AIO_KEY}"
],
"env": { "AIO_KEY": "aio_..." }
}
}
}Cursor and other clients#
Clients that speak Streamable HTTP natively take the URL and headers directly:
{
"mcpServers": {
"pixwellai": {
"url": "https://<your-host>/api/mcp",
"headers": { "Authorization": "Bearer aio_..." }
}
}
}Tools#
| Tool | Effect | What it does |
|---|---|---|
get_balance | read-only | Team, role and credit balance, with a low-balance flag and top-up link. create_generation also reports the balance after each charge. |
search_templates | read-only | Natural-language request (“make my dog dance”) → top template matches with a short description, cost and what each needs. |
list_templates | read-only | Paginated templates. query, kind, category, sort (default | popular | newest), limit (10, max 50), cursor. |
get_template | read-only | What a template needs (prompt, photos and what each shows, durations, ratios), its fixed cost and an example call. |
list_models | read-only | Paginated models. query, kind, family, task, limit (10, max 50), cursor. Compact items with default cost and inputs. |
get_model | read-only | Full params spec, pricing explained (formula, default cost, cost per option) and an example call. |
estimate_cost | read-only | Credits for a model/template + params, and whether the balance covers it. |
upload_from_url | writes | Import a public https image/video/audio link into storage; returns an asset URL for images / inputs. |
create_generation | spends credits | Template + images, or model + prompt + params. Waits up to 50 s (wait). idempotency_key makes retries safe. |
get_generation | read-only | Status, outputs and error for one generation. |
list_generations | read-only | The team's generations, newest first, paginated (10 per page). |
Every tool declares MCP annotations (readOnlyHint, idempotentHint, destructiveHint, openWorldHint), so clients can auto-approve the read-only ones and ask before create_generation spends credits.
Compact results
Each result has a one-line summary the model can act on, followed by compact JSON. The same JSON is sent as structuredContent for clients that support it. Lists return 10 items by default and never dump the whole catalog: follow next_cursor only when you need more.
{
"content": [{
"type": "text",
"text": "Top 3 for “make my dog dance”: macarena-dance – Macarena Dance (video, 80 credits; 1 photo) | …\n\n{\"object\":\"list\",…}"
}],
"structuredContent": {
"object": "list",
"query": "make my dog dance",
"data": [
{ "slug": "macarena-dance", "title": "Macarena Dance", "kind": "video", "credits": 80,
"description": "Video template in Dancing Dogs.", "needs": "1 photo", "preview_url": "https://…" }
],
"has_more": false,
"next_cursor": null
}
}A typical agent flow
search_templates { "query": "make my dog dance", "kind": "video" }
get_template { "slug": "macarena-dance" } → needs 1 photo, costs 80
upload_from_url { "url": "https://example.com/rex.jpg" } → { "url": "https://cdn…/uploads/….jpg" }
create_generation { "template": "macarena-dance",
"images": ["https://cdn…/uploads/….jpg"],
"idempotency_key": "6f1c…" } → succeeded / processing
get_generation { "id": "…" } → only if still processingcreate_generation and long jobs
create_generation waits up to 50 seconds by default, which covers most image models. Video often takes longer: the tool then returns the generation with status processing and the agent should call get_generation later. Pass "wait": false to return immediately. Pass an idempotency_key (any unique string): if the client retries the call, the original generation is returned and nothing is charged twice.
Errors
Failures come back as tool results with isError: true and the same { error: { code, message, hint } } body as the REST API, so the model can read the hint and correct itself (for example, choose a valid aspect ratio). Moderation blocks are explained the same way and are never charged.
Rate limits and cost
Each tool call counts toward the key's 60 requests per minute. Agents spend real credits: use a dedicated key, and consider a separate team with a capped balance for experiments.Raw protocol#
The server is plain JSON-RPC 2.0 over POST, so you can test it without an MCP client:
curl https://<your-host>/api/mcp \
-H "Authorization: Bearer $AIO_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call",
"params":{"name":"list_models","arguments":{"task":"image-to-video","limit":5}}}'- Supported methods:
initialize,notifications/initialized,ping,tools/list,tools/call. - No sessions and no SSE stream;
GET /api/mcpreturns 405. Batched requests are accepted.