
MCP_TTS_SERVER
MCP Server -Wrapper für TTS -Motoren (Kokoro TTS und OpenAI TTS)
3 years
Works with Finder
1
Github Watches
0
Github Forks
1
Github Stars
MCP TTS Server
A versatile TTS (Text-to-Speech) server built on the Model Context Protocol (MCP) framework. This server provides access to multiple TTS engines through a unified interface:
- Kokoro TTS - High-quality local TTS engine
- OpenAI TTS - Cloud-based TTS via OpenAI's API
Features
- 🌐 Multiple TTS engines in one unified server
- 🎧 Real-time streaming audio playback
- 🔄 MCP protocol support for seamless integration with Claude and other LLMs
- 🎛️ Configurable voice selection for both engines
- 💬 Support for voice customization via natural language instructions (OpenAI)
- ⚡ Speed adjustment for both TTS engines
- 🛑 Playback control for stopping audio and clearing the queue
Installation
Prerequisites
- Python 3.10 or higher
- uv package manager
- OpenAI API key (for OpenAI TTS functionality)
Quick Install
# Clone the repository
git clone https://github.com/kristofferv98/MCP_tts_server.git
cd MCP_tts_server
# Create a virtual environment and install dependencies
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv pip install -e .
Configuration
Create a .env
file based on the provided .env.example
:
cp .env.example .env
Edit the .env
file to add your OpenAI API key:
OPENAI_API_KEY=your_openai_api_key_here
Integration with Claude Desktop
To use this server with Claude Desktop:
-
Install the server:
fastmcp install ./tts_mcp.py --name tts
-
Alternatively, you can manually add the server to Claude Desktop's configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
Add this entry to the
mcpServers
section:"kokoro_tts": { "command": "uv", "args": [ "--directory", "/path/to/MCP_tts_server", "run", "tts_mcp.py" ] }
Example configuration using the full path to uv:
"kokoro_tts": { "command": "/Users/username/.local/bin/uv", "args": [ "--directory", "/Users/username/Documents/MCP_Servers/MCP_tts_server", "run", "tts_mcp.py" ] }
- macOS:
MCP Function Definitions
The server exposes the following MCP tools:
Main TTS Function
{
"description": "Convert text to speech using the preferred engine and streams the speech to the user. The base voice for the AI is the Kokoro engine, to keep AI's personality consistent. This unified function provides access to both Kokoro TTS (local) and OpenAI TTS (cloud API).",
"name": "tts",
"parameters": {
"properties": {
"text": {"title": "Text", "type": "string"},
"engine": {"default": "kokoro", "title": "Engine", "type": "string"},
"speed": {"default": 1, "title": "Speed", "type": "number"},
"voice": {"default": "", "title": "Voice", "type": "string"},
"instructions": {"default": "", "title": "Instructions", "type": "string"}
},
"required": ["text"]
}
}
Parameters:
- text (required): Text to convert to speech
- engine (optional): TTS engine to use - "kokoro" (default, local) or "openai" (cloud)
- speed (optional): Playback speed (0.8-1.5 typical)
- voice (optional): Voice name to use (engine-specific)
- instructions (optional): Voice customization instructions for OpenAI TTS
Stop Playback Function
{
"description": "Stops the currently playing audio (if any) and clears all pending TTS requests from the queue. Relies on the background worker detecting the cancellation signal.",
"name": "tts_stop_playback_and_clear_queue",
"parameters": {
"properties": {}
}
}
Voice Examples Function
{
"description": "Provides research-based examples of effective voice instructions for OpenAI TTS.",
"name": "tts_examples",
"parameters": {
"properties": {
"category": {"default": "general", "title": "Category", "type": "string"}
}
}
}
Categories:
- general
- accents
- characters
- emotions
- narration
Get TTS Instructions Function
{
"description": "Fetches TTS instructions by calling get_voice_info.",
"name": "get_tts_instructions",
"parameters": {
"properties": {}
}
}
Direct Usage
The primary way to use this server is through Claude Desktop or other MCP supported integration as described above. However, you can also run the server directly for testing purposes:
# Run with the uv environment manager
uv run python tts_mcp.py
# Or use the simplified Kokoro-only version
uv run python simple_tts_mcp.py
This will start the MCP server, making it available for connection.
Available Voices
Kokoro TTS
- Default voice:
af_heart
OpenAI TTS
- Available voices:
alloy
,ash
,ballad
,coral
,echo
,fable
,onyx
,nova
,sage
,shimmer
- Default model:
gpt-4o-mini-tts
Development and Testing
To test the server locally during development:
fastmcp dev ./tts_mcp.py
This will start the MCP Inspector interface where you can test the server's functionality.
Implementation Details
The server is implemented using FastMCP and follows best practices for MCP server development:
- Unified Interface: A single function supports both Kokoro and OpenAI engines
- Streaming Support: Audio is streamed directly to the client when possible
- Fallback Mechanisms: File-based playback when streaming isn't available
- Voice Customization: Support for natural language instructions with OpenAI TTS
- Lifespan Management: Proper initialization and cleanup of resources
Troubleshooting
- No Audio Output: Check your system's audio configuration
- OpenAI TTS Failures: Verify your API key is valid and has TTS access permissions
- Server Not Found: Make sure the MCP server is correctly registered in your MCP host
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
相关推荐
🧑🚀 全世界最好的 llm 资料总结(数据处理、模型训练、模型部署、 O1 模型、 MCP 、小语言模型、视觉语言模型) | Zusammenfassung der weltbesten LLM -Ressourcen.
🔥 1Panel bietet eine intuitive Weboberfläche und einen MCP -Server, um Websites, Dateien, Container, Datenbanken und LLMs auf einem Linux -Server zu verwalten.
⛓️Rugele ist ein leichter, leistungsstarker, leistungsstarker, eingebetteter Komponenten-Orchestrierungsregel-Motor-Rahmen für GO.
Dieses Repository dient zur Entwicklung des Azure MCP -Servers, wodurch Ihre Agenten die Leistung von Azure verleiht.
Dieses Projekt wurde erstellt, um zu demonstrieren, wie wir uns mit verschiedenen Modellkontextprotokollen (MCPs) verbinden können.
Reviews

user_VITTVS5J
As a dedicated user of the MCP_tts_server by kristofferv98, I can confidently say that it has revolutionized my text-to-speech needs. This tool offers unparalleled performance and reliability, making it an essential component of my workflow. Highly recommended for anyone seeking efficient and high-quality TTS solutions!

user_ipcg40P7
I've been using the MCP_tts_server by kristofferv98, and it has revolutionized my text-to-speech needs. The seamless integration and high-quality voice synthesis are unmatched. Easy to set up and use, it delivers incredibly natural-sounding speech. Highly recommended for anyone in need of a reliable TTS solution!

user_wDssvXeE
As a dedicated user of the MCP_tts_server by kristofferv98, I am thoroughly impressed with its performance and reliability. This text-to-speech server has revolutionized the way I integrate voice features into my projects. Its seamless functionality and user-friendly interface make it a standout choice for developers. Highly recommend it!

user_LWTPo1eN
The MCP_tts_server by kristofferv98 is a fantastic tool for anyone in need of a reliable text-to-speech solution. It's incredibly easy to set up and integrates seamlessly into my existing projects. The voice quality is impressive, making it perfect for both personal and professional use. Highly recommend!

user_1QkvnAiP
As a dedicated user of MCP_tts_server, I am incredibly impressed with its performance and reliability. The seamless integration and user-friendly interface, developed by kristofferv98, make it a top-notch solution for text-to-speech conversion. It has greatly enhanced my productivity and efficiency in managing audio content. Highly recommend MCP_tts_server for anyone in need of a robust TTS application!

user_HFVI0tZ7
As a dedicated user of MCP applications, the MCP_tts_server by kristofferv98 has truly impressed me. Its seamless integration and high-quality text-to-speech capabilities have significantly enhanced my projects. The performance is outstanding and it’s incredibly user-friendly. Highly recommend this for anyone looking to elevate their TTS needs!

user_SDVMQGHc
I've been using MCP_tts_server created by kristofferv98 and I'm thoroughly impressed. The seamless text-to-speech functionality has truly enhanced my projects. The ease of integration and high-quality voice outputs are standout features. Highly recommend for anyone in need of a reliable TTS solution!

user_q6tG8hkh
I'm really impressed with MCP_tts_server by kristofferv98. The server is efficient and user-friendly, making text-to-speech conversions smooth and hassle-free. The initial setup was straightforward, and the welcome information made the process even easier. Highly recommend for anyone looking to streamline their TTS needs!

user_x1kXojKe
MCP_tts_server by kristofferv98 is an excellent tool for text-to-speech conversion! It’s user-friendly, efficient, and provides high-quality speech output. As an avid user, I appreciate its seamless integration and the welcoming initial setup. Highly recommended for anyone needing a reliable TTS solution!

user_8NUriRKn
As a devoted user of the MCP_tts_server by kristofferv98, I am continuously impressed by its seamless text-to-speech capabilities. It provides accurate, natural-sounding voices that enhance my applications significantly. I highly recommend this tool for anyone seeking reliable TTS solutions.