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.

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.1.tar.gz (38.4 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.1-py3-none-any.whl (25.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: soliloquy_tts-0.7.1.tar.gz
  • Upload date:
  • Size: 38.4 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.1.tar.gz
Algorithm Hash digest
SHA256 90cf56c243fafeb2cab389dcd66ae530a2424f49c3145f4dcbf931ab90370244
MD5 904d08bdb8800229c2c1bb8bd505a29c
BLAKE2b-256 e409a58b180d60d1e9ffd64e987bc3c6eb13adfcd0479754c85ff5076fe69589

See more details on using hashes here.

File details

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

File metadata

  • Download URL: soliloquy_tts-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 25.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b0e87fa27502bc83a87eabe2cbc75b46156108e28af560410499554aadeacaeb
MD5 940104193600e1053861933fa713122c
BLAKE2b-256 1983991f5effd2b3d183d251735bd4d12387924483a7c1dedb9b88c568a2cb98

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