MCP Server for Alibaba Cloud CosyVoice
Project description
CosyVoice MCP Server
A Model Context Protocol (MCP) server for Alibaba Cloud's CosyVoice text-to-speech service.
This server allows you to generate high-quality, expressive speech from text using Alibaba Cloud's state-of-the-art CosyVoice models (V2 and V3).
Features
- List Voices: Retrieve a curated list of high-quality voices suitable for various scenarios (social, narration, customer service, etc.).
- Speech Synthesis: Convert text to speech with support for:
- Model Selection: Choose between
cosyvoice-v2(standard) andcosyvoice-v3-flash(emotional). - Control Parameters: Adjust volume, speech rate, and pitch rate.
- Emotion Control: Use natural language instructions to control emotion (V3 models only).
- Supported emotions:
neutral,fearful,angry,sad,surprised,happy,disgusted. - Format:
"你说话的情感是<emotion>。"
- Supported emotions:
- SSML Support: Use SSML tags (e.g.,
<break time="2s"/>) for precise pause control. - File Saving: Save generated audio directly to a local file path.
- Model Selection: Choose between
Configuration
You need an Alibaba Cloud DashScope API Key. Set it as an environment variable:
export COSYVOICE_MCP_DASHSCOPE_API_KEY=your_api_key_here
(Alternatively, DASHSCOPE_API_KEY is also supported).
Optional Configuration
COSYVOICE_DEFAULT_OUTPUT_DIR: Set a default directory for saving generated audio files ifoutput_fileis not specified.
export COSYVOICE_DEFAULT_OUTPUT_DIR=~/Desktop/CosyVoiceOutput
MCP Client Configuration
Add the following to your MCP client configuration (e.g., claude_desktop_config.json):
Using uvx (Recommended)
You can run the server directly from PyPI using uvx:
{
"mcpServers": {
"cosyvoice": {
"command": "uvx",
"args": [
"voicemcpserver"
],
"env": {
"COSYVOICE_MCP_DASHSCOPE_API_KEY": "your_api_key_here"
}
}
}
}
Using python
{
"mcpServers": {
"cosyvoice": {
"command": "python3",
"args": [
"-m",
"voicemcpserver"
],
"cwd": "/path/to/voicemcpserver/src",
"env": {
"COSYVOICE_MCP_DASHSCOPE_API_KEY": "your_api_key_here"
}
}
}
}
Available Voices
CosyVoice V3 Flash (Supports Emotion Instructions)
| ID | Name | Description | Tags |
|---|---|---|---|
longanyang |
龙安洋 | 阳光大男孩,20~30岁 | Social, Young, Male |
longanhuan |
龙安欢 | 欢脱元气女,20~30岁 | Social, Energetic, Female |
CosyVoice V2 (Standard High Quality)
| ID | Name | Description | Tags |
|---|---|---|---|
longxiaochun_v2 |
龙小淳 | 亲切女声,客服/播报 | Customer Service, Female |
longxiaoxia_v2 |
龙小夏 | 活泼女声,社交/娱乐 | Social, Female |
longxiaobai_v2 |
龙小白 | 清澈男声,社交/娱乐 | Social, Male |
longxiaocheng_v2 |
龙小诚 | 沉稳男声,有声书/播报 | Audiobook, Male |
longwan_v2 |
龙婉 | 积极知性女,有声书/新闻 | Audiobook, Female |
longyingmu |
龙应沐 | 优雅知性女,客服 | Customer Service, Female |
longhuhu |
龙呼呼 | 天真烂漫女童 | Child, Female |
longanran |
龙安燃 | 活泼质感女,直播带货 | Live Streaming, Female |
longanchong |
龙安冲 | 激情推销男,直播带货 | Live Streaming, Male |
Usage Examples
Synthesize Speech (Basic)
{
"text": "你好,欢迎使用 CosyVoice。",
"voice": "longxiaochun_v2",
"output_file": "/Users/username/Desktop/hello.mp3"
}
Synthesize Speech (Advanced Control)
{
"text": "今天天气真不错!<break time=\"1s\"/> 我们去公园玩吧。",
"voice": "longanyang",
"model": "cosyvoice-v3-flash",
"volume": 80,
"speech_rate": 1.1,
"instruction": "你说话的情感是happy。",
"output_file": "/Users/username/Desktop/happy.mp3"
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file voicemcpserver-0.2.0.tar.gz.
File metadata
- Download URL: voicemcpserver-0.2.0.tar.gz
- Upload date:
- Size: 116.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
950ef7bee9bd349f95f7e3603167e15b86bdc1ee9f7be5633d312f154ee3560e
|
|
| MD5 |
19af2219e9a3416127b40517d73e95b0
|
|
| BLAKE2b-256 |
e5f03edc2d062c1891fac14cbefb69b32507e39ee14fbfa41b13a584462ea659
|
File details
Details for the file voicemcpserver-0.2.0-py3-none-any.whl.
File metadata
- Download URL: voicemcpserver-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7dbec7f4fa04998f243bb58779d7501e8be02cb0b96f63d86a881a8cd4ca2b2
|
|
| MD5 |
fee0d772d1f9420bf817145edcda364d
|
|
| BLAKE2b-256 |
493b0a6569bfd67e6a96ebc17775ad2fb4940f4a1738804051b3793ac8c90a80
|