An MCP (Model Context Protocol) server for text-to-speech synthesis using the OpenAI TTS API, designed to provide audio notifications for AI agents.
π¦ Package Available: This package is available on npm as
talktomedearai- an MCP server for text-to-speech synthesis with intelligent caching.
TalkToMeDearAi is a specialized MCP server that allows AI agents to convert text to audio using OpenAI's text-to-speech models. The system includes an intelligent cache system to avoid duplicate API calls and reduce costs.
- OpenAI Voice Synthesis: Uses OpenAI's best TTS models for superior audio quality
- Intelligent MP3 Cache: Automatically saves generated audio for future reuse
- Global Installation: Can be installed globally and used by multiple projects
- MCP Integration: Compatible with Claude Code, Cursor, and other MCP clients
- Agent Notifications: Perfect for audio notifications on process completion
- Simple Configuration: Guided setup for OpenAI API keys
# Global installation
npm install -g talktomedearai
# OpenAI API keys configuration
talktomedearai setup- Node.js >= 18.0.0
- OpenAI API key with access to TTS models
- Operating system: macOS, Linux, Windows
Add to your MCP configuration file:
{
"mcpServers": {
"talktomedearai": {
"command": "talktomedearai",
"args": ["serve"]
}
}
}Converts text to audio and plays or saves it
Parameters:
text(string, required): The text to convert to audiovoice(string, optional): Voice to use (alloy, echo, fable, onyx, nova, shimmer)model(string, optional): TTS model (tts-1, tts-1-hd)save_only(boolean, optional): If true, only saves without playingoutput_path(string, optional): Custom path to save the file
Example:
await mcp.callTool("speak_text", {
text: "Process completed successfully!",
voice: "alloy",
model: "tts-1-hd"
});Plays a predefined energetic audio notification to indicate the start of a process
Uses file: sounds/start.mp3 (customizable by replacing the file)
Parameters:
save_only(boolean, optional): If true, only saves without playing
Example:
await mcp.callTool("start_notification", {});Plays a predefined attention-grabbing audio notification to signal important warnings
Uses file: sounds/alert.mp3 (customizable by replacing the file)
Parameters:
save_only(boolean, optional): If true, only saves without playing
Example:
await mcp.callTool("alert_notification", {});Plays a predefined satisfying audio notification to indicate process completion
Uses file: sounds/finish.mp3 (customizable by replacing the file)
Parameters:
save_only(boolean, optional): If true, only saves without playing
Example:
await mcp.callTool("finish_notification", {});To customize notification sounds, simply replace the files in the sounds/ directory:
# In project directory or global package
sounds/
βββ start.mp3 # Start sound
βββ alert.mp3 # Alert sound
βββ finish.mp3 # Completion soundThe tools search first in the local project directory, then in the global package installation directory.
talktomedearai/
βββ src/
β βββ server.ts # Main MCP server
β βββ tts/
β β βββ client.ts # OpenAI TTS client
β β βββ cache.ts # MP3 cache system
β βββ config/
β β βββ setup.ts # API keys configuration
β βββ tools/
β βββ speak.ts # Speech synthesis tool
βββ dist/ # Build output
βββ cache/ # MP3 cache files
βββ package.json
βββ tsconfig.json
βββ README.md
For detailed information on upcoming developments, see the ROADMAP.
Complete guide: π Claude Code Integration
npm install -g talktomedearai && talktomedearai setup- Add MCP configuration
- Restart Claude Code
- Use the
speak_texttool in your agents
Complete guide: π Cursor Integration
npm install -g talktomedearai && talktomedearai setup- Configure MCP settings
- Integrate with build scripts and development workflow
- Receive voice notifications during development
# Set maximum cache size (MB)
talktomedearai config --cache-size 500
# Set cache duration (days)
talktomedearai config --cache-duration 30
# Clear cache
talktomedearai cache clearThe system supports all OpenAI TTS models:
tts-1: Fast and efficienttts-1-hd: High audio quality
alloy: Neutral and balancedecho: Male and clearfable: Expressive and dramaticonyx: Deep and authoritativenova: Young and energeticshimmer: Sweet and melodious
The cache system automatically saves all generated audio files with hash based on:
- Text content
- Selected voice
- Used model
This ensures immediate reuse for identical texts and drastically reduces API costs.
-
"API Key not configured"
talktomedearai setup
-
"Cannot play audio"
- Verify that the system has an audio player configured
- On Linux you might need to install
soxoraplay
-
"Cache full"
talktomedearai cache clean --older-than 7d
- API keys are stored securely in the system keychain
- Cache files are stored locally and not shared
- All audio data is processed locally after download
- Typical cache hit rate: 85-95%
- API cost reduction: up to 90%
- Cache response time: <50ms
- OpenAI API latency: 1-3 seconds
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License - see LICENSE for details.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: support@talktomedearai.dev
- Author: Marco Bramato
- Email: marco@bramato.com
Love coding with chill vibes? Support this project by listening to my developer album:
Perfect background music for your coding sessions
Every stream helps support the development of free tools like this one! π
Note: This project is optimized for use with AI agents and automation systems. For general TTS use, consider simpler alternatives.