mcp-speechmatics-transcribe
v0.1.27Transcribe audio and video files with Speechmatics through a CLI and MCP server.
Turn local audio and video recordings into searchable transcripts, speaker-labeled subtitles, and readable Markdown with Speechmatics. Use the CLI for individual files or connect the MCP server to a compatible client. Requires Node.js 22.18+. FFmpeg and adaptive screenshots are provided by the public npm dependencies mcp-ffmpeg-runtime and mcp-extract-video-frames. Set SPEECHMATICS_TOKENS in your environment, then run: Alternatively, copy .env.example to a local .env, enter your tokens, and pass its path:
Summary extracted from the README.
Speechmatics Transcribe
Turn local audio and video recordings into searchable transcripts, speaker-labeled subtitles, and readable Markdown with Speechmatics. Use the CLI for individual files or connect the MCP server to a compatible client. Requires Node.js 22.18+. FFmpeg and adaptive screenshots are provided by the public npm dependencies mcp-ffmpeg-runtime and mcp-extract-video-frames.
Quick start
Set SPEECHMATICS_TOKENS in your environment, then run:
npx -y --prefer-online mcp-speechmatics-transcribe@latest recording.mp4
npx -y --prefer-online mcp-speechmatics-transcribe@latest --help
Alternatively, copy .env.example to a local .env, enter your tokens, and pass its path:
npx -y --prefer-online mcp-speechmatics-transcribe@latest --env-file /path/to/.env recording.mp4
Token entries are comma-separated. Each entry is a token or login:token. Logins are optional. Keep credentials outside the repository.
MCP
{
"mcpServers": {
"mcp-speechmatics-transcribe": {
"command": "npx",
"args": ["-y", "--prefer-online", "mcp-speechmatics-transcribe@latest"],
"env": {
"SPEECHMATICS_TOKENS": "YOUR_API_TOKEN"
}
}
}
}
On Windows, clients that require an executable path can use npx.cmd. For a local env file, append --env-file and its absolute path. With no file argument, the command starts the MCP server; the explicit mcp subcommand also works. New npx launches resolve the current published package. An already running MCP wrapper keeps its loaded code until restarted. For npx-managed installations, individual tool calls resolve the latest CLI through npx. Allow enough tool time for uploads and processing; the API timeout defaults to 900 seconds.
The transcribe tool requires an absolute file path. It exposes transcription, silence removal, and optional screenshot settings with their configured defaults. Missing credentials are reported when the tool is called; tool discovery remains available.
Media preparation and screenshots
Silence removal is enabled for all audio and video formats. By default, it removes intervals below -40 dB lasting at least 3 seconds, retaining a 0.3-second margin at each end. Lower the threshold for quiet speech, or set removeSilence=false (CLI: --no-remove-silence) to disable it. An entirely silent input is skipped without submitting a Speechmatics job. Set minLength (CLI: --min-length) to skip recordings whose retained audio is too short; the default is 0.
Enable extractFrames to save PNG screenshots alongside a video transcription. These can help with illustrated notes and slide references. The default changes mode distributes an adaptive budget across the entire retained video, favoring visual activity and local changes while suppressing nearby duplicates. It may produce fewer images than frameMaxCount. The interval mode distributes images evenly over the retained footage, also respecting the total limit.
{
"file": "C:/recordings/lecture.mp4",
"extractFrames": true,
"frameMode": "changes",
"frameMaxCount": 80,
"frameMaxHeight": 1080
}
Equivalent CLI:
npx -y --prefer-online mcp-speechmatics-transcribe@latest recording.mp4 --extract-frames --frame-max-count 80
frameIntervalSeconds controls candidate spacing; 0 uses automatic spacing. The scan is bounded to about 20,000 candidates for long recordings. Very brief changes between candidates can be missed. frameChangeThreshold controls similarity suppression, with higher values treating more nearby images as duplicates.
Audio and screenshots are taken from the retained intervals. Transcript timestamps and screenshot filenames are restored to the original recording's timeline, so removing silence does not change where a quoted passage can be found in the source. Audio-only inputs report no_video when screenshots are requested.
When no silence needs removal, MP3, AAC, OGG, M4A, and FLAC files normally pass through unchanged, based on their extension. Other inputs are prepared as MP3; audio extraction first tries stream copying where possible. Edited audio is encoded to MP3. Prepared files stay in the output folder. Missing audio and conversion failures are reported before upload. System FFmpeg and FFprobe are not required. The shared mcp-ffmpeg-runtime library manages FFmpeg downloads and its binary cache. The runtime dependency requires ^0.1.4, and the screenshot library uses the latest npm tag. Both are refreshed within their declared ranges when preparing a new release; the resolved versions are retained for reproducible release retries. The runtime checks and updates its FFmpeg build at media use and reuses the cached binary. FFMPEG_CACHE_DIR, FFMPEG_CHANNEL, FFMPEG_OFFLINE, and FFMPEG_PREFERRED_RUNTIME configure that runtime. The default uses its managed binary; offline and local preferences can opt out of downloading the current build. The default omits a runtime preference and uses latest. FFMPEG_PREFERRED_RUNTIME accepts latest, cached, local, an npm semver range, or a build ID. FFmpeg has its own licenses.
Configuration
The token_status tool checks all configured tokens through the EU1
Batch usage endpoint. Optional since and until dates use YYYY-MM-DD; the default
start is 1970-01-01 (all available history) and the default end is today in UTC,
explicitly including the current day's usage. Results identify each key by its
configured login or a masked token. Excluded keys return excluded without an API
request. Successful requests return active and usage hours rounded to one decimal;
failures return error with available HTTP details. Short anonymous tokens are fully
masked. No raw token or token hash is returned.
Usage reflects the scope reported by Speechmatics and is not attributed exclusively to an individual key. Successful access does not guarantee funds for another job. Credits are omitted because the public usage API does not provide a balance. Successful status checks update local usage snapshots used for rotation; token exclusions are unchanged.
Invocation arguments override process environment, followed by the selected env file and built-in defaults. SPEECHMATICS_ENV_FILE or --env-file selects an env file. Source installations otherwise load .env from the package directory.
| Variable | Default | Purpose |
|---|---|---|
| SPEECHMATICS_TOKENS | Required | Comma-separated API tokens, optionally prefixed with login: |
| SPEECHMATICS_MODEL | enhanced | Transcription model |
| SPEECHMATICS_LANGUAGE | pl | Language code; use multi for multilingual models |
| SPEECHMATICS_DIARIZATION | speaker | Speaker attribution; MCP only exposes disabling it |
| SPEECHMATICS_AUDIO_EVENTS | true | Enable events for Standard and Enhanced |
| SPEECHMATICS_TIMEOUT_SECONDS | 900 | Upload and processing timeout in seconds |
| SPEECHMATICS_MIN_LENGTH | 0 | Skip retained audio below this duration before API calls |
| SPEECHMATICS_REMOVE_SILENCE | true | Remove silent intervals before upload |
| SPEECHMATICS_SILENCE_THRESHOLD_DB | -40 | Silence threshold in dB |
| SPEECHMATICS_SILENCE_MINIMUM_SECONDS | 3 | Minimum silent interval |
| SPEECHMATICS_SILENCE_MARGIN_SECONDS | 0.3 | Margin at each end of a silent interval |
| SPEECHMATICS_EXTRACT_FRAMES | false | Save optional video screenshots |
| SPEECHMATICS_FRAME_MODE | changes | Adaptive changes or evenly spaced interval selection |
| SPEECHMATICS_FRAME_INTERVAL_SECONDS | 0 | Candidate spacing; 0 selects automatically |
| SPEECHMATICS_FRAME_MAX_COUNT | 120 | Maximum image count over the entire retained video |
| SPEECHMATICS_FRAME_MAX_HEIGHT | 1080 | Maximum PNG height, without upscaling |
| SPEECHMATICS_FRAME_CHANGE_THRESHOLD | 4.5 | Near-duplicate similarity threshold |
Boolean environment variables accept true or false.
| Model | Use case |
|---|---|
| enhanced | Highest accuracy for a selected language |
| standard | Faster processing and archival transcription |
| melia-1 | Multilingual recordings and language switching; use language=multi |
| oak-1 | Multilingual healthcare recordings; use language=multi |
Melia 1 and Oak 1 support speaker diarization in Batch but do not support audio events. Model capabilities are described in the Speechmatics documentation.
Output
Files are written under the operating system's temporary directory in transcription//:
- json-v2 transcript with original recording timestamps, plus segment JSON.
- WebVTT subtitles with voice spans such as <v.speaker S1>.
- Markdown with the filename, source folder, speaker labels, and paragraph start times.
- A prepared MP3 when audio needs editing or conversion.
- A timeline JSON describing retained intervals when media is analyzed.
- Optional PNG screenshots and a manifest with original and prepared audio times.
Markdown begins with YAML source and prepared-recording paths when media is analyzed. It includes timestamps: original, timeline_file, and video_frames_dir when screenshots exist. Paragraph times use HH:MM:SS; PNG names use frame-HH-MM-SS-mmm with a unique suffix. JSON and WebVTT retain precise timestamps. The JSON media_preparation field records the original and submitted audio duration.
Markdown paragraphs split at sentence boundaries after 30 seconds or 80 words, or when the speaker changes. Polish speaker and known event labels are retained for the existing output format. Unknown speaker labels and event types are preserved. Audio events appear in Markdown and WebVTT at confidence >=0.90.
The shared transcription/logs.json contains two arrays: transcriptions and usage. Existing transcription history is preserved when the log is first updated. Transcription records include status, elapsed time, audio duration, model, language, job ID, and token SHA-256. Usage snapshots include account identity, token SHA-256, date range, retrieval times, job count, and hours rounded to one decimal. Exact seconds are retained for comparisons and scheduling.
Before the first transcription, missing lifetime snapshots are fetched for active accounts; snapshots ending before today are also refreshed. Selection prefers available accounts with the lowest cached lifetime API usage. Running reservations distribute concurrent work; reservations expire at the configured transcription timeout. Ties use round-robin order. If usage is unavailable for an eligible account, selection falls back to round-robin order with running reservations considered.
After every transcription attempt that reserved a token, its usage is refreshed. Successful transcriptions wait 2 seconds before this best-effort request, outside the log lock. Successful token_status reads also update usage. Updates use a file lock and an atomic write, reject smaller counters and older date ranges, and never add repeated API totals together. Usage failures preserve previous values and do not fail a transcription. Provider reporting can lag; local estimates are not added to API totals. Token rotation skips credentials disabled after authentication, entitlement, or exhausted-account-limit errors. HTTP 429 rate limits alone do not disable a token. API transcription errors are returned without retrying on another account.
Audio is uploaded to Speechmatics in EU1. Transcription usage is billed by Speechmatics. An API timeout can leave a remote job running; its ID is retained when available.
License
MIT. This project is an independent client and is not affiliated with Speechmatics.