A Model Context Protocol (MCP) server that integrates ElevenLabs Text-to-Speech with OpenCode, allowing the assistant to speak its responses aloud.
- Native integration with OpenCode through MCP
- Support for all ElevenLabs voices
- Automatic audio playback on Linux (PulseAudio)
- Simple and secure configuration
- Clean and documented code
- Node.js 16+
- ElevenLabs API key
- PulseAudio (for audio playback on Linux)
- OpenCode with MCP support
- Clone the repository:
git clone https://github.com/kurojs/elevenlabs-mcp-tts.git
cd elevenlabs-mcp-tts- Install dependencies:
npm install- Configure your API key in the server file:
nano src/server.jsUpdate line 64 with your ElevenLabs API key.
- Edit OpenCode configuration file:
nano ~/.config/opencode/opencode.json- Add the MCP server:
{
"mcp": {
"elevenlabs-tts": {
"type": "local",
"command": ["node", "/home/kuro/mcp-tts/server.js"],
"enabled": true
}
}
}- Restart OpenCode
Once configured, you can use the tool in OpenCode:
use text_to_speech to say "hello world"
Or for automatic responses:
from now on, use text_to_speech for all your responses
The text_to_speech tool accepts these parameters:
text(required): Text to convertvoice_id(optional): Voice ID (default: 01Sca6E8phd1rq7mKoii)model_id(optional): Model (default: eleven_multilingual_v2)
CwhRBWXzGAHq8TQ4Fs17- Roger (English, widely available)EXAVITQu4vr4xnSDxMaL- Sarah (English)FGY2WhTYpPnrIDTdsKH5- Laura (English)IKne3meq5aSn9XLyUdCD- Charlie (English)
- Check that PulseAudio is working:
pactl info - Make sure you have audio drivers installed
- Check system volume
- Verify the API key in server.js is valid
- Make sure you have credits in ElevenLabs
- Check that the API key is correctly configured in the server file
- Verify the path in the configuration file
- Make sure the
server.jsfile is executable - Check directory permissions
To test the MCP server manually:
echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {}}' | node src/server.jsFor development with auto-reload:
npm run dev- Fork the project
- Create a branch:
git checkout -b feature/new-feature - Commit:
git commit -am 'Add new feature' - Push:
git push origin feature/new-feature - Pull Request
MIT License - see LICENSE file for details.
- ElevenLabs for the amazing TTS API
- OpenCode for MCP support
- The open source community