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! - Deterministic Auto-Speak: Every Claude response is automatically spoken (via Stop hook) - 6 High-Quality Voices: alloy, echo, fable, onyx, nova, shimmer - Worker Pool Architecture: Non-blocking queue with concurrent processing - Mutex-Protected Playb
Add this skill
npx mdskills install ybouhjira/claude-code-ttsWell-architected TTS plugin with excellent docs, cross-platform support, and deterministic auto-speak.
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.
Best experience: Claude Code
/plugin marketplace add ybouhjira/claude-code-ttsThen /plugin menu → select skill → restart. Use /skill-name:init for first-time setup.
Other platforms
Install via CLI
npx mdskills install ybouhjira/claude-code-ttsClaude Code TTS Plugin is a free, open-source AI agent skill. 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! - Deterministic Auto-Speak: Every Claude response is automatically spoken (via Stop hook) - 6 High-Quality Voices: alloy, echo, fable, onyx, nova, shimmer - Worker Pool Architecture: Non-blocking queue with concurrent processing - Mutex-Protected Playb
Install Claude Code TTS Plugin with a single command:
npx mdskills install ybouhjira/claude-code-ttsThis downloads the skill files into your project and your AI agent picks them up automatically.
Claude Code TTS Plugin works with Claude Code, Claude Desktop, Cursor, Vscode Copilot, Windsurf, Continue Dev, Codex, Gemini Cli, Amp, Roo Code, Goose, Opencode, Trae, Qodo, Command Code. Skills use the open SKILL.md format which is compatible with any AI coding agent that reads markdown instructions.