MCP Audio Server
Enables text-to-speech conversion with smart language detection (using Google TTS for Chinese) and audio file playback with playback controls for Claude Desktop.
README
MCP Audio Server 🔊
A powerful Model Context Protocol (MCP) server that provides text-to-speech and audio playback capabilities for Claude Desktop and other MCP clients.
✨ Features
- 🗣️ High-Quality TTS:
- Smart Language Detection: Automatically uses Google's TTS for high-quality Chinese speech and falls back to the system's TTS for other languages.
- Voice Selection: For non-Chinese text, list and select from various system-installed voices.
- Customizable Speech: Adjust rate and volume for a tailored listening experience.
- 🎵 Audio File Playback: Play various audio formats (WAV, MP3, OGG, etc.).
- ⏹️ Audio Control: Stop playback and get real-time audio status.
- 🔌 MCP Compliant: Fully compatible with Claude Desktop and MCP specification 2024-11-05.
- 🛡️ Error Handling: Robust error handling and validation.
- 📊 Status Monitoring: Real-time audio system status and playback information.
🚀 Quick Start
Prerequisites
- Python 3.8+
- Claude Desktop (for MCP integration)
- System audio capabilities
Installation
- Clone the repository:
git clone https://github.com/yourusername/mcp-audio-server.git
cd mcp-audio-server
- Install dependencies:
pip install -r requirements.txt
- Configure Claude Desktop:
Add to your
claude_desktop_config.json:
{
"mcpServers": {
"audio-server": {
"command": "/path/to/your/python",
"args": ["/path/to/mcp-audio-server/audio_server.py"]
}
}
}
- Restart Claude Desktop and start using audio features!
🛠️ Available Tools
| Tool | Description | Parameters |
|---|---|---|
speak_text |
Convert text to speech. Automatically uses Google TTS for Chinese. | text (required), rate (optional), volume (optional), voice_id (optional, for non-Chinese) |
list_voices |
List available TTS voices for non-Chinese languages. | None |
play_audio_file |
Play an audio file. | file_path (required), volume (optional) |
stop_audio |
Stop current audio playback. | None |
get_audio_status |
Get audio system status. | None |
📖 Usage Examples
Text-to-Speech (Chinese)
"请用语音说出 '你好,世界'"
This will automatically use Google TTS for a natural-sounding voice.
Text-to-Speech (English, with a specific voice)
- First, list available voices:
"List all available voices" - Then, use a specific voice ID from the list:
"Use the voice with ID 'com.apple.speech.synthesis.voice.daniel' to say 'Hello, this is a test.'"
Play Audio File
"Play the audio file at /path/to/music.mp3"
Stop Audio
"Stop the current audio playback"
Check Status
"What's the current audio status?"
🧪 Testing
Run the comprehensive test suite:
# Test all MCP methods
python test_all_mcp_methods.py
# Test Claude Desktop format compatibility
python test_claude_desktop_format.py
# Test audio functionality
python test_audio_server.py
# Interactive testing mode
python audio_server.py --interactive
📁 Project Structure
mcp-audio-server/
├── audio_server.py # Main MCP server
├── requirements.txt # Python dependencies
├── README.md # English documentation (default)
├── README_CN.md # Chinese documentation
├── .gitignore # Git ignore rules
├── tests/ # Test files
│ ├── test_*.py # Various tests
│ └── validate_*.py # Validation scripts
├── examples/ # Configuration examples
│ ├── claude_desktop_config.json
│ └── other config files
├── scripts/ # Utility scripts
│ ├── install_and_setup.sh
│ └── other shell scripts
└── docs/ # Additional documentation
├── INTEGRATION_GUIDE.md # Integration guide
├── USAGE_GUIDE.md # Usage guide
└── FINAL_INTEGRATION_REPORT.md
🔧 Configuration
Claude Desktop Configuration
The server integrates seamlessly with Claude Desktop. Make sure your configuration file is properly set up:
Location:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Example configuration:
{
"mcpServers": {
"audio-server": {
"command": "/Users/yourusername/miniconda3/envs/mcp_agent/bin/python",
"args": ["/path/to/mcp-audio-server/audio_server.py"]
}
}
}
🐛 Troubleshooting
Common Issues
- Audio not playing: Check system audio settings and permissions
- TTS not working: Ensure pyttsx3 is properly installed
- MCP connection issues: Verify Claude Desktop configuration path
- Permission errors: Check file permissions for audio files
Debug Mode
Run in interactive mode for debugging:
python audio_server.py --interactive
🤝 Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Built with the Model Context Protocol (MCP)
- Uses pyttsx3 for text-to-speech
- Uses pygame for audio playback
- Compatible with Claude Desktop
📞 Support
If you encounter any issues or have questions:
- Check the troubleshooting section
- Review the integration guide
- Open an issue on GitHub
- Check Claude Desktop documentation
Made with ❤️ for the MCP community
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。