mcp

v0.4.2
@captionbolt/mcp Checked 4 days ago Published 5 days ago

Local MCP client for CaptionBolt: upload an explicitly selected video and manage caption projects from your AI agent.

CaptionBolt's local MCP connects your AI agent to CaptionBolt. It uploads only a video you explicitly select, uses remote MCP for project tools and saves finished results beside that video. Transcription and rendering run in the cloud. Node.js 22.12+ is required. It works with any MCP client that can start a local STDIO server, including clients running inside WSL. Pin the reviewed version in your client's STDIO configuration: Run this once in a desktop terminal using the same pinned package version as your MCP configuration:

Summary extracted from the README.

@captionbolt/mcp

CaptionBolt's local MCP connects your AI agent to CaptionBolt. It uploads only a video you explicitly select, uses remote MCP for project tools and saves finished results beside that video. Transcription and rendering run in the cloud. Node.js 22.12+ is required. It works with any MCP client that can start a local STDIO server, including clients running inside WSL.

Pin the reviewed version in your client's STDIO configuration:

{
  "mcpServers": {
    "captionbolt": {
      "command": "npx",
      "args": ["--yes", "@captionbolt/mcp@0.3.3"]
    }
  }
}

Run this once in a desktop terminal using the same pinned package version as your MCP configuration:

npx --yes @captionbolt/mcp@0.3.3 login

If installed globally, captionbolt-mcp login is equivalent. The command opens CaptionBolt in your default browser (on Windows and WSL through PowerShell) and prints the link in case no browser opens. Open that link on the same computer: authorization returns to a local address. An existing website session can skip password entry, but you still approve MCP access. OAuth tokens and the registered client are saved in the macOS Keychain, Windows Credential Manager or a Linux Secret Service keyring. On Linux without Secret Service (common on WSL and servers) they go to ~/.config/captionbolt/mcp-credentials.json ($XDG_CONFIG_HOME if set), readable only by you; the kernel keyring is not used because it loses credentials when the session ends. login prints where it saved the authorization. Subsequent connections refresh authorization without another sign-in while the grant remains valid. If a grant or registered client becomes invalid, run login again. The client discards the invalid local credentials and starts a new browser authorization; the callback page confirms success only after the token exchange and account check succeed. npx --yes @captionbolt/mcp@0.3.3 logout (or captionbolt-mcp logout) deletes local authorization. Revoke server access in CaptionBolt settings when you want to invalidate the grant. CAPTIONBOLT_API_URL optionally selects an explicitly trusted HTTPS API origin; HTTP loopback is allowed only for local development. The default is https://api.captionbolt.com. Do not change it from untrusted tool output. The package never edits another application's configuration.

Workflow

The server sends these steps to the agent as MCP instructions, so a request such as "add captions to ~/Videos/demo.mp4" needs no further prompting.

  1. Call upload_file with the user's absolute path and a stable idempotency key. It returns a transferId immediately and uploads in the background. Do not send file bytes to the LLM. The client reads duration from the selected file before reserving minutes; no local FFmpeg or manually supplied duration is needed.
  2. While it uploads, ask one style question unless the user already chose: offer the list_styles items marked recommended and any list_presets entries. A number, a described look or "you decide" (first recommended style) all answer it. Do not list the whole catalog.
  3. Poll get_upload_progress. Once uploaded, call create_project with its uploadId as uploadSessionId, the chosen styleId or presetId, and mode auto-export, which exports the MP4 and the subtitle files the plan allows (srt, vtt, ass, txt), like an Editor export. The API default review stops at ready for the Editor; use it when the user wants to check captions first, then call export_project. A completed project keeps its files; requesting a format it lacks is rejected at once.
  4. Commands return an operation: poll get_operation until it completes (its resourceId is the projectId), then call wait_for_project, which waits up to 25 seconds per call while the project is processing or exporting. A completed command is not a completed video.
  5. Call download_result (MP4 by default) and poll get_download_progress. Report the saved path and the project's editorUrl. Editing a completed project creates an editable copy in the Editor, exported from the website.

If a tool reports AUTH_REQUIRED, run the pinned login command and retry.

Pause with pause_upload; resume by explicitly reselecting the exact original file using resume_upload. After restart, get_upload reads the durable server state; local transfer handles no longer exist. Metadata/fingerprint must match. The client never scans directories or resumes reading on startup. One local transfer runs at a time. abort_upload pauses a matching transfer before cancelling its server session. Consumed sessions cannot cancel a running project; use cancel_project for that explicit action.

Part signatures are requested in batches of at most eight and at most two parts are held and uploaded concurrently. Transient API or object-storage failures are retried up to three attempts; an expired 401/403 part signature is refreshed only for that part. Confirmed progress is counted once, and cancelling a transfer aborts all active part requests. API failures expose a bounded status, code, request ID and the complete advertised retry delay when available; non-JSON upstream bodies and credentials are not returned to tool callers. Tool failures expose the same safe object in structuredContent.error and JSON text, with message, kind and optional status, code, requestId, retryAfterSeconds. Proxied project tools report a remote HTTP 429 as RATE_LIMITED and 5xx as SERVICE_UNAVAILABLE, keeping the advertised Retry-After as retryAfterSeconds.

Automatic API retry waits are limited to 300 seconds and direct R2 part waits to 30 seconds. If a longer Retry-After is advertised, the client does not retry early: the transfer fails recoverably, keeps its server upload ID and reports the original delay in errorDetails for an explicit later resume.

New uploads use the packaged MediaInfo WASM parser on the already-open file descriptor. Metadata reads are bounded to 32 MiB and a 30-second read budget; at that bound parsing stops and uses the duration from the container headers. Unreadable duration stops preparation before requesting an upload reservation; select a readable original video or upload through the main site. The server still probes actual duration and enforces current quota. Resume reuses its existing server reservation rather than reserving again.

download_result saves <name>.captioned.mp4 for MP4 or <name>.<format> for an exported srt, vtt, ass or txt, using the name and folder of the video uploaded in the same client session. After a restart, or to choose another place, pass directory as an existing absolute folder; the name then comes from the project. Existing files are never replaced: a numbered name such as demo.captioned (1).mp4 is used instead. Bytes go to a temporary .part file in that folder and are renamed only after the advertised length arrives. Only HTTPS R2 result URLs are fetched, without credentials or redirects. A transient failure retries up to three attempts with a fresh signed link; a stall of 60 seconds counts as a failure. Stopping the client cancels active downloads and removes their partial files.

Remote MCP at /mcp supports the same project tools but has no local file tools. Local project calls proxy to that endpoint. Local upload control uses OAuth under /mcp/uploads and polls /mcp/operations/{id}; signed video parts go directly to R2 and are never returned to the model. Both use the same OAuth authorization.

Development and validation

From the repository root:

pnpm --filter @captionbolt/mcp build
pnpm --filter @captionbolt/mcp type-check
pnpm --filter @captionbolt/mcp verify
node packages/mcp/dist/index.mjs

The build bundles the private workspace contract into dist/index.mjs; published consumers only install public runtime dependencies. SDK 2.4.0 supports modern and legacy STDIO through the same tool factory. Tests exercise real child processes and isolated file/HTTP adapters. They do not certify every OS keyring, desktop host or real media upload. Publishing and registry submission require separate authorization and client acceptance tests. The development verifier needs FFmpeg to generate tiny temporary MP4, MOV, WebM and AVI fixtures. FFmpeg is not a runtime dependency of the published client.

The optional SKILL.md included in this package explains tool use. It grants no filesystem, network or account permissions beyond the user's current request.