claude -p with --mcp-config: run Sume video tools from a script

Use claude --bare -p with --mcp-config and --allowedTools to call Sume's hosted MCP tools in CI; read mcp_server_errors so an unloaded server fails the job.

5 min readSume
All posts

To run Sume's video tools from a script, use claude --bare -p with --mcp-config pointing at a JSON file that names https://mcp.sume.com/mcp, and --allowedTools to pre-approve the tools the run may call. Use an API key, because a non-interactive run cannot complete an OAuth browser sign-in, and check the mcp_servers status in the init event so a server that failed to load stops the job.

The flags come from Claude Code's headless page, read 2026-09-29. The key behavior comes from Sume's MCP OAuth and API keys docs.

What do the headless docs say about MCP?

Three facts matter for a script.

From Claude Code's headless page, read 2026-09-29.
TopicBehavior
--bareSkips auto-discovery of MCP servers, hooks and CLAUDE.md; load servers with --mcp-config
--mcp-configTakes a file or JSON; -p waits for pending servers up to MCP_TIMEOUT, 30 s by default
Skipped entriesA url entry with no type is skipped; the init event lists it in mcp_server_errors

What does the config file contain?

Give the entry an explicit type, since the docs say an entry with a url and no type is skipped. The key travels as a header; keep the file out of version control or generate it in the job from a secret.

{
  "mcpServers": {
    "sume": {
      "type": "http",
      "url": "https://mcp.sume.com/mcp",
      "headers": { "x-api-key": "REPLACE_WITH_SUME_API_KEY" }
    }
  }
}

What is the command?

MCP tools are named mcp__<server>__<tool>. Allow only the read-only checks first; add paid tools once dry_run is part of the prompt.

claude --bare -p "Call mcp_health on Sume and report the auth source." \
  --mcp-config ./sume-mcp.json \
  --allowedTools "mcp__sume__mcp_health,mcp__sume__tools_list" \
  --output-format json

How do I keep an unattended run from overspending?

Pre-approving a paid tool removes the prompt, so the limits have to be in the request. Tell the run to send dry_run=true first and to pass max_spend_usd and an idempotency_key on every paid call. Claude Code's JSON output also reports total_cost_usd, but that is a client-side estimate of model usage, not the Sume bill.

For a video wait that outlasts one call, the run should repeat jobs_wait on the same job ids after wait_slice_expired and not create a new job.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume