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 ittts_doctor— run diagnostics on auth, profile, and playbacktts_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
afplayfor 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
Copy the example and customize:
cp tts_profiles.example.json tts_profiles.json
Each profile fixes voice, language, model, format, output directory, and playback settings. See tts_profiles.example.json for the full schema.
MCP client setup
Claude Code
claude mcp add --transport stdio --scope user \
speech -- \
tts-mcp --profiles /path/to/tts_profiles.json --profile claude_code
OpenCode
Edit ~/.config/opencode/opencode.jsonc:
{
"mcp": {
"speech": {
"type": "local",
"command": [
"tts-mcp",
"--profiles", "/path/to/tts_profiles.json",
"--profile", "opencode"
],
"enabled": true,
"timeout": 120000
}
}
}
Codex CLI
Edit ~/.codex/config.toml:
[mcp_servers.speech]
command = "tts-mcp"
args = [
"--profiles", "/path/to/tts_profiles.json",
"--profile", "codex"
]
Using uvx (no global install)
Any client config can use uvx instead of installing globally:
{
"command": "uvx",
"args": ["tts-mcp", "--profiles", "/path/to/tts_profiles.json", "--profile", "opencode"]
}
Usage
In any MCP-enabled client, prompt naturally:
Summarize this and read it aloud. use speechStop current playback. use speech
Tool names may appear prefixed by the client (e.g. speech_tts_speak, speech_tts_stop).
CLI tools
The package also installs standalone CLI commands:
| Command | Description |
|---|---|
tts-mcp |
Start the MCP server |
tts-speak |
Synthesize text to audio from the CLI |
tts-voices |
List available Google TTS voices |
tts-batch |
Generate samples for multiple voices |
tts-speak --text "Hello world" --voice en-US-Chirp3-HD-Fenrir --format wav --out hello.wav
tts-voices --language en-US --family Chirp3
tts-mcp --doctor --profiles tts_profiles.json --profile opencode
Profile system
Profiles are defined in a JSON file (see tts_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": "./out",
"usage_log": "./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 confirmGOOGLE_APPLICATION_CREDENTIALSis set. - No audio — verify the player binary (e.g.
afplay) exists, or changeplayer_commandin your profile. - Tool timeout — playback is non-blocking, but if timeouts persist, increase the client's
tool_timeout. - Run diagnostics —
tts-mcp --doctor --profiles tts_profiles.jsonchecks auth, profile, voice, and player.
Development
git clone git@github.com:that-lucas/tts-mcp.git
cd tts-mcp
make setup
pip install -e ".[dev]"
pytest
ruff 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tts_mcp-0.1.1.tar.gz.
File metadata
- Download URL: tts_mcp-0.1.1.tar.gz
- Upload date:
- Size: 22.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26795aac13c7114751beba5ed3b52f9bea2c683098c1ad250a7803ec9c57e3f6
|
|
| MD5 |
13077bf14bf4b7d1417fbd6d237e710f
|
|
| BLAKE2b-256 |
8af9e2b11aeb369820eab2bcb54ea5d67898d7661e5fbc18240aa76167daf933
|
Provenance
The following attestation bundles were made for tts_mcp-0.1.1.tar.gz:
Publisher:
release.yml on that-lucas/tts-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tts_mcp-0.1.1.tar.gz -
Subject digest:
26795aac13c7114751beba5ed3b52f9bea2c683098c1ad250a7803ec9c57e3f6 - Sigstore transparency entry: 941530656
- Sigstore integration time:
-
Permalink:
that-lucas/tts-mcp@25716b7d21a0ccb44c7f381bcb701deed37b9b84 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/that-lucas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@25716b7d21a0ccb44c7f381bcb701deed37b9b84 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tts_mcp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: tts_mcp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6eca7bc6e30a0a6d1cf0c57185dfe166afff69ba60f4cd5a97b6af30c4e37ecf
|
|
| MD5 |
13102c15891870cd955c04c3fde5e3bf
|
|
| BLAKE2b-256 |
e2d29a289769efbd1c0bc679cc163e2310744c59bfcbb00a78fb0a8a173849d0
|
Provenance
The following attestation bundles were made for tts_mcp-0.1.1-py3-none-any.whl:
Publisher:
release.yml on that-lucas/tts-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tts_mcp-0.1.1-py3-none-any.whl -
Subject digest:
6eca7bc6e30a0a6d1cf0c57185dfe166afff69ba60f4cd5a97b6af30c4e37ecf - Sigstore transparency entry: 941530722
- Sigstore integration time:
-
Permalink:
that-lucas/tts-mcp@25716b7d21a0ccb44c7f381bcb701deed37b9b84 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/that-lucas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@25716b7d21a0ccb44c7f381bcb701deed37b9b84 -
Trigger Event:
push
-
Statement type: