Skip to main content
Glama
Patefona MCP Server

Patefona MCP Server

Official

24/7 public-domain literary radio, 1948 KVN-49 HLS television, and stateless MCP server powering patefona.com. Every broadcast slot is anchored to the book, chapter, and scene where that piece of music is named, quoted, or heard.

This repository ships the complete station engine (code, DSP filters, WebGL/WebAudio front-end, deployment units, and a 5-track public-domain fixture under examples/). Audio archives and production schedules live outside Git.


Architecture

examples/ or host library
  ├─ station.json + catalog.json + jingles.json
  │     │
  │     ▼
  ├─ Deterministic Clock (app/rotator/)
  │     ├─ SHA-256 hash-chained slots & day heads from epoch
  │     ├─ Seeded weighted draw: key = -ln(u)/w, daypart & 7/14-day burn guards
  │     ├─ 1/16 s binary-exact qsin crossfades + :00 Greenwich pips & :30 Westminster chimes
  │     └─ Companion bernstein-broadcast manifests (examples/bernstein-*.json) for asrun.jsonl & run-receipt/v1 attestation
  │
  ├─ Radio Playout & DSP Bus (app/radio/)
  │     ├─ Static cue/LUFS gain + mono/antiphase layout repair → f32le PCM
  │     ├─ Clean mount (/radio.mp3): -17 LUFS target, 28 Hz HPF, 4× oversampled -1.5 dBTP limiter
  │     ├─ Valve mount (/radio-warm.mp3): sample-aligned 4× asymmetric tanh 1926 tube stage + 12 kHz shelf
  │     ├─ Kids 0+ mount (/radio-kids.mp3) + CF-IPCountry EU/World rights-scope edge router
  │     └─ Aircheck monitor (silencedetect JSONL + Prometheus metrics)
  │
  ├─ KVN-49 1948 Television (app/tv/)
  │     ├─ Offline segment renderer (nice 19): shadow-lifted 1948 kinescope curve, scanlines, corner bug
  │     └─ Dual -c copy supervisor (<1% CPU): live.m3u8 (960×720 H.264) + audio.m3u8 (AAC-LC 128k)
  │
  └─ Web Cabinet & Stateless MCP (app/site/ · app/mixer/)
        ├─ 3 cabinets × 3 eras, WebGL barrel-CRT shader, 6-stage Web Audio Background Mode
        ├─ Stateless Streamable HTTP MCP (POST /mcp, SEP-1649 /.well-known/mcp.json, stdlib only)
        └─ Quota-guarded literary shelf mixer (/api/mix) + HMAC-SHA256 double opt-in (/api/mix/subscribe)

Technical Subsystems

Subsystem

Implementation

Key Invariants

Deterministic Broadcast Clock

app/rotator/rotator.py (+ compatible bernstein-broadcast manifests in examples/bernstein-*.json)

app/rotator/rotator.py drives the live station schedules today: identical manifests produce byte-identical YYYY-MM-DD.json schedules SHA-256 chained from genesis, with nocturne (00:00–06:00, LRA ≤ 13.5 LU, I ≤ -14 LUFS) and anti_jolt guards. Companion examples/bernstein-*.json manifests target the external bernstein-broadcast plugin for asrun.jsonl reconciliation and Ed25519 run-receipt/v1 day attestation.

-17 LUFS Master Bus & 1926 Valve Stage

app/radio/playout.py, app/radio/analyze.py, app/radio/timemarks.py

Pre-measured cue points and integrated loudness (ebur128); 4× oversampled true-peak ceiling at -1.5 dBTP; parallel sample-aligned asymmetric tanh even-harmonic saturation (+0.05 LU level-matched); deterministic sine/resonator synthesis for :00 / :30 time marks.

6-Stage Background Mode

app/site/js/background-eq.js

Client-side Web Audio API externalization chain for reading/work: Mid/Side matrix, ITD + head-shadow crossfeed, air-absorption high shelf, early reflections, velvet-noise room IR convolution, and gentle bus compression.

KVN-49 HLS Television

app/tv/vps2/bin/, app/site/js/crt-webgl.js, app/site/js/tv-hls.js

Effects are baked offline (H.264 High@4.0, closed 2 s GOP, AAC-LC 128k) so live ffmpeg -re -c copy playout uses <1% of one core and survives restarts via resume.json + #EXT-X-DISCONTINUITY.

Stateless MCP Server

app/mixer/mcp_server.py, server.json, app/site/.well-known/mcp.json

Zero-dependency Python stdlib JSON-RPC 2.0 handler (2025-06-18 / 2025-03-26 / 2024-11-05) exposing 6 tools (now_playing, list_streams, setup_device, search_archive, get_schedule, curate_for_activity), 2 resources, and 2 prompts.


Related MCP server: internet-radio-mcp

Quickstart (Offline, 5-Track Public-Domain Fixture)

Requires Python 3.12+ (and pytest to run the test runner; ffmpeg/ffprobe optional for live audio-render tests, node optional for the localization gate). No API keys or network access are needed.

# 1. Run the full unit, integration, and 5-track fixture test suite
pytest

# 2. Compile and verify a 3-day deterministic hash-chained schedule from examples/
python3 -I app/rotator/rotator.py \
  --station examples/station.json \
  --catalog examples/catalog.json \
  --out /tmp/patefona-example-schedule \
  build --days 3 --from 2026-12-01

python3 -I app/rotator/rotator.py \
  --station examples/station.json \
  --catalog examples/catalog.json \
  --out /tmp/patefona-example-schedule \
  verify

# 3. Inspect what airs at a given UTC timestamp and run the habitual-listener audit
python3 -I app/rotator/rotator.py \
  --station examples/station.json \
  --catalog examples/catalog.json \
  --out /tmp/patefona-example-schedule \
  now --at 2026-12-01T19:30:00Z

# 4. Run the bilingual UI localization & hardcoded-Cyrillic gate (requires Node.js)
node app/site/test_i18n.mjs

Companion Manifests for bernstein-broadcast

While app/rotator/rotator.py compiles and verifies the live schedules in this repository (app/deploy/schedule_keeper.py), examples/bernstein-station.json and examples/bernstein-catalog.json expose the same 5-track public-domain fixture in bernstein-broadcast schema for external schedule compilation, asrun.jsonl reconciliation, and Ed25519 run-receipt/v1 day attestation:

bernstein-broadcast compile --station examples/bernstein-station.json --out /tmp/patefona-bernstein --days 3
bernstein-broadcast verify  --station examples/bernstein-station.json --out /tmp/patefona-bernstein

Repository Layout

Path

Purpose

app/rotator/

Deterministic hash-chained schedule compiler, qsin crossfade planner, nocturnal guards, and listener-overlap auditor.

app/radio/

Continuous f32le Icecast playout engine, -17 LUFS / valve DSP filter graph, Kids 0+ curator, cue/LUFS analyzer, shellac declicker, synthetic :00/:30 time-mark generator, and silence monitor.

app/tv/

24/7 1948 kinescope HLS & optional RTMP playout supervisor, offline FFmpeg renderer, systemd units, and nginx origin config.

app/mixer/

Stateless Streamable HTTP MCP server (POST /mcp), quota-guarded /api/mix server, and Resend HMAC-SHA256 double opt-in handler.

app/site/

Vanilla ES-module web cabinet (PT Serif / PT Sans Narrow under OFL-1.1), WebGL CRT shader, 6-stage Background Mode EQ, PWA service worker, and SEP-1649 /.well-known/mcp.json.

app/deploy/

Unprivileged cap_drop: [ALL] Docker Compose stack, CF-IPCountry EU/World Icecast geo-proxy, Caddy edge config, and atomic rsync deploy script.

examples/

Self-contained 5-track public-domain literary catalog & station manifests (patefona and bernstein-broadcast schemas).

tests/

End-to-end integration tests exercising examples/ across the rotator, DSP playout, Kids filter, and stateless MCP server.


License & Security

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables managing a PCRadio Internet radio device via its HTTP API, including playback, channels, volume, EQ, sound effects, user stations, alarms, NTP servers, and timezone settings through Streamable HTTP.
      -
    • A
      license
      A
      quality
      B
      maintenance
      Enables MCP clients such as Claude, Cursor, and VS Code Copilot to search more than 50,000 internet radio stations by name, genre, country, or language and retrieve their direct stream URLs. It also surfaces the most popular and trending stations along with country and genre listings, with no API key or account required.
      5
      59 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides a stateless Streamable HTTP MCP endpoint with 16 tools for browsing, searching, reading, writing, organizing, importing, and linking files across a read-only drive and writable workspace, including moving items between views and publishing or syncing changes back.
      MIT