API

Connect your agent over MCP

Claude Code, Codex, Cursor and chat apps such as claude.ai can use Staglight as tools: estimate, generate, poll and download, from the same balance as the studio.

Chat apps in under a minute

claude.ai, Claude Desktop and other chat apps with custom connectors sign in with your Staglight account (OAuth 2.1), so nobody pastes a key. You approve each app once and give it a spending cap.

Claude

Add to Claude

  1. Press the button above, or in Claude open Customize > Connectors > Add custom connector with the name Staglight and the URL https://staglight.ai/mcp.
  2. Press Continue, keep Sign in now and press Add, then sign in with your Staglight account, choose what it may do and its spending cap, then Allow. On the Free plan you can add one custom connector; on Team and Enterprise an owner adds it first and you press Connect.
  3. In a chat, press + > Connectors and switch Staglight on. Attach a product photo and ask: make me an ad for this product.

ChatGPT

  1. In ChatGPT on the web, open Settings > Plugins and press + > Add custom MCP server. It needs a Business, Enterprise or Edu workspace that allows it; on Pro it can only read.
  2. Name it Staglight, paste the URL https://staglight.ai/mcp, choose OAuth, tick I understand and want to continue, then Create as a plugin.
  3. Sign in with your Staglight account and Allow.
  4. In a new chat, type @, pick Staglight and ask for your ad.

Every connection is listed in Settings > Connections with its spending cap (any 24 hours); Disconnect ends its access at once. Tools that spend, upload or change things need the Create ads and spend credits permission; a view-only connection can read but not spend.

Server

URLhttps://staglight.ai/mcp
TransportStreamable HTTP
AuthOAuth 2.1 · Bearer <key>
Protocol2026-07-28, 2025-11-25, 2025-06-18, 2025-03-26

Create a key with a daily cap in the studio and save it as STAGLIGHT_API_KEY.

Terminal
export STAGLIGHT_API_KEY="sl_live_..."

Claude Code

One command, for every project on this computer. The shell fills in the key and Claude Code stores it in ~/.claude.json.

Terminal
claude mcp add --transport http staglight https://staglight.ai/mcp \
  --header "Authorization: Bearer $STAGLIGHT_API_KEY" --scope user

Prefer to sign in instead of using a key? Run the command without the --header part, then type /mcp in Claude Code and pick staglight to sign in with your Staglight account.

Check that it connected:

Terminal
claude mcp get staglight

To share it with a team in the repo, add .mcp.json. Each person keeps the key in their own STAGLIGHT_API_KEY.

.mcp.json
{
  "mcpServers": {
    "staglight": {
      "type": "http",
      "url": "https://staglight.ai/mcp",
      "headers": {
        "Authorization": "Bearer ${STAGLIGHT_API_KEY}"
      },
      "timeout": 600000
    }
  }
}

Name the variable STAGLIGHT_API_KEY. Claude Code leaves some credential variables with reserved names empty in remote headers, so use this one.

Codex

Terminal
codex mcp add staglight --url https://staglight.ai/mcp --bearer-token-env-var STAGLIGHT_API_KEY

Or write it by hand in the Codex config:

~/.codex/config.toml
[mcp_servers.staglight]
url = "https://staglight.ai/mcp"
bearer_token_env_var = "STAGLIGHT_API_KEY"
startup_timeout_sec = 20
tool_timeout_sec = 120

Codex stops a tool call after 60 s by default. Every tool answers in under 50 s, and get_job waits 50 s at most.

Cursor

In ~/.cursor/mcp.json for every project, or .cursor/mcp.json for one project:

~/.cursor/mcp.json
{
  "mcpServers": {
    "staglight": {
      "url": "https://staglight.ai/mcp",
      "headers": {
        "Authorization": "Bearer ${env:STAGLIGHT_API_KEY}"
      }
    }
  }
}

Claude Desktop and claude.ai

claude.ai and Claude Desktop connect by signing in with your Staglight account: see Chat apps.

If you'd rather use an API key there, bridge from your computer with the community package mcp-remote in claude_desktop_config.json:

claude_desktop_config.json
{
  "mcpServers": {
    "staglight": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://staglight.ai/mcp",
        "--header",
        "Authorization:${AUTH_HEADER}",
        "--transport",
        "http-only"
      ],
      "env": {
        "AUTH_HEADER": "Bearer sl_live_..."
      }
    }
  }
}

mcp-remote is a third-party package that runs on your computer with your key. Review it before you use it.

Tools

Paid tools take max_credits and idempotency_key. Every result has a short text, the data as JSON and, for finished files, links to download.

ToolWhat it doesCost
get_balanceBalance, the key's daily cap and what is left today.Free
buy_credits_linkLink to buy credits in the studio.Free
list_modelsModels and tools with fields and starting price.Free
estimate_costExact price of a call before you make it.Free
upload_from_urlImports a file from a direct link and returns its media id.Free
upload_fileStores a photo or short clip attached in the chat (base64, up to 12 MB) and returns its media id.Free
upload_imageSame as upload_file.Free
list_mediaUploads and results with signed links.Free
generate_imageProduct images with Nano Banana, GPT Image, Seedream or Flux.Paid
generate_videoClips with Kling, Veo, Seedance, Hailuo or Wan, plus avatars and motion control.Paid
generate_voiceVoiceover with ElevenLabs. If it fails, one retry with a similar backup voice at no extra cost (no word timings); send allow_fallback: false to get a refund instead.Paid
generate_musicBackground music with Suno.Paid
upscaleUpscales an image or a video.Paid
remove_backgroundCuts the product out (transparent PNG).Paid
add_captionsBurns word-timed captions into a video.Paid
reburn_captionsBurns captions again with edited lines or a new style, without transcribing. Free, with a daily limit.Paid
merge_videosJoins clips into one video at one aspect.Paid
clean_exportCopy without location, device, editing or AI model data; keeps an AI-generated note unless you switch it off.Paid
analyze_adGrades an ad from a file or a post link and writes new hooks and a script to remake it with your product.Paid
create_jobRuns any op from list_models.Paid
social_downloadDownloads a TikTok, Instagram, Facebook or Shorts post into your library. Free, with a daily limit.Paid
list_charactersLists your saved characters with their pictures and voice, and the character sheet price.Free
get_characterOne saved character with its pictures and voice.Free
create_characterSaves a person once (name, 1 to 3 pictures, optional voice) to cast in Script Runner scenes. Needs the likeness confirmation.Free
update_characterChanges a character's name, description, pictures or voice.Free
delete_characterDeletes a saved character.Free
make_character_sheetDraws front, side and close-up of one person from one picture. Paid, charged once.Paid
parse_scriptReads a script and shows each scene with its cast, model, length and price. Free.Free
edit_scenesEdits, removes, restores or adds Script Runner scenes before the clips are made.Paid
get_jobStatus and results, waits up to 50 s.Free
list_jobsJobs, also by idempotency_key after a timeout or by Ad Studio run.Free
cancel_jobCancels a job that has not started (refunded).Free
list_formatsAd formats with prices per tier.Free
list_productsSaved products to use in ads.Free
create_productSaves a product from its name and 1 to 8 photos, to reuse in every ad.Free
get_productOne saved product with its photo links.Free
create_adStarts a complete ad from a format. With auto it runs to the end within max_credits.Paid
propose_adProposes a format and price from a written brief.Paid
create_ad_from_briefProposes and starts the ad in one call. With auto it finishes on its own within max_credits.Paid
get_adState of an ad run, waits up to 50 s.Free
approve_ad_stepApproves a review step and starts the next ones, or hands the rest to auto mode.Paid
redo_ad_stepNew take of one item (charged again).Paid
motion_remixA new version of your own clip per character, product or style: drafts, pick, finish. Replace mode and a person or face as target need likeness: true (since 2026-10-31); the precise swap stops at step mask for your check.Paid
cancel_adStops a run and refunds jobs that have not started.Free
studio_listAd Studio studios with their cards, inputs and prices.Free
studio_estimateExact price of one Ad Studio click, with the balance. Free.Free
studio_checkRuns a studio's free checks before you pay (Ranking Shorts: every level and the variety between them).Free
studio_runMakes Ad Studio images: one charged job per image, refunded if it fails.Paid
studio_helperRuns an Ad Studio helper (a small flat price, see studio_list). link_scan reads one product page and returns its photos as your uploads, the name and a one-line description.Paid
studio_seriesA channel's series or a shop's project: what it remembers and its episodes.Free
studio_series_saveStart or change a series: its notes, what the audience asked for next, or go back to an earlier episode.Free
ad_seriesA format's series or project: what it remembers and its takes.Free
ad_series_saveStart or change a format's series: its notes, what the audience asked for next, or go back to an earlier take.Free
studio_get_runState of an Ad Studio click: every job, follow-up steps included, and the finished files.Free

Money rules for agents

  • Call estimate_cost before any paid tool. It's free and can price the exact call: tool plus arguments.
  • Send max_credits and a fresh idempotency_key with every paid call.
  • Paid tools answer at once with a job_id or run_id. Poll get_job or get_ad with wait_seconds=50.
  • After a timeout, call list_jobs with the same idempotency_key before paying again.
  • Failed jobs are refunded automatically. Out of credits, buy_credits_link gives the user a link to the studio. No payments go through MCP.
  • Give every agent its own key with a daily cap. At the cap it gets daily_limit_reached and stops.
  • With auto: true, create_ad and create_ad_from_brief approve each review step on their own while the whole run stays within max_credits. If the next step would go over, the run waits at that step with auto_stopped and nothing more is charged.

Errors

Tool errors come back as a result with isError: true and the same codes as the REST API. Out of credits includes needed, balance and topup_url. A missing or wrong key is HTTP 401 with WWW-Authenticate.

JSON
{
  "content": [
    {
      "type": "text",
      "text": "Error insufficient_credits: This needs 63 credits and the balance is 10. ..."
    }
  ],
  "structuredContent": {
    "error": {
      "code": "insufficient_credits",
      "message": "This needs 63 credits and the balance is 10. Buy credits to continue.",
      "status": 402,
      "needed": 63,
      "balance": 10,
      "charged": false,
      "topup_url": "https://staglight.ai/app/creditos?need=53"
    }
  },
  "isError": true
}

Test with curl

The server answers plain JSON over POST, with no sessions, so curl works:

Terminal
curl -s https://staglight.ai/mcp \
  -H "Authorization: Bearer $STAGLIGHT_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2025-11-25", "capabilities": {}, "clientInfo": {"name": "curl", "version": "1.0"}}}'
Terminal
curl -s https://staglight.ai/mcp \
  -H "Authorization: Bearer $STAGLIGHT_API_KEY" \
  -H "Content-Type: application/json" \
  -H "MCP-Protocol-Version: 2025-11-25" \
  -d '{"jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": {"name": "get_balance", "arguments": {}}}'

This page as Markdown · llms.txt