RestfulTTS
Generates telephony-ready text-to-speech audio in Asterisk-compatible formats such as raw signed linear (sln/sln16) and G.711 µ-law/A-law, suitable for PBX announcements.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@RestfulTTSConvert 'Welcome to the office' to English speech as a WAV file."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
RestfulTTS
Text-to-speech for PhonixPBX announcements, served over a REST API, an MCP server and a small web UI.
Language | Voices | Model |
German ( |
| Thorsten-Voice/Kokoro, a Kokoro-82M fine-tune on the CC0 Thorsten-Voice dataset |
English ( |
| |
French ( |
| hexgrad/Kokoro-82M |
Italian ( |
| hexgrad/Kokoro-82M; both voices are only graded "C" by Kokoro |
Inspired by nazdridoy/kokoro-tts. Unlike that project, it uses the
PyTorch kokoro package instead of kokoro-onnx, because the German model only exists as a PyTorch checkpoint.
It also needs the semidark forks of kokoro and misaki; only those
forks contain the German G2P.
Run
With Podman (CPU only), from the released image (linux/amd64 and linux/arm64):
podman run -d -p 8000:8000 -v restfultts_data:/data ghcr.io/phonixpbx/restfultts:latestOr built from source:
podman-compose up -d # or: podman build -t restfultts . && podman run -p 8000:8000 -v restfultts_data:/data restfulttsThe first start downloads about 650 MB of models and voices into the /data volume, which can take several minutes.
Later starts load them from the volume.
Locally with uv and Python 3.12:
uv sync --extra dev
uv run restfultts download # optional: fetch all models up front
uv run restfultts serve # http://127.0.0.1:8000
uv run restfultts say "Guten Tag." -o hallo.wav
uv run restfultts say "Buongiorno." -l it -f ulaw -o hallo.ulawThe UI is at /, the OpenAPI docs are at /docs, and the MCP endpoint is /mcp.
Related MCP server: TTS MCP Server
Configuration
Environment variables (or an .env file):
Variable | Default | Description |
| empty | When set, REST and MCP need |
|
| Holds the audio cache. In the container it also holds the models ( |
| empty ( | Languages whose models are loaded at startup; others load on the first request. |
|
|
|
|
| Checkpoint of the German model (1–10). |
|
| Longer texts are rejected with 413. |
|
| Size limit of the audio cache; the least recently used files are removed first. |
|
| Listen address ( |
| empty | Comma separated host names the server answers to, e.g. |
REST API
Method and path | Description |
| Body |
| Same as |
| A file from the cache. |
| Deletes a file from the cache, with all formats derived from the same synthesis. Returns 204, or 404 if it is not in the cache. |
| Metadata. |
| Compatible with the |
Synthesis responses carry the headers X-Cache: hit|miss and X-Voice.
Formats:
Format | Rate | Content |
| 24 kHz | Original quality |
| 16 kHz | WAV |
| 8 kHz | WAV |
| 8 kHz | Asterisk raw signed linear, 16 bit |
| 16 kHz | Asterisk raw signed linear, 16 bit |
| 8 kHz | Raw G.711 µ-law |
| 8 kHz | Raw G.711 A-law |
The G.711 encoders give the same output as Python's audioop for every 16-bit sample.
curl -o ansage.wav -H 'Content-Type: application/json' \
-d '{"text": "Guten Tag und willkommen."}' http://localhost:8000/tts
curl -o ansage.ulaw 'http://localhost:8000/api/v1/synthesize?text=Benvenuti&language=it&format=ulaw'Each text is synthesized once and cached as 24 kHz WAV. Other formats of the same text are derived from that file.
MCP
The MCP endpoint uses Streamable HTTP (stateless, JSON responses) at http://<host>:8000/mcp. If a token is
configured, clients send it as a bearer token. It offers three tools:
list_voices(language?)list_formats()delete_audio(url)deletes a file and all its formats.synthesize(text, voice?, language?, speed?, format?)returns the audio as MCP audio content, plus a JSON text with the voice, the duration and the download path.
claude mcp add --transport http restfultts http://localhost:8000/mcp --header "Authorization: Bearer $TOKEN"Development
uv run pytest -q # unit, API, MCP and UI tests with a fake engine
uv run pytest -m models # real synthesis in all four languages (downloads the models)
uv run ruff check . && uv run ruff format --check . && uv run mypy src
scripts/test-container.sh <image> # smoke test of a built image, as in CI
scripts/vendor-update.sh # refresh Tabler 1.7.1 / htmx 4.0.0 (same versions as PhonixPBX)Releases are tagged vX.Y.Z. CI then builds and pushes the container image and creates the GitHub release from
CHANGELOG.md; see docs/RELEASING.md.
Licenses
RestfulTTS is licensed under Apache-2.0. Both models are Apache-2.0, and the Thorsten-Voice dataset is CC0.
For phonemization, misaki uses espeak-ng through phonemizer-fork and espeakng-loader. Both are GPL-3 and are
installed as unmodified Python dependencies. Unlike in PhonixPBX, espeak-ng does not produce the speech here; it only
converts text to phonemes for Kokoro. See NOTICE.
This server cannot be deployed
Maintenance
Related MCP Connectors
Generate English and Chinese speech, split long text, track batch jobs, and download audio.
Text to speech, voice listing and phrase library search for AI assistants. API key header.
Text to speech in 200+ languages, voice cloning, voice design and SRT captions.
Hosted text-to-speech MCP server: 66 voices in 9 languages, long-form narration, podcasts.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProfile-driven MCP server for Google Cloud Text-to-Speech that exposes tools to synthesize text to speech, run diagnostics, and stop playback, with voice and settings locked per profile.34 PyPI1MIT
- AlicenseNot gradedqualityDmaintenanceProvides Text-to-Speech (TTS) functionality using Google TTS API, enabling audio generation, voice listing, and style templates via MCP.30 npm1MIT
- AlicenseAqualityBmaintenanceEnables MCP clients to synthesize text into speech locally and play it through the machine's audio, with selectable voices and playback speed.245 PyPIApache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables converting text to speech audio in 20+ languages, returning base64-encoded MP3 output via Google TTS with x402 micropayment-based pay-per-call access.MIT