REST API reference

StemSwell MCP for Claude Code and Codex

Connect your assistant to StemSwell to upload audio, compare tools, estimate credits, run jobs and download results. This is a remote Streamable HTTP server on the existing API backend. You do not install a package or run a local server.

Before you connect

Create a dedicated API key in Account. Set a spend budget for the key and choose limits you are comfortable with. Use a separate key for each assistant so you can revoke one without affecting your other integrations. Jobs use your account credits and the same plan limits as the website.

The endpoint is:

https://api.stemswell.com/mcp

Infrastructure identifiers and the wf_ key prefix stay unchanged.

Claude Code

Add the server once in your terminal. Replace the placeholder with your API key:

claude mcp add --transport http --scope user stemswell https://api.stemswell.com/mcp --header "Authorization: Bearer wf_replace_with_your_key"

Open Claude Code and use /mcp to check the connection. You can also run claude mcp get stemswell. User scope makes the integration available across your projects. The header is stored in your private Claude configuration. Keep that file private. The command above includes a secret in the process arguments and may enter your shell history. For environment-based configuration, add the following entry to your project's .mcp.json configuration:

{
  "mcpServers": {
    "stemswell": {
      "type": "http",
      "url": "https://api.stemswell.com/mcp",
      "headers": { "Authorization": "Bearer ${STEMSWELL_API_KEY}" }
    }
  }
}

Preserve the other entries in your configuration and approve the project server when Claude Code prompts. Set STEMSWELL_API_KEY in the environment before launching Claude Code. Do not commit a key into project files. See the official Claude Code MCP documentation for HTTP transport, authentication headers, environment expansion and scope.

Codex

Add this entry to ~/.codex/config.toml:

[mcp_servers.stemswell]
url = "https://api.stemswell.com/mcp"
bearer_token_env_var = "STEMSWELL_API_KEY"

Set STEMSWELL_API_KEY in the environment used to start Codex. The configuration stores the variable name, so the key itself stays out of the TOML file. For example, read the key without adding it to shell history:

# Bash
read -rs -p 'StemSwell API key: ' STEMSWELL_API_KEY
export STEMSWELL_API_KEY
codex
# PowerShell 7
$env:STEMSWELL_API_KEY = Read-Host 'StemSwell API key' -MaskInput
codex

Restart Codex after changing the configuration or environment. Use /mcp in Codex to check the tools. This uses bearer-token authentication; there is no OAuth login step. See official OpenAI documentation for MCP for remote server configuration and bearer_token_env_var.

Tools and a careful workflow

ToolPurpose
list_audio_toolsAvailable tools, parameters and baseline credit prices
get_accountAvailable and reserved credits, plan and current key budget
list_uploadsReusable finalized uploads
prepare_uploadSigned PUT target and, for larger files, a resumable initiation URL
finalize_uploadVerify upload completion and actual audio duration
estimate_jobAuthoritative quote for exact inputs and parameters, without running
start_jobSubmit a job after checking billed credits against your maxCredits
list_jobsFind existing work and avoid duplicate submissions
check_jobStatus, charged credits, errors and output paths
wait_for_jobWait up to 20 seconds in one call and return the latest status
get_result_downloadA short-lived link for one job output
  1. Check your account and key budget. Stop if either is low or exhausted. A null budget or apiKeyBudget means reporting is unavailable, not unlimited. Stop, or rely on an authoritative estimate_job decision before spending. Inside a known budget, null individual caps (monthlyLimitCredits, maxJobCredits, remainingCredits) mean unlimited. The apiKeyBudget aliases cap, perJobMax and remaining use the same individual-cap meaning.
  2. Compare tool prices and choose the cheapest tool that meets your needs.
  3. Look for a reusable upload or job result before uploading again.
  4. Estimate the exact job and approve the cost before starting. Set maxCredits to the highest billed cost you authorize, in credits. chargeCredits is the actual amount your account will pay; credits is the published tool quote. Longer jobs require separate approveOverage: true approval.
  5. Save the returned job ID, then check or wait for that job. A wait timeout means the job is still running. It does not mean you should submit another job.
  6. Download an output using its exact returned path. Reuse the link until expiry.

The server checks a fresh estimate before start_job and refuses to start if the quote is missing, canRun is false, or chargeCredits exceeds maxCredits. It uses only the estimate's top-level credits, chargeCredits, canRun, requiresOverageApproval and rejection fields for this decision, rather than inferring permission from reporting budgets. Missing or invalid cost and approval fields fail closed without submitting a job. The API enforces key and account spend limits at reservation time. Estimates do not reserve credits, so a budget can change before submission. A rejected job is a reason to stop and reassess. Never retry an uncertain submission automatically; use list_jobs to reconcile it first. The server does not deduplicate separate submissions for you. Each MCP request has one 45-second application deadline starting when the API handler receives it, before its parsing, authentication and SDK initialization. Estimates are capped at 15 seconds to allow uncached audio probing. Submission is capped at 40 seconds and uses at most the remaining request time minus three seconds reserved for the reply. Other REST calls are capped at 10 seconds within the same request budget. This leaves room to return explicit errors before the domain's 60-second Hosting proxy limit; Hosting also counts cold starts and platform parsing before the application deadline begins, so that headroom is not guaranteed. The API function itself retains its 120-second limit. An estimate timeout or failure returns estimate-unavailable and explicitly states that no job was started. Its cause retains the API rejection code and message so you can correct parameters, authentication or an unfinished upload. If the deadline expires before submission is sent, request-deadline-exceeded explicitly states that no job was started. A submission timeout returns submission-uncertain, because the upstream job may already exist. A timeout, connection failure or invalid response can happen after credits are reserved. The resulting submission-uncertain error means the job may already exist, so check existing jobs before deciding whether another submission is needed. Prices are in credits, not a fixed dollar conversion.

Example request for your assistant:

Find the cheapest way to normalize this WAV for streaming. Reuse an upload if it already exists, estimate the job, and ask me before spending any credits.

Uploading local files

A remote MCP server cannot open a file on your computer. prepare_upload returns an assetId and signed URLs; your assistant needs local file and HTTP access to send the bytes directly to Storage. Audio bytes never pass through MCP.

For a small file, send a PUT to uploadUrl with the exact Content-Type used in prepare_upload. For a large file, send a POST to resumableUrl with that Content-Type and x-goog-resumable: start, then upload chunks to the returned Location. Call finalize_upload only after the upload succeeds. Treat upload, session and download URLs as temporary credentials; do not send them to others. See the REST upload walkthrough for chunking, recovery and the emulator's different method behavior.

Troubleshooting

  • Unauthorized: check the API key environment and whether the key was revoked. Restart the client after correcting its environment.
  • Estimate unavailable: the cost estimate endpoint must be deployed before paid MCP jobs can start. No job is submitted when this check fails. Read the cause for parameter, authentication, role or upload errors you can correct.
  • Deadline before submission: no job was started. Obtain a fresh estimate before authorizing another attempt.
  • Budget or credit limit: stop. Review your budget or balance in Account before authorizing more work.
  • Upload not finalized: finish the direct upload and call finalize_upload.
  • Download denied: pass an output path from that job's check_job response.
  • Submission uncertain: call list_jobs and check the existing job before deciding whether to retry. Do not retry automatically.

To disconnect, run claude mcp remove stemswell or remove the Codex TOML entry. Revoke the dedicated key in Account to disable its use everywhere.