MCP server for the SnapStream tenant API (the cloud API served through AWS API Gateway). It lets an MCP client such as Claude Code search recordings, read transcripts and smart chapters, browse the program guide and scheduled recordings, stage clips, and call any read method in the API catalog. Writes go through a stage, approve and commit gate.
Task force members install from one shared file, snapstream-mcp-<version>.zip (Slack or Drive; no GitHub needed). It holds the wheel, install.ps1 (Windows), install.sh (macOS), INSTALL.md and PASTE-THIS-PROMPT.txt, a prompt to paste into Claude Desktop's Code tab so Claude runs the install. The installer puts the program in a private venv, opens a per-user config.yaml in a text editor for the credentials (they never go through chat), runs check, and registers the server in claude_desktop_config.json with a backup. Re-running it upgrades and keeps the config. Each user needs their own API credential, mapped to their own SnapStream user; never hand out one credential to a group. The user guide is docs/INSTALL.md.
Build the package (standard library only, no network; reproducible bytes):
.venv\Scripts\python.exe tools\build_package.py # writes dist\snapstream-mcp-<version>.zipsnapstream-mcp (console script) and python -m snapstream_mcp take the same subcommands. With none, they run the server over stdio.
| Command | What it does |
|---|---|
serve |
Run the MCP server over stdio (the default). |
setup |
Create the config file from a template (owner-only permissions) and open it in a text editor; never overwrites an existing file and never prompts on stdin. Skips when a developer checkout already uses the repo secrets.yaml (--path creates one anyway). --no-open, --json. |
check |
Validate the config, get a token, show the API user (AuthenticationManager/GetUserEmail), the instance machine (Library/GetMediaItems count 1, then Configuration/GetPublicMachineName), catalog counts, write profile, data folder and Claude Desktop registration. Prints no secrets. Exit 0 ok, 1 token or API failure, 2 config needs attention. --offline validates the file only; --quiet, --json. |
register |
Add or update mcpServers.snapstream in the Claude Desktop config: the absolute path of this interpreter (not resolved, so a macOS venv symlink stays the venv's) with -m snapstream_mcp. Timestamped backup first, every other key kept, written atomically; nothing written when unchanged; invalid JSON refused. Finds %APPDATA%\Claude\claude_desktop_config.json (Windows), the packaged variants under %LOCALAPPDATA% (Packages\Claude_*\LocalCache\Roaming\Claude, Claude-Data\<profile>), or ~/Library/Application Support/Claude/claude_desktop_config.json (macOS); several found means --config-path is required. --dry-run, --name, --python, --env SNAPSTREAM_*=VALUE, --json. From an uninstalled source checkout it also sets PYTHONPATH to the repo. |
unregister |
Remove the entry (with a backup); other servers stay. |
uninstall |
Print the removal steps for this OS; deletes nothing. |
SNAPSTREAM_MCP_SECRETS(a path; used even when the file is missing, so the error names it)secrets.yamlin the repo root, only when running from a source checkout (the developer flow below)- the per-user config file:
%APPDATA%\SnapStream MCP\config.yaml(Windows),~/Library/Application Support/SnapStream MCP/config.yaml(macOS),$XDG_CONFIG_HOME/snapstream-mcp/config.yamlelsewhere;SNAPSTREAM_MCP_HOMEmoves this folder
A source checkout uses its repo secrets.yaml before any per-user file, so a config.yaml written by an installed copy (perhaps for another instance) never redirects the developer server. When a file exists but is not used, check prints a warning naming it and the server logs it to stderr at start, along with the file it does use.
An installed copy keeps its write audit log, daily call counter and topic watch file in the per-user folder too. A source checkout keeps them in the repo root as before. The installers put the venv in %LOCALAPPDATA%\SnapStream MCP\venv (Windows, outside the roaming profile) or ~/Library/Application Support/SnapStream MCP/venv (macOS).
Requires Python 3.11 or newer.
cd C:\path\to\snapstream-mcp
python -m venv .venv
.venv\Scripts\python.exe -m pip install -r requirements-dev.txt # or requirements.txt without pytestFor development, copy secrets.yaml.example to secrets.yaml and fill it in from Cloud Admin (instance > Modify > API, shown after Provision API). secrets.yaml is gitignored. Never commit it, and never send these values through chat, Slack or email.
| Key | Required | Notes |
|---|---|---|
base_url |
yes | https:// only |
token_endpoint |
yes | Cognito token endpoint, https:// only |
client_id, client_secret |
yes | Cognito app client |
api_key |
yes | sent as x-api-key |
scopes |
no | space-separated; omitted from the token request when empty (the spec's scope is api/read api/write) |
instance |
no | label shown by ss_status |
The server refuses any REPLACE_ME placeholder and any non-https URL. Error messages name the key, never the value. To keep the file elsewhere, set SNAPSTREAM_MCP_SECRETS to its path. In a source checkout the repo secrets.yaml takes precedence over a per-user config.yaml (see above).
Each call gets an access token from the Cognito token endpoint (client_credentials), caches it, and refreshes it 60 seconds before it expires; a 401 triggers one refresh and retry. Requests are POST {base_url}/{url_path}/json/{Method} with Authorization: Bearer <token>, x-api-key, and a JSON body keyed by parameter name. url_path is the gateway path segment from the catalog: Config, LocalConfig and Notifier for the Configuration, LocalConfiguration and NotifierManager services, the service name for the rest. Tools accept either name.
The gateway resolves the session from the client_id, so every call runs as the one SnapStream user mapped to the API client, and a token with only api/read scope does not stop writes. A caller-supplied authTicket is always removed. The 19 methods whose permission check depends on their input (ClipFile, CreateScreenshot, the ClipAnd*, Tweet*, Slack* and upload methods) are sent with "authTicket": {}, because the gateway's permission inspector throws a NullReferenceException without it on builds before the fix. SNAPSTREAM_MCP_EMPTY_AUTH_TICKET=off turns the stub off once tenants are upgraded.
Add to the project .mcp.json (or user settings). cwd must be the repo root so -m snapstream_mcp can import the package and find secrets.yaml.
{
"mcpServers": {
"snapstream": {
"type": "stdio",
"command": "C:\\path\\to\\snapstream-mcp\\.venv\\Scripts\\python.exe",
"args": ["-m", "snapstream_mcp"],
"cwd": "C:\\path\\to\\snapstream-mcp"
}
}
}If your client cannot set cwd, install the package into the venv once (.venv\Scripts\python.exe -m pip install -e .). The module then imports from any working directory, and secrets.yaml is still read from the repo root. For Claude Desktop, .venv\Scripts\python.exe -m snapstream_mcp register writes the entry for you (with PYTHONPATH set when the checkout is not installed; registering an installed copy later drops that PYTHONPATH so the installed package is the one that runs, and keeps every other env setting, such as the write profile, unless a new value is passed).
Optional environment variables:
| Variable | Default | Notes |
|---|---|---|
SNAPSTREAM_MCP_SECRETS |
secrets.yaml in the repo root (source checkout only), then the per-user config.yaml |
see "Where the credentials file is found" |
SNAPSTREAM_MCP_HOME |
%APPDATA%\SnapStream MCP (Windows), ~/Library/Application Support/SnapStream MCP (macOS) |
the per-user folder for config.yaml and, in an installed copy, the audit log, call counter and watch file |
SNAPSTREAM_MCP_TIMEOUT |
28 | seconds; under the gateway's 29 s limit |
SNAPSTREAM_MCP_MAX_CONCURRENCY |
4 | concurrent requests |
SNAPSTREAM_MCP_RATE_PER_SEC |
8 | token bucket refill for every API request (the gateway allows 10/s) |
SNAPSTREAM_MCP_BURST |
16 | token bucket size |
SNAPSTREAM_MCP_DAILY_BUDGET |
20000 | soft cap on API calls per UTC day (the documented limit is 100,000/day per API key, shared by everything that uses the key) |
SNAPSTREAM_MCP_WRITE_MIN_INTERVAL |
5 | seconds between write calls |
SNAPSTREAM_MCP_MAX_RESPONSE_CHARS |
40000 | |
SNAPSTREAM_MCP_EMPTY_AUTH_TICKET |
on | send "authTicket": {} to the methods that need it |
SNAPSTREAM_MCP_AUDIT_FILE |
snapstream_writes.audit.jsonl in the repo root (source checkout) or the per-user folder (installed copy) |
the daily call counter, snapstream_calls.daily.json, is kept beside it |
SNAPSTREAM_MCP_WRITE_PROFILE |
clipping,scheduling,topic_watch |
which write methods can be staged; see Write profiles below |
SNAPSTREAM_MCP_WRITE_ALLOWLIST |
empty | comma-separated Service/Method entries (or Service/*) that narrow the profile further |
SNAPSTREAM_MCP_SCHEDULE_SCAN_LIMIT |
600 | current and upcoming recordings, and recording jobs, read per schedule check (ss_check_schedule, ss_stage_recording); 50 to 5000, 200 per call |
SNAPSTREAM_MCP_WATCH_FILE |
snapstream_watches.json beside the audit file |
the local topic watch file (definitions, watermarks, hits already reported) |
SNAPSTREAM_SERVER_TZ |
learned | the SnapStream server's time zone: an IANA name (America/Chicago) or a fixed offset (-06:00, -0600, UTC-6, UTC). Unset, the server uses the last UTC offset seen on a /Date(ms+hhmm)/ value (a fixed offset, no daylight saving). IANA names need a time zone database; on Windows that is the tzdata package (in requirements.txt) |
| Tool | What it does |
|---|---|
ss_status |
Instance label, API host, config validity, token check, catalog counts, pending writes, calls today against the daily budget, the request rate, the server time zone in use (server_time_zone: source setting, observed or unknown) and the write profile (write_policy: profile, stageable methods, allowlist, and any setting error). Never returns secrets. |
ss_api_catalog |
Offline search of all 479 methods by keyword (including web app names such as "Create for Social"), service and access class. |
ss_api_describe |
One method's parameters, permissions, return type, access class and an example params object, plus the field list (types, descriptions, enum names) of complex parameter types such as ClipProperties. Methods that fault without a sort carry sort_required; list methods with a count carry count_method; write guards show as cost, publish, no_permission_check and caveat; empty_guid_refused names the id parameters that refuse the empty GUID. |
ss_call_read |
Calls any method whose access is read. Refuses write and blocked methods. Takes fields, omit_defaults and include_total (see Response format). |
ss_stage_write |
Validates and freezes a write (including the keys inside complex parameters), returns a preview and a single-use token (10 minute TTL). Takes acknowledge_cost and acknowledge_public for paid rendering and public posting. |
ss_stage_clip |
Builds and stages a clip from a recording: reads the media item, converts seconds, hh:mm:ss or ms:<n> to 100 ns ticks, bounds-checks against the duration, and stages TaskManager/ClipFile (kind="clip") or AiClipDesigner (kind="social", Create for Social). Social clips take orientation as a name, vertical (default), horizontal or square (case-insensitive), or the AiClipOrientation integer 0, 1 or 2; anything else is refused before staging. Builds older than June 4 have no Orientation field. kind="social" needs acknowledge_cost=true (paid AI rendering) and is refused before any read without it. |
ss_stage_recording |
Stages a recording of a guide airing; see Scheduling below. Registered only when the write profile allows one of its methods. |
ss_commit_write |
Sends exactly the staged payload once. The only tool that changes SnapStream. |
ss_cancel_staged |
Discards a staged write. |
ss_pending_writes |
Lists staged writes that have not been committed. |
| Tool | API method |
|---|---|
ss_search_recordings |
Search/SearchRecordings (type defaults to default, 254) |
ss_count_recording_matches |
Search/SearchRecordingsCount |
ss_search_in_recording |
Search/SearchRecordingWithRefinement |
ss_search_guide |
Search/SearchAirings (type defaults to all, 7). A hit has no top-level Id: the airing GUID is Results[].Airing.Id (for ss_get_airing, ss_check_schedule, ss_stage_recording) |
ss_list_media_items |
Library/GetMediaItems |
ss_get_media_item |
Library/GetMediaItem |
ss_get_transcript |
Library/GetTranscript (windowed by caption index, seconds offset and size; optional text filter), after a Library/GetMediaItem (or GetArchivedMediaItem) permission check |
ss_get_smart_chapters |
Library/GetSmartChapters (commercial-break segment boundaries, not AI topic chapters), after a Library/GetMediaItem (or GetArchivedMediaItem) permission check |
ss_list_clips_and_bookmarks |
Library/GetClipsAndBookmarks |
ss_list_channels |
Scheduler/GetChannels |
ss_whats_on |
Scheduler/GetAiringsAtTime |
ss_guide_for_channel |
Scheduler/GetAiringsByChannelAndTimeRange |
ss_guide_by_time |
Scheduler/GetAiringsByStartTimeRange |
ss_get_airing |
Scheduler/GetAiring |
ss_list_scheduled_recordings |
Scheduler/GetCurrentAndUpcomingRecordings |
ss_list_current_recordings |
Scheduler/GetCurrentRecordings |
ss_list_recent_recordings |
Scheduler/GetRecentRecordings |
ss_list_recording_jobs |
Scheduler/GetRecordingJobs |
ss_scheduler_status |
Scheduler/GetStats, GetUpdateStatus, GetLastRebuild, GetDataExtents; adds guide_data_end, guide_runway_hours (hours of guide data left) and guide_warning under 48 h |
ss_get_job |
TaskManager/GetTaskList |
Single-call lookups with no extra logic are not listed as tools, because every tool definition is sent to the model each turn: use ss_call_read with Library/GetBookmarkById, Library/GetAllPastAndCurrentChannels, Library/GetDrives or AuthenticationManager/GetUserEmail (the server instructions name them). The default profile lists 37 tools; a test keeps the tool list under 65,000 characters.
The server instructions are rebuilt for the active write profile, so they never name a tool the profile removed: a read-only (none) install is told it is read-only, and the recording and topic watch workflows are described only when their tools are listed.
To record a show: ss_find_airings (find the airing) -> ss_check_schedule (what is already scheduled) -> ss_stage_recording (preview) -> user approval -> ss_commit_write.
| Tool | What it does | API methods |
|---|---|---|
ss_find_airings |
Guide search in a time window (start, end: ISO 8601 or now; default now to now + 7 days, at most 31 days). SearchAirings has no time filter, so hits are paged (max_scan, default 300, up to 1000) and the ones that do not overlap the window are dropped here. Filters: channel (GUID, callsign or number exactly, or part of the name) and first_run_only. Rows are sorted by start: airing_id, title, episode, channel {id, name, callsign, number}, start and end in UTC plus start_server_local/end_server_local, minutes, in_progress, first_run, series_id or movie_id, and schedule_status with recording_job_id when the guide shows the airing scheduled. details=true adds description (300 characters), genre, rating and flags. Notes say when hits were left unscanned |
Search/SearchAirings; Scheduler/GetChannelsFromList only for hits without channel details |
ss_check_schedule |
Read-only check for an airingId, a seriesId or a start/end window: already_scheduled, duplicates (the airing's own recording, or the guide's schedule status), same_episode_elsewhere, existing_jobs (series or movie jobs), conflicts (recordings the server marks Conflicted, that is without a tuner), overlapping_recordings, and tuners: tuner parts, the peak number of overlapping recordings and an estimate. The API does not say which tuner can take which channel (tuner status is internal), so the estimate is only that; the server's verdict is the Conflicted status after the schedule rebuilds. scanned says how many items were read and whether the scan was complete |
Scheduler/GetAiring, GetChannel, GetCurrentAndUpcomingRecordings (GetUpcomingRecordings when that fails), GetRecordingJobs (series and movies), GetAllTunerPartProperties (windows; needs EditSettings, otherwise a note) |
ss_stage_recording |
Stages (never sends) a recording of one airing. mode: once (RecordAiring, or RecordMovieAiring for a movie), series_all (RecordSeriesAll on the airing's channel), series_first_run (RecordSeriesFirstRun) or timeslot (RecordSeriesTimeslotByAiring with frequency, a RecordingFrequency name or integer, default weekly). anyChannel widens a series job to every channel. Runs the same check first: a duplicate (this airing already scheduled for once; an existing job for the series in a series mode) is refused with kind="already_scheduled" unless allow_duplicate=true. The preview shows the channel, start and end in UTC and server-local time, duplicates, conflicts, overlapping recordings, the tuner estimate and the mapped-user line. waitForRebuild is always false |
Scheduler/RecordAiring, RecordMovieAiring, RecordSeriesAll, RecordSeriesFirstRun, RecordSeriesTimeslotByAiring |
A topic watch is a standing caption search kept on this machine (one JSON file, SNAPSTREAM_MCP_WATCH_FILE; nothing is stored on SnapStream). Tune it with ss_watch_validate, save it with ss_watch_add, then run ss_watch_poll on a schedule (every 10 minutes is the window native alerts use). A poll never stages or commits anything: a strong hit comes back with a clip_suggestion for ss_stage_clip, which still needs the user's approval before ss_commit_write. ss_watch_add, ss_watch_remove and ss_watch_poll change the local file, so they are listed only when the write profile includes topic_watch (the default); ss_watch_list and ss_watch_validate only read and are always listed.
The query is built by the server, never pasted: each term is quoted as a phrase after the characters the parser cannot take (" ? ! { } = : ( ) [ ] ^ ~ \ | & ; < > +) are removed (a single word ending in * stays a prefix search), match joins terms with OR or AND, exclusions get -, channels become CHANNEL: clauses, -IS:CLIP is added unless include_clips, and AFTER: carries an explicit server-local date-time. With the server zone unknown, AFTER: is moved 12 hours earlier and older hits are dropped locally. The search type is always sent as an integer (default captions, 4).
| Tool | What it does | API methods |
|---|---|---|
ss_watch_add |
Saves a watch: name (its slug is the id), terms, match (any/all), exclude, channels, type, include_clips, lookback_hours (first poll window, default 24), overlap_minutes (default 240: each poll rereads hits from recordings that started this long before the watermark, so captions added to a recording in progress are found), clip padding and a note. At most 50 watches, 20 terms each |
none |
ss_watch_list |
The saved watches with watermark, last poll, status, new-hit count, last error and how many hits were already reported | none |
ss_watch_remove |
Deletes one watch from the file | none |
ss_watch_poll |
Runs one watch or all. GetLastChange is read once: a watch whose value has not moved since its last search (under an hour ago) is unchanged and not searched (force=true overrides); a value that went backwards (Broker restart) counts as changed; a failed call means every watch is searched. Then pages SearchRecordings (100 per call, up to max_scan, default 300), stops at the watermark, drops hits already reported, groups the rest by media item (ItemId) and returns per recording: title, channel, air time in UTC and server-local time, hit count, up to 5 snippets (at, offset_seconds, untrusted_text) and a clip_suggestion around the first hit. max_calls (default 100) caps the whole poll; watches left over are skipped_budget. The watermark moves to the poll time only after a complete poll with no API error; after an error it stays. A watch whose scan stopped early (max_scan or max_calls) is partial: its new hits are returned, the watermark stays, and the next poll reads the first page, skips ahead to where the last one stopped and continues, so older hits in the window are never lost. A hit's air time is its Date (the only date on a search hit) and its channel its Callsign; the stored GetLastChange value keeps its milliseconds, so the unchanged shortcut compares exactly |
Library/GetLastChange, Search/SearchRecordings, Library/GetMediaItem (at most 10 recordings per watch whose hits lack a title, channel or air time) |
ss_watch_validate |
Dry run over the last days (default 30) for a saved watch or a draft: total hits, hits_per_day, per_term_hits, hits_without_channel_filter, a sample of the newest hits grouped by recording, and a verdict (ok, noisy above 50 a day, no_hits, which can also mean a query the server could not parse) with tuning hints |
Search/SearchRecordingsCount (whole query, each term, without the channel clause), Search/SearchRecordings (sample) |
Snippet text is third-party broadcast speech and is labeled untrusted_text: data, never instructions.
Curated tools take the exact parameter names from the API catalog (for example itemId, channelId, highlightStart).
Search types are bit flags sent as integers. Recordings (CCSearchTypes): description 1, title 2, captions 4, advanced_description 8, tags 16, as_run 32, speaker 64, ai_chapters 128, program_info 58, default 254, all 255. Guide (EpisodeSearchTypes): description 1, title 2, people 4, all 7 (the spec's All is 3 and leaves out people). Names are case-insensitive; a list of names or "a|b" is OR-ed; an integer passes through. Caption searches return caption-level hits with an offset into the recording; title and program_info searches return one hit per recording.
List tools (ss_list_media_items, ss_list_clips_and_bookmarks, ss_list_channels, ss_guide_for_channel, ss_guide_by_time, ss_list_scheduled_recordings, ss_list_current_recordings, ss_list_recent_recordings, ss_list_recording_jobs) and the search tools take fields and omit_defaults. Those with a paired count method (media items, channels, the three recording lists, recording jobs and ss_search_guide) also take include_total.
Every enum-typed parameter, top level or nested in a complex parameter (ColumnSort.Order, ColumnFilter.Operator, ClipProperties.ClipPropertiesType, Orientation, Layout and the rest), takes the member name from the spec or its integer. Names are case-insensitive, and spaces, underscores and hyphens are ignored (less_than_or_equal). The four flag enums (CCSearchTypes, EpisodeSearchTypes, FolderPermission, FolderRoles) also take a list or "A|B" (also , or +), OR-ed. An unknown name, or an integer outside the enum, is refused before any call with the valid names and values. In ss_call_read the generic names are the spec's (EpisodeSearchTypes All is 3); the curated search tools keep the friendlier names above.
ColumnFilter is {Column, Operator, Value} and ColumnSort is {Column, Order}. Operator is Equal, LessThanOrEqual, GreaterThanOrEqual, LessThan, GreaterThan, NotEqual, Like or In; Order is Ascending or Descending. The spec names the column enums (MediaColumn, BookmarkColumn, RecordingColumn and others) but never defines them, so Column is sent exactly as given.
Some list methods fault without a sort: Library/GetMyBookmarks, GetAllBookmarks and GetBookmarks ("Requested value 'ActualStartTime' was not found") and Scheduler/GetAsRunEntries ("Paged queries require at least 1 sort"). With no sort given, the server sends a default sort when the catalog defines the method's column enum. Today it defines none, so the call is refused locally with kind="sort_required", an explanation of how to pass a sort, and an alternative (ss_list_clips_and_bookmarks for one recording's bookmarks; Scheduler/GetAllAsRunEntries for as-run entries).
- The
<Method>Resultwrapper is removed. /Date(ms[+-hhmm])/becomes ISO 8601 UTC. The min date (/Date(-62135596800000)/, or the same instant shifted by a UTC offset of up to 14 hours) and the empty GUID becomenull.- ISO 8601 durations are kept and gain a
<field>_secondsnumber. - Tick fields (100 ns units:
StartPosition,EndPosition,*Ticks, and smart chapterStart/End) keep their integer and gain a<field>_secondsnumber. - Key/Value pair lists (
[{"Key": k, "Value": v}, ...]with unique scalar keys) become one object{k: v}. - Null and empty fields are dropped by default (
compact_output=falsekeeps them). fieldskeeps only the named fields of each item: case-insensitive, dotted for nested fields (Results.ItemId), applied to every item of a list on the way. A kept field brings its<field>_secondssibling. Paths that match nothing are listed infields_unmatched, withfields_available. Inss_list_media_items,fieldsreplacesbrief.omit_defaults=truealso drops fields that are 0, false or a zero duration, so a missing field means 0 or false.include_total=truemakes one more call, to the paired count method (for example Library/GetMediaItemCount for GetMediaItems), and addstotal,total_methodand, for paged methods,next_index(null on the last page). A count method that does not take one of the list's filters is named intotal_note; a failed count givestotal_errorand leaves the list intact.- Server-local time: Logger LogEntry.InsertTime is the server's wall-clock time serialized as UTC. With the server time zone known, an InsertTime without an offset is converted to the real UTC instant and
InsertTime_server_localkeeps the wall-clock time; otherwise a note says it was not converted. In Search methods,AFTER:andBEFORE:operators that carry an explicit instant (AFTER:2026-11-24T20:00:00Z) are rewritten into server-local time (AFTER:2026-11-24T14:00:00at -06:00) and the result showssearch_rewritten; a date or date-time with no zone is left alone. With the zone unknown, such a search is refused locally rather than sent with the wrong time. - Output is capped (
max_chars); when capped,truncatedis true andhintsays how to page. - Credential-looking fields (password, secret, token, api key and similar) are masked in every response. Export destination, task action and tuner property responses use a stricter mask that also covers user and account fields.
- Date-time inputs are ISO 8601 (for example
2026-11-24T20:15:00Z, ornow) and are sent as/Date(ms)/.
The gateway passes writes on an api/read token and every call runs as the one user mapped to the API client, so the write profile is the only scope control. It is set in the MCP server config (environment), never by the agent, and is fixed for the life of the process.
| Profile | What can be staged |
|---|---|
none |
nothing: read-only. The write tools (ss_stage_write, ss_stage_clip, ss_stage_recording, ss_commit_write, ss_cancel_staged, ss_pending_writes) are not registered at all, which also shrinks the tool list every turn |
clipping |
TaskManager/ClipFile, AiClipDesigner, DesignExistingClip, UpdateDesign, CreateScreenshot, CreateGifFromExistingClip, DeleteTaskList (cancel a render); Library/SaveBookmark, DeleteBookmark, SaveMediaItem (meant for tags, but it overwrites the whole media item, so any metadata field can change; staging refuses an item that is not the full item read back from ss_get_media_item). Which items the server created is not tracked, so the only deletes are explicitly staged ones; deleting media items (DeleteMediaItem) needs admin |
scheduling |
ss_stage_recording and, through ss_stage_write, Scheduler/Record, RecordAiring, RecordManual, RecordManualJob, RecordMovieAiring, RecordMovieWithin30Days, RecordSeriesAll, RecordSeriesFirstRun, RecordSeriesTimeslot, RecordSeriesTimeslotByAiring, RecordTimeBasedGuide, RecordBlockBased247, RecordGuideData247, EditRecordingJob(s), DeleteRecordingJob, Block/ForceAiringRecording, Block/ForceManualRecording, ExtendCurrentRecording |
topic_watch |
local topic watch files only, no SnapStream write method. It registers ss_watch_add, ss_watch_remove and ss_watch_poll; on its own it registers no SnapStream write tool |
admin |
every method whose access class is write (the unrestricted gate) |
Profiles combine with commas. The default, clipping,scheduling,topic_watch, is the recommended task-force install: clips, bookmarks, tags and recordings can be staged, while nothing can be posted or sent outside SnapStream, no media item can be deleted, and no setting, alert, task rule or live stream can be changed. Use none for a read-only research install and admin only for an operator. SNAPSTREAM_MCP_WRITE_ALLOWLIST narrows further (TaskManager/ClipFile,Scheduler/RecordAiring, or TaskManager/*; display names and gateway paths both work); a method must be in the profile and on the list. Anything not understood fails closed: an unknown profile name turns writes off and ss_status shows the error, and an unknown allowlist entry matches nothing (listed as allowlist_unknown). A refused stage returns kind="not_allowed_in_profile", and the profile is checked again at commit.
Example .mcp.json entry for a read-only install:
"env": { "SNAPSTREAM_MCP_WRITE_PROFILE": "none" }- Read-only by default. Every method has an access class in the catalog:
read(249),write(162) orblocked(68).ss_call_readand the curated tools only runreadmethods. - Blocked methods are never callable: login and session methods, credential generators (GenerateApiLoginCredentials, GenerateTVBoxLoginCredentials, TestLiveFeedConnection), social integration account getters that may return OAuth tokens, generic String/Object/Guid settings getters, the RTMP stream key getter, the FileAccess methods (not exposed by the gateway per the OpenAPI spec), and internal pipeline methods. A method missing from the classification is built as
write(fail closed). - Permission bypass guard. Library/GetTranscript and GetSmartChapters skip folder permissions server-side, so the curated tools and
ss_call_readfirst call Library/GetMediaItem for the same id. When it returns nothing they try Library/GetArchivedMediaItem (GetTranscript also serves archived items), and refuse withnot_found_or_no_accesswhen that returns nothing too, or when either call fails. - Faults are failures. The API reports many errors as HTTP 200 with a base64
CustomErrorheader, or as an XML, HTML or WCF fault body. These raiseapi_faultwith the first line of the message (stack frames stripped, redacted) and the gateway'sx-amzn-RequestId; a write that gets one is never reported as committed. - Write staging.
ss_stage_writevalidates parameter names against the catalog, checks the keys inside complex parameters against the API schemas (an unknown key or a case-only mismatch such assubtitlesforSubtitlesis refused with a "did you mean", never auto-corrected;__typeselects a subtype), checks ClipProperties tick positions (integers, start before end, at least 1 s, shown ashh:mm:ssin the preview), freezes the exact payload with a SHA-256 hash, and returns a preview plus a single-use token that expires in 10 minutes.ss_commit_writere-checks the hash and sends exactly that payload once. When the client declares the elicitation capability it asks the user to confirm again (mid-call on older MCP protocols, as an input_required round trip on 2026-07-28 and later), and anything other than an explicit confirm (decline, cancel, a malformed reply, a timeout or any other error) aborts the write. A decline or cancel spends the token; a confirmation prompt that fails sends nothing and leaves the token live until it expires or is canceled, and a confirmation given after the token expires is refused and sends nothing. Only a client that does not declare elicitation proceeds on the token alone; on 2026-07-28 a retry round that carries answers is always asked again, so a recorded decline is honored even if the retry leaves the capability out. The commit tool is annotated destructive and requires user interaction. - Write profile. Only methods in the active write profile (and allowlist) can be staged or committed; see Write profiles.
- Cost and publish guards. Per-method flags in
tools/access_overrides.jsonmark paid AI rendering (cost: AiClipDesigner, DesignExistingClip, UpdateDesign, TranscribeRecording, and RunTaskRule and BatchRunTaskRule, whose rule actions may render), anything that posts, sends or streams outside SnapStream (publish: the Tweet*, ClipAndTweet, Facebook, YouTube, Slack and Bluesky posters, PostExistingMoment, StreamTo*Live, ShareClip, BatchShareClip, EmailClip, SendTestAlert, SendSupportTicket, and the indirect ones: RunTaskRule and BatchRunTaskRule run a rule's actions, ResetTaskList reruns a task list, ExportFile, FederatedUpload and FederatedPlaylistUpload send files outside SnapStream) and methods the server checks no permission for (no_permission_check: the three design methods). Staging a cost method needsacknowledge_cost=trueand a publish methodacknowledge_public=true; without it the stage is refused withkind="acknowledgment_required",needsand the banner to show the user, and nothing is staged. Parameter problems are reported before the acknowledgment. The preview opens with!! COST,!! PUBLICand!! NO SERVER PERMISSION CHECKlines, and a publish preview lists the account, message, posting type (with its name, for example3 (PostImmediate)) and audience fields it will send, or says when no AccountId was given. No publish method is in the default profile. - Caveats. Known pitfalls are shown in the preview as
Caveat:lines and inss_api_describe: StopTask re-queues the task (cancel with DeleteTaskList), ResetTuner does nothing with a wrong id, TranscribeRecording returns an empty GUID for an unknown item, AddTaskRule creates a disabled rule by default and runs as the system account, UpdateBookmarkPrivacyState fails through the gateway, SaveMediaItem overwrites the whole item (the item must carry Id, Title, ChannelId, FolderId, FolderPathId and Filename, and the preview lists every MediaItem field left out), and the 24/7 recorders hold a tuner until deleted. Any write with asendTestEmailparameter (NotifierManager/AddAlert and EditAlert) sendssendTestEmail=falseunlessacknowledge_public=true(true sends a real email at once and shows the!! PUBLICbanner). - Ids and missing objects. An id parameter (
itemId,id,listId,mediaItem,parentId,channelIdand the other object ids) given as the empty GUID is refused before any call (for a write, so is one left out or null, which the server binds to the empty GUID), except where the spec says the empty GUID or NULL means something (Scheduler/GetLiveFeedUsage and GetLiveFeedSelections) oraccess_overrides.jsonlists it inempty_guid_ok. A single-itemGet*read that returns null comes back withstatus: "not_found_or_no_access"and a hint (the object does not exist, or the mapped API user cannot see it; for media items, use a search hit's ItemId, not its Id). - Unknown outcomes. A commit that times out, loses its connection after sending, or gets HTTP 502, 503 or 504 returns
outcome_unknown(not committed, not failed) with averify_hintnaming the read that confirms it (TaskManager/GetTaskLists orss_get_jobfor clips; Scheduler/GetCurrentAndUpcomingRecordings,ss_check_scheduleorss_list_scheduled_recordings, and Scheduler/GetRecordingJobs for every Scheduler write that records, edits, blocks, forces, extends or deletes a recording or job; NotifierManager/GetMyAlerts for alerts). A canceled or interrupted commit is audited ascommit_unknownthe same way. A fault from the method itself or an HTTP 5xx iserrorwith averify_hint, since part of the write may have run; only failures known to come before the method ran (a "without proper permissions passed to method: " refusal, matched on the message text that the CustomError header carries, when the named method is the one called; or the gateway permission inspector in a stack trace; HTTP 4xx; connect failures) say "Not committed". A permission refusal that names a different method may come from a nested call after part of the write ran, so it iserrorwith averify_hintlike any other method fault. A write whose return type is Guid must answer with a non-empty GUID, or it is reported aserror(unexpected_result). Payloads are sent with__typefirst in every object, as WCF requires. Writes are never retried automatically. - Throttle. Writes are serialized and spaced at least
SNAPSTREAM_MCP_WRITE_MIN_INTERVALseconds apart; all calls share a concurrency cap and a token bucket. Reads that get 429 or 503 are retried (Retry-After or jittered backoff, 3 attempts in all). A soft daily budget refuses calls withkind="budget"once spent.countis capped at 1000 and paged reads default to small pages. Gateway rate limits do not cap the load operations put on the recorder, so keep writes deliberate. - Audit. Every stage, commit (
commit_done,commit_error,commit_unknown), decline and cancel, and every attempt to stage a blocked method, is appended tosnapstream_writes.audit.jsonl(gitignored). The audit holds method names, payload hashes, the gateway request id on commit lines, astage_id(a short hash of the staging token) on every line about a staged write so each line joins to itsstagedline, the confirmation mode on commit lines, and redacted parameters, never credentials or tokens. Export destination, task action, live streaming and federation writes use the stricter mask in the preview and the audit. A commit is refused if the audit file cannot be written. - Redaction. Client ID, client secret, API key and the current access token are masked from every error and log line and from every string in successful tool output, as are JWTs and credential query parameters in URLs (token, sig, signature, key, X-Amz-*); HTTP errors return the status and a short redacted body excerpt.
- Demo only during development. Point
secrets.yamlat the demo instance until the server has been validated. Thetests/suite is fully offline; the opt-in live suite is described below.
.venv\Scripts\python.exe -m pytestAll tests run offline with httpx.MockTransport and fake credentials; they never read secrets.yaml. pytest with no arguments runs only tests/ (testpaths), never the live suite. The suite also points the per-user folders (SNAPSTREAM_MCP_HOME, APPDATA, LOCALAPPDATA, XDG_*, and HOME on macOS and Linux) into a temp folder, so the install tests (tests/test_install.py: config search order, permissions, setup, check, register and unregister, the package build, and installer syntax checks with PowerShell's parser and bash -n where available) never touch a real config.yaml or claude_desktop_config.json.
smoke_test.py is a manual, read-only live check (token, ss_status, GetMediaItems with count 2, SearchRecordings with count 2, and a truncated transcript of the first item). It prints only pass or fail, HTTP status and response shapes. Run it by hand against the demo instance only.
tests_live/ runs the real server code (the Runtime and the ss_* tool functions, plus one session over stdio) against the instance in secrets.yaml, to find what mocks cannot. It is built to be safe on the shared demo instance, where the API client is mapped to one user, so anything it creates shows as that user's.
- Nothing runs without
--live: every test is skipped at collection, no config is read and no call is made. - It refuses to start unless
secrets.yamlpoints atdemo.cloud.snapstream.com(override withSNAPSTREAM_LIVE_EXPECTED_HOST). - Its runtime uses the
adminwrite profile narrowed to TaskManager/ClipFile, AiClipDesigner and Library/DeleteMediaItem, the same methods the write firewall lets through, whatever the shell'sSNAPSTREAM_MCP_WRITE_PROFILEsays. - A write firewall wraps the client. In the read tier every write is refused before it leaves the machine. In the write tier only TaskManager/ClipFile and AiClipDesigner (hard cap 2 per run) and Library/DeleteMediaItem (only for ids this run created and verified, one per create) can pass. The firewall refuses every write unless the run was started with
--live-writes, and the write tier's fixture skips without it, so the gate does not rest on the collection-time skip marker alone (for example under-p no:skipping). - Output: pass, fail and skip lines plus the report path. Assertion messages name methods, key paths, error kinds and HTTP statuses, never response values, tokens or secrets. pytest's default traceback (
--tb=autoorlong) prints each frame's arguments, and-lprints its locals, which here would be fixture items and response dicts. So with--livethe suite forces--tb=shortwhen the style isautoorlong, turns off-l/--showlocalsand--full-trace(extra arguments passed throughlive_test.pycannot turn them back on), and drops the arguments and locals sections from every failure report. A failure shows source lines and the message the test wrote. Failure reports are also passed through the server's redactor.
# offline checks: collects, and skips everything without --live
.venv\Scripts\python.exe -m pytest tests_live --collect-only -p no:cacheprovider
.venv\Scripts\python.exe -m pytest tests_live -p no:cacheprovider
# read tier (roughly 400 API calls; no writes)
.venv\Scripts\python.exe live_test.py
# read + write tier: W1 standard clip, then delete it
.venv\Scripts\python.exe live_test.py --writes
# also W2 Create for Social (separate opt-in: it starts paid AI rendering); orientation defaults to vertical
.venv\Scripts\python.exe live_test.py --writes --social [--orientation horizontal]
# extra arguments go to pytest, for example one file or one test
.venv\Scripts\python.exe live_test.py -k sweep
# the same without the runner
.venv\Scripts\python.exe -m pytest tests_live --live [--live-writes [--live-social [--orientation NAME]]] [--report PATH] -p no:cacheprovider -rfEsRead tier (--live):
| File | Covers |
|---|---|
test_01_environment.py |
ss_status config, token and server time zone, the API user's email (AuthenticationManager/GetUserEmail), Config/GetApiLevel under both service names (gateway path mapping; apiType as an integer and as an enum name), the daily call counter, and one stdio session (python -m snapstream_mcp: initialize, list_tools, ss_status, one search) |
test_02_curated_reads.py |
every curated read tool with real ids: shape (ISO dates, no /Date(, _seconds siblings, no error key, no secrets), paging and the 1000 count cap, transcript windows by caption, offset and text filter, every named search type, caption vs title result shapes, list OR-ing, guide by channel and by time, what's on, recordings, jobs, storage, scheduler status with the guide runway, fields and include_total on channels, omit_defaults and include_total on media items, flag names through ss_call_read, AFTER: rewritten into server time (two days ahead matches nothing, 30 days back matches), and the Logger InsertTime note |
test_03_catalog_sweep.py |
every catalog method with access read and spec read-only true, once, with params built from its schema and the discovered ids. Fails on HTTP 404, timeouts or network errors, auth/config/budget errors, a local crash or a leaked secret; records API faults from synthetic params without failing (and local refusals such as sort_required). Reads whose spec read-only flag is false are skipped and listed |
test_04_guards.py |
local refusals with no API call (unknown param, write via ss_call_read, blocked method for read and stage, bad search type, bookmark lists with no sort, unknown enum names, unknown nested key, case-only mismatch, millisecond positions, a write outside the write profile, a paid render without acknowledge_cost, an empty-GUID id), not_found_or_no_access for a random GUID transcript and a random GUID airing, stage then cancel, reused and expired tokens |
test_05_rate.py |
a burst of 30 reads: no 429 reaches the caller and the time matches the token bucket |
test_06_scheduling.py |
ss_find_airings over the next 24 hours (rows overlap the window, are sorted, carry channel ids and names and server-local times when the zone is known), the channel filter, type="title" and max_scan, and ss_check_schedule for a found airing, the discovered airing, a series and a two-hour window (recordings scan, tuner estimate or note). Skips when the guide has no airings for the words tried. Nothing is staged |
test_07_watches.py |
ss_watch_validate for a draft (query has the quoted phrase, -IS:CLIP and AFTER:, type sent as 4, sample rows with media item GUIDs and untrusted snippets) and per-term counts, and ss_watch_poll against a temporary watch file: the first poll moves the watermark, its item ids resolve with ss_get_media_item, a forced second poll reports no hit twice, and a repeat poll is unchanged or says why GetLastChange gave nothing. The real watch file is never touched and nothing is staged |
test_08_install_check.py |
the installer's check (cli.collect_online on the session runtime): token, an email from GetUserEmail, the instance machine name (GetMediaItems count 1, then GetPublicMachineName) is the demo instance, catalog counts and write profile, no leaked secrets |
Discovery runs once per run: a completed, non-clip media item of at least 2 minutes with captions, a channel, an airing, a recording job, a task list, a drive and, if one exists, a clip or bookmark. The media item comes from caption searches (-IS:CLIP, hits on clips or on items still recording dropped before they are checked, two pages per word), then from the Library when every candidate is rejected; the reason lists rejection counts. A test whose fixture is genuinely empty is skipped with the reason. A fixture that is missing because a tool returned an error (or discovery raised) fails the dependent tests instead, so a broken tool does not show up as a skip.
Write tier (--live --live-writes, test_10_writes.py): W1 stages a 10 s standard clip from 60 s into the fixture item titled MCP live test <UTC timestamp>, checks the preview (ticks, hh:mm:ss, mapped-user line), commits, polls the task list until it finishes (8 minutes at most for a clip, 10 for a social clip; renders take 2 to 7 minutes), finds the clip under its parent (Library/GetMyClipsForItem first, then the parent's clips and bookmarks, then the newest Library pages, each read page by page past output capping) and checks its title and length. W2 (only with --live-social as well, since Create for Social starts paid AI rendering) does the same through Create for Social with Subtitles on and --orientation (default vertical). Cleanup runs in a finalizer even when a test fails. It first waits up to 5 more minutes for a render the test stopped waiting for; one still running after that is reported with its task list id, to cancel by hand with TaskManager/DeleteTaskList (not StopTask), and nothing is deleted. It deletes only a media item whose id this run recorded, whose title is exactly this run's title, which is marked as a clip of the fixture item (Clip true, or ClipParentId equal to it) and whose file (FolderPathId and Filename) differs from the fixture item's, all re-checked with GetMediaItem right before a staged and committed Library/DeleteMediaItem. What it deleted, or could not delete and why, goes in the report.
Reports go to live_reports/<UTC timestamp>.md and .json (gitignored; --report PATH to choose). They hold test outcomes, discovery results, the sweep table (method, outcome, HTTP status, short message, latency), the burst timing, the clips created and the cleanup results, never response bodies. Stages and commits are also written to the normal audit log, and the calls count against the shared daily budget.
snapstream_mcp/data/api_catalog.json is generated from the tenant API OpenAPI spec, with the HTML reference as an optional supplement for display names, short summaries and notes:
.venv\Scripts\python.exe tools\build_catalog.py C:\path\to\snapstream-tenant-api.json --html C:\path\to\SnapStreamAPI.htmlPassing only the HTML reference still works as a fallback (no schemas or spec flags). The builder:
- records each service's
url_pathand, per method, the spec's permissions, features, read-only flag,valid_ticket_only(the SCRUM-7181 gateway limitation) andauth_ticket(empty_objectwhen the permission check depends on the input, elseomit); - copies the write guards from the same rows:
cost,publishandcaveat(text) andno_permission_check(true or false).cost,publishandno_permission_checkare allowed on write methods only, and a malformed value fails the build.empty_guid_oklists Guid parameters for which the empty GUID is meaningful; parameters whose spec description says Guid.Empty or NULL are added automatically; - applies the access classes in
tools/access_overrides.json(authoritative). Any method not listed there is built aswriteand reported; overrides that no longer match a method are reported too. Areadmethod the spec flags as not read-only fails the build unless its row has aread_only_comment. Rows markednot_in_spec(the FileAccess methods) are kept and must beblocked; - writes a trimmed
schemassection fromcomponents.schemas(fields with type and description, enum names, the four bit-flag enums parsed from their descriptions,__typehints) withtools/type_overrides.jsonmerged over it. The overrides correct ClipProperties from the team's DX feedback (required fields, case-sensitiveSubtitles, fields the spec leaves out). The source-item fields copied from GetMediaItem (ItemId, FolderPathId, Filename and the rest) sit on BaseClipProperties, so every clip properties type, social ones included, accepts them.
Review the reported lists, update the override files, and rebuild before committing.