loading…
Search for a command to run...
loading…
MCP server plugin for Claude Code that converts text to speech using OpenAI's TTS API. Features 6 voices, worker pool architecture, mutex-protected playback, an
MCP server plugin for Claude Code that converts text to speech using OpenAI's TTS API. Features 6 voices, worker pool architecture, mutex-protected playback, and cross-platform support.
Go Version License CI codecov MCP
A Text-to-Speech MCP server plugin for Claude Code that converts text to speech using OpenAI's TTS API. Get audio feedback from Claude as you work!

speak-text binary for direct TTS without MCP# One-liner installation
curl -fsSL https://raw.githubusercontent.com/ybouhjira/claude-code-tts/main/install.sh | bash
Or install manually:
git clone https://github.com/ybouhjira/claude-code-tts.git ~/.claude/plugins/claude-code-tts
cd ~/.claude/plugins/claude-code-tts
make install
afplay (built-in)mpv, ffplay, or mpg123Set your OpenAI API key:
export OPENAI_API_KEY="sk-..."
Or add to your shell profile (~/.zshrc or ~/.bashrc).
┌─────────────────────────────────────────────────────────────┐
│ Claude Code │
│ │ │
│ MCP Protocol │
│ │ │
│ ┌──────────────────────▼──────────────────────────────┐ │
│ │ TTS MCP Server (Go) │ │
│ │ ┌─────────────────────────────────────────────┐ │ │
│ │ │ Tool Handlers │ │ │
│ │ │ speak(text, voice) │ tts_status() │ │ │
│ │ └─────────────┬─────────┴─────────────────────┘ │ │
│ │ │ │ │
│ │ ┌─────────────▼─────────────────────────────┐ │ │
│ │ │ Worker Pool (2 workers) │ │ │
│ │ │ ┌─────────┐ ┌─────────────────────┐ │ │ │
│ │ │ │ Job │───►│ Queue (50 slots) │ │ │ │
│ │ │ │ Submit │ └──────────┬──────────┘ │ │ │
│ │ │ └─────────┘ │ │ │ │
│ │ │ ┌────────▼────────┐ │ │ │
│ │ │ │ Worker 1 │ 2 │ │ │ │
│ │ │ └────────┬────────┘ │ │ │
│ │ └────────────────────────────│──────────────┘ │ │
│ │ │ │ │
│ │ ┌────────────────────────────▼──────────────────┐ │ │
│ │ │ OpenAI TTS API │ │ │
│ │ │ POST /v1/audio/speech │ │ │
│ │ │ Model: tts-1 │ │ │
│ │ └───────────────────┬────────────────────────────┘ │ │
│ │ │ │ │
│ │ ┌───────────────────▼────────────────────────────┐ │ │
│ │ │ Audio Player (Mutex Protected) │ │ │
│ │ │ macOS: afplay │ Linux: mpv │ Win: PowerShell │ │ │
│ │ └─────────────────────────────────────────────────┘ │ │
│ └──────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
Convert text to speech and play it aloud.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
text |
string | Yes | Text to speak (max 4096 chars) |
voice |
string | No | Voice to use (default: alloy) |
Available Voices:
| Voice | Description |
|---|---|
alloy |
Neutral, balanced |
echo |
Male, warm |
fable |
British accent |
onyx |
Deep male |
nova |
Female, friendly |
shimmer |
Soft female |
Example:
Use the speak tool to say "Build completed successfully!" with the nova voice.
Get the current status of the TTS system.
Returns:
{
"worker_count": 2,
"queue_size": 50,
"queue_pending": 0,
"total_processed": 15,
"total_failed": 0,
"is_playing": false,
"recent_jobs": [...]
}
This plugin includes a Stop hook that automatically speaks the first sentence of every Claude response. No configuration needed - it just works.
How it works:
Claude responds → Stop hook fires → First sentence extracted → Audio plays
The hook runs in the background and won't block Claude's responses.
A standalone binary for direct TTS without going through MCP:
# Basic usage
speak-text "Hello world"
# With voice selection
speak-text -voice onyx "Error occurred"
Located at ~/.claude/plugins/claude-code-tts/bin/speak-text after installation.
claude-code-tts/
├── cmd/
│ ├── tts-server/
│ │ └── main.go # MCP server entry point
│ └── speak-text/
│ └── main.go # Standalone CLI binary
├── hooks/
│ └── auto-speak.sh # Stop hook for deterministic TTS
├── internal/
│ ├── audio/
│ │ └── player.go # Cross-platform audio playback
│ ├── server/
│ │ ├── server.go # MCP server & tool handlers
│ │ └── worker.go # Worker pool implementation
│ └── tts/
│ └── openai.go # OpenAI TTS client
├── plugin.json # Plugin metadata + hook config
├── Makefile # Build automation
└── install.sh # One-liner installer
# Clone the repository
git clone https://github.com/ybouhjira/claude-code-tts.git
cd claude-code-tts
# Build
make build
# Install to Claude Code plugins
make install
# Run tests
make test
Set your OpenAI API key:
export OPENAI_API_KEY="sk-..."
Install one of: mpv, ffplay, or mpg123:
# Ubuntu/Debian
sudo apt install mpv
# Fedora
sudo dnf install mpv
# Arch
sudo pacman -S mpv
Check that afplay works:
# Test with a sample audio file
afplay /System/Library/Sounds/Ping.aiff
The default queue size is 50. If you're hitting this limit:
tts_status() to see pending jobsThis plugin uses OpenAI's tts-1 model:
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
MIT License - see LICENSE for details.
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"ybouhjira-claude-code-tts": {
"command": "npx",
"args": []
}
}
}