CosyVoice MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@CosyVoice MCP ServerUse the storyteller role to read this text aloud."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
CosyVoice MCP Server
这是一个基于Model Context Protocol (MCP)的语音合成服务端,支持通过uvx运行。
功能特性
文本转语音(TTS)合成
多种AI角色语音
支持流式播放
与Claude Desktop集成
Related MCP server: Voicevox MCP Server
安装和运行
方法:传统Python运行
# 安装依赖
pip install -r requirements.txt
# 运行服务
python src/mcp_server.pyClaude Desktop配置
在Claude Desktop的配置文件中添加:
{
"mcpServers": {
"cosyvoice-mcp": {
"command": "python",
"args": [
"f:\\MCPProject\\WebMCPServers\\cosyVoice-mcp\\src\\mcp_server.py"
],
"cwd": "f:\\MCPProject\\WebMCPServers\\cosyVoice-mcp",
"env": {
"DASHSCOPE_API_KEY": "your-api-key",
"VOICE_FILE_PATH": "f:/MCPProject/WebMCPServers/cosyVoice-mcp/voiceData/voice"
}
}
}
}环境变量配置
在.env文件中设置:
dashscope_api_key=your-api-key-here
VOICE_FILE_PATH={your-voice-file-save-path}可用工具
start_voice_service: 启动语音服务stop_voice_service: 停止语音服务set_character_role: 设置AI角色text_to_speech: 文本转语音get_supported_roles: 获取支持的角色列表
支持的角色
dongxuelian: 东雪莲
libai: 李白
nekogirl: 猫娘
yunli: 云李
storyteller: 说书人
direct_model: 直接模型
LLM系统Prompt配置
为了让LLM能够正确使用CosyVoice MCP服务,建议在LLM系统初始化时添加相应的prompt指导。本项目提供了两个版本的系统prompt:
详细版本
查看 SYSTEM_PROMPT.md 文件,包含完整的使用指南、最佳实践和示例场景。
简化版本
查看 SYSTEM_PROMPT_SIMPLE.txt 文件,适合直接复制粘贴到LLM配置中。
核心工作流程
LLM使用服务的标准流程:
获取角色列表:
get_supported_roles设置合适角色:
set_character_role执行语音合成:
播放语音:
text_to_speech_and_speak生成文件:
text_to_speech
角色选择建议
故事叙述:storyteller (说书人)
日常对话:dongxuelian (东雪莲)
正式内容:direct_model (直接模型)
轻松娱乐:nekogirl (猫娘)
诗词文学:libai (李白)
清新内容:yunli (云李)
MCP Prompts功能
本服务内置了prompts功能,LLM可以通过以下方式动态获取使用指导:
list_prompts:获取所有可用的prompt列表get_prompt:获取特定prompt的详细内容
可用的prompts:
cosyvoice_usage_guide:完整的服务使用指南role_selection_guide:角色选择建议和说明
开发和调试
本地开发
# 创建虚拟环境
python -m venv .venv
.venv\Scripts\activate
# 安装依赖
pip install -r requirements.txt
# 运行服务
python src/mcp_server.py调试模式
设置环境变量 DEBUG=true 可以启用调试输出。
许可证
本项目采用MIT许可证。详情请查看 LICENSE 文件。
贡献
欢迎提交Issues和Pull Requests来改进本项目。
This server cannot be deployed
Maintenance
Related MCP Connectors
AI voice generation: text-to-speech and voice cloning from any MCP client.
MCP server for Text-to-Speech
Hosted pay-per-use TTS: 54 neural voices, 9 languages incl. Brazilian Portuguese. $10 free credits.
AI content generation with 50+ models: image, video, TTS, voice cloning, and more.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceA Model Context Protocol server that integrates high-quality text-to-speech capabilities with Claude Desktop and other MCP-compatible clients, supporting multiple voice options and audio formats.151MIT
- AlicenseBqualityFmaintenanceA server that enables Claude 3.7 and other AI agents to access VOICEVOX-compatible speech synthesis engines (AivisSpeech, VOICEVOX, COEIROINK) through the Model Context Protocol.112MIT
- AlicenseAqualityBmaintenanceA text-to-speech MCP server that enables AI assistants to speak using the VOICEVOX engine with support for multi-character conversations. It features queue management, low-latency streaming via FFplay, and cross-platform playback across Windows, macOS, and Linux.714916ISC
- AlicenseNot gradedqualityDmaintenanceA text-to-speech MCP server with 48 voices across 9 languages, supporting emotion spans, SFX tags, and multi-speaker dialogue. Deployable via a single npx command with built-in guardrails and swappable backends.MIT