Skip to main content

A text-to-speech MCP server powered by Kokoro — gives Claude Code a voice

Project description

Soliloquy

PyPI version Python License: MIT PyPI downloads

A text-to-speech MCP server powered by Kokoro — gives Claude Code a voice.

One command to install. No config, no API keys, no cloud.

Why Soliloquy?

Cloud TTS (ElevenLabs, OpenAI, etc.) Soliloquy
Privacy Text sent to third-party servers Runs entirely on your machine
Cost $0.18-15/1M chars Free forever
Offline No Yes
Usage Limits Quotas / rate limits Unlimited
Latency 200-500ms (network) ~50-100ms (local)
AI Integration Developer calls API from code AI agent decides when to speak
Setup API keys + billing One command, no config

What You Can Do

Once installed, just talk to Claude naturally:

  • "turn on auto speak" — automatically voice conversational responses
  • "read this file aloud" — listen to docs, chapters, or articles
  • "speak aloud" — voice a specific response
  • "stop" — stop audio playback

Auto-Speak

The flagship feature. Auto-speak voices every Claude conversational response automatically using a background hook — no tool call needed, zero token overhead. It just works.

"Turn on auto speak"

From that point on, everything Claude says, you hear. Toggle it off just as easily:

"Turn off auto speak"

When you use read_aloud or speak explicitly, auto-speak steps aside and lets the explicit playback finish.

Speech Normalization

Soliloquy doesn't just read text literally — it understands what sounds natural:

  • Code blocks become "See the code below" instead of reading syntax aloud
  • Tables are summarized ("There's a table here with 5 rows")
  • Symbols are spoken naturally (arrows become "to", URLs are simplified)
  • Lists are enumerated ("First... Second... Third...")
  • Paragraph breaks produce natural pauses between sections

Technical content and markdown-heavy responses sound like a person reading them to you, not a robot parsing characters.

Requirements

  • macOS, Windows, or Linux
  • Python 3.10+
  • PortAudio (audio output library)
Platform Install PortAudio
macOS brew install portaudio
Windows Bundled with sounddevice (no action needed)
Linux sudo apt install libportaudio2

Note: First install downloads ~2GB of dependencies (PyTorch, model weights). First run also downloads the Kokoro-82M model from HuggingFace.

Optional: macOS Menu Bar Control

On macOS, you can install rumps for a menu bar icon that lets you stop playback instantly — no need to go through Claude Code:

pip install rumps

Without it, everything still works — you just use the stop command through Claude Code instead.

Quick Start

Make sure PortAudio is installed (see above), then:

uvx soliloquy-tts

That's it. This registers the MCP server, configures auto-speak, and sets everything up. Restart Claude Code afterward and you're good to go.

Requires uv. Install it with brew install uv (macOS), sudo apt install uv (Linux), or see the uv docs.

What happens when you run it

  1. Registers Soliloquy as an MCP server with Claude Code
  2. Writes a hook script for automatic voicing
  3. Configures the Claude Code Stop hook

You only need to do this once. After that, Claude Code starts Soliloquy automatically in the background whenever you open a session.

With pip

pip install soliloquy-tts
soliloquy

Same setup flow. Run soliloquy from your terminal and it handles the rest.

How It Works

Soliloquy uses a hybrid architecture to share a single model across multiple Claude Code sessions:

  • First session loads the Kokoro model and starts a local backend server
  • Additional sessions detect the running backend and connect as lightweight proxies (near-instant startup, no extra memory)
  • If the backend exits, the next session automatically takes over

This is completely transparent — no configuration needed.

Reference

Tools

speak — Synthesize and play text aloud.

Parameter Default Description
text (required) Text to speak
voice af_heart Voice ID
speed 1.0 Speed multiplier (0.5 - 2.0)
lang en-us Language code

read_aloud — Read a file aloud directly. Supports plain text and markdown.

Parameter Default Description
path (required) Path to the file to read
voice af_heart Voice ID
speed 1.0 Speed multiplier (0.5 - 2.0)
lang en-us Language code

stop — Stop audio playback immediately.

auto_speak — Toggle automatic voicing on or off.

list_voices — List all available voices.

Voices

28 voices across American and British English. Default is af_heart.

View all voices
Voice Accent Gender
af_heartAmericanFemale
af_alloyAmericanFemale
af_aoedeAmericanFemale
af_bellaAmericanFemale
af_jessicaAmericanFemale
af_koreAmericanFemale
af_nicoleAmericanFemale
af_novaAmericanFemale
af_riverAmericanFemale
af_sarahAmericanFemale
af_skyAmericanFemale
am_adamAmericanMale
am_echoAmericanMale
am_ericAmericanMale
am_fenrirAmericanMale
am_liamAmericanMale
am_michaelAmericanMale
am_onyxAmericanMale
am_puckAmericanMale
am_santaAmericanMale
bf_aliceBritishFemale
bf_emmaBritishFemale
bf_isabellaBritishFemale
bf_lilyBritishFemale
bm_danielBritishMale
bm_fableBritishMale
bm_georgeBritishMale
bm_lewisBritishMale

Languages

en-us (default), en-gb, ja, zh, es, fr, hi, it, pt-br

Uninstall

soliloquy --uninstall

This removes the MCP server registration, auto-speak hook, and all config files. Works with uvx soliloquy-tts --uninstall too.

Development

git clone https://gitlab.com/bw-stovall/soliloquy.git
cd soliloquy
python3.11 -m venv .venv
source .venv/bin/activate
pip install -e .[dev]
pytest tests/ -v

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

soliloquy_tts-0.7.3.tar.gz (42.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

soliloquy_tts-0.7.3-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

Details for the file soliloquy_tts-0.7.3.tar.gz.

File metadata

  • Download URL: soliloquy_tts-0.7.3.tar.gz
  • Upload date:
  • Size: 42.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for soliloquy_tts-0.7.3.tar.gz
Algorithm Hash digest
SHA256 bf6ec58423af3b1e07544211f87acadaa2a873a02dacca88fd7cc5eb369eb62d
MD5 83bbb6b43b809d50b78f7a56ec381226
BLAKE2b-256 e45bcada81830a33d71fbed411b2c5238e6255b85bc1308675282058f31c8acd

See more details on using hashes here.

File details

Details for the file soliloquy_tts-0.7.3-py3-none-any.whl.

File metadata

  • Download URL: soliloquy_tts-0.7.3-py3-none-any.whl
  • Upload date:
  • Size: 28.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for soliloquy_tts-0.7.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3cc8760160536ae8b66a91e75feda5f8f56b968ff5952d2a2674a30c59610947
MD5 b0533fdf50948f349a328e490c0c7299
BLAKE2b-256 82f8f8f798751388a2761be2c3e2f530e4d7ab4d27ccea89772624544327c45c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page