Skip to main content

Profile-driven MCP server for Google Cloud Text-to-Speech

Project description

tts-mcp

Profile-driven MCP server for Google Cloud Text-to-Speech.

Exposes three tools to any MCP client:

  • tts_speak — synthesize text to audio and auto-play it
  • tts_doctor — run diagnostics on auth, profile, and playback
  • tts_stop — stop any currently playing audio

Voice, language, model, and format are locked per profile — the LLM can only control text content, speaking rate, and pitch.

Install

pip install tts-mcp

Or with uvx (no install needed):

uvx tts-mcp --help

Prerequisites

  • Python 3.11+
  • A Google Cloud project with the Cloud Text-to-Speech API enabled
    • Google offers a generous free tier — up to 4 million characters/month for Standard/WaveNet voices and 1 million characters/month for Neural2, Polyglot, and Chirp3 HD voices, more than enough for most individual use. See TTS pricing for details.
  • Google Cloud CLI (gcloud) for authentication
  • macOS uses afplay for playback by default (configurable via profile)

Setup

1. Authenticate with Google Cloud

gcloud auth application-default login
gcloud auth application-default set-quota-project YOUR_PROJECT_ID

This stores credentials at ~/.config/gcloud/application_default_credentials.json, which the TTS client discovers automatically. No environment variables needed.

2. Create a profiles file

tts-mcp --init

This creates a starter config at ~/.config/tts-mcp/profiles.json with example profiles for every Google TTS voice tier. Edit it to pick your voice, format, and playback settings.

The server finds the profiles file automatically — no --profiles flag needed for the common case. The search order is:

  1. --profiles flag or GTTS_PROFILES env var (explicit override)
  2. ~/.config/tts-mcp/profiles.json (XDG standard — created by tts-mcp --init)
  3. ./tts_profiles.json (local dev fallback)

MCP client setup

After running tts-mcp --init, no --profiles flag is needed — the server finds ~/.config/tts-mcp/profiles.json automatically. Just pass --profile to select which profile each client uses.

Claude Code

claude mcp add --transport stdio --scope user \
  speech -- tts-mcp --profile claude

OpenCode

Edit ~/.config/opencode/opencode.jsonc:

{
  "mcp": {
    "speech": {
      "type": "local",
      "command": ["tts-mcp", "--profile", "opencode"],
      "enabled": true,
      "timeout": 120000
    }
  }
}

Codex CLI

Edit ~/.codex/config.toml:

[mcp_servers.speech]
command = "tts-mcp"
args = ["--profile", "codex"]

Using uvx (no global install)

Any client config can use uvx instead of installing globally:

{
  "command": "uvx",
  "args": ["tts-mcp", "--profile", "opencode"]
}

Usage

In any MCP-enabled client, prompt naturally:

  • Summarize this and read it aloud. use speech
  • Stop current playback. use speech

Tool names may appear prefixed by the client (e.g. speech_tts_speak, speech_tts_stop).

CLI reference

The package installs four commands. Each supports --help for full details.

tts-mcp — MCP server and management

tts-mcp --init              # create starter config at ~/.config/tts-mcp/profiles.json
tts-mcp --init --force      # overwrite existing config
tts-mcp --doctor            # diagnostics: auth, profile, voice, player
tts-mcp --profile casual    # start MCP server with a specific profile

tts-speak — synthesize text to audio

tts-speak --text "Hello world" --voice en-US-Chirp3-HD-Fenrir --format wav --out hello.wav
tts-speak --text-file notes.txt --voice en-US-Neural2-D --format mp3 --out notes.mp3
tts-speak --ssml --text "<speak>Hello <break time='500ms'/> world</speak>" --out ssml.wav
echo "Piped text" | tts-speak --voice en-US-Casual-K --out piped.ogg

Options: --voice, --language, --model, --format (mp3/ogg/wav), --speaking-rate, --pitch, --out, --usage-log.

tts-voices — list available voices

tts-voices                              # list all voices
tts-voices --language en-US             # filter by language
tts-voices --language en-US --family Chirp3   # filter by family
tts-voices --limit 5                    # limit results

tts-batch — generate samples for multiple voices

tts-batch --text-file test.txt --out-dir ./samples
tts-batch --text-file test.txt --families Chirp3,Neural2 --language en-US --format wav
tts-batch --text-file test.txt --limit 3   # first 3 matching voices only

Profile system

Profiles are defined in a JSON file (see profiles.example.json):

{
  "default_profile": "opencode",
  "profiles": {
    "opencode": {
      "voice": "en-US-Chirp3-HD-Fenrir",
      "language": "en-US",
      "model": "models/chirp3-hd",
      "format": "wav",
      "speaking_rate": 1.0,
      "pitch": 0.0,
      "output_dir": "~/.local/share/tts-mcp/out",
      "usage_log": "~/.local/share/tts-mcp/usage_log.csv",
      "autoplay": true,
      "player_command": ["afplay", "{file}"]
    }
  }
}

Each profile locks: voice, language, model, format, output_dir, usage_log, autoplay, and player_command. Only speaking_rate and pitch can be overridden per tool call.

Troubleshooting

  • Auth errors — run gcloud auth application-default login, or confirm GOOGLE_APPLICATION_CREDENTIALS is set.
  • No audio — verify the player binary (e.g. afplay) exists, or change player_command in your profile.
  • Tool timeout — playback is non-blocking, but if timeouts persist, increase the client's tool_timeout.
  • Run diagnosticstts-mcp --doctor checks auth, profile, voice, and player.

Development

git clone git@github.com:that-lucas/tts-mcp.git
cd tts-mcp
make setup    # creates venv, installs package + dev deps, sets git hooks
make test     # run pytest
make lint     # run ruff check + format check

See CONTRIBUTING.md for details.

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

tts_mcp-0.1.2.tar.gz (23.4 kB view details)

Uploaded Source

Built Distribution

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

tts_mcp-0.1.2-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file tts_mcp-0.1.2.tar.gz.

File metadata

  • Download URL: tts_mcp-0.1.2.tar.gz
  • Upload date:
  • Size: 23.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tts_mcp-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e0742fa3419b900c259c6a01c53187d8d8265569216ee740f93a1420bc520e7e
MD5 fd3a5684a2c0d05f8e3befd6d3718a88
BLAKE2b-256 9e067e83378c98151a7eb45f778bc3af3269f9d6695064eb3ab7bdf56de3d139

See more details on using hashes here.

Provenance

The following attestation bundles were made for tts_mcp-0.1.2.tar.gz:

Publisher: release.yml on that-lucas/tts-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tts_mcp-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: tts_mcp-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tts_mcp-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c7e5284c60302f7888af062960c3b0eec9526424bb319c29b470d9f41292753b
MD5 d23e52c4fb83a529f3db17e03be8e7a3
BLAKE2b-256 37a69d9e452318d1e8c0c6e46460de12ea92e13bb7166ecec65f696a1ed9e4c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for tts_mcp-0.1.2-py3-none-any.whl:

Publisher: release.yml on that-lucas/tts-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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