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"
}
Metadata
Release files for voicemcpserver 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| voicemcpserver-0.2.0.tar.gz | 116.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| voicemcpserver-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 123.2 kB
Release files / voicemcpserver-0.2.0.tar.gz
| Download URL | voicemcpserver-0.2.0.tar.gz |
|---|---|
| Size | 116.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
950ef7bee9bd349f95f7e3603167e15b86bdc1ee9f7be5633d312f154ee3560e
|
|
BLAKE2b-256 checksum How to use checksums |
e5f03edc2d062c1891fac14cbefb69b32507e39ee14fbfa41b13a584462ea659
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.2
|
Release files / voicemcpserver-0.2.0-py3-none-any.whl
| Download URL | voicemcpserver-0.2.0-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c7dbec7f4fa04998f243bb58779d7501e8be02cb0b96f63d86a881a8cd4ca2b2
|
|
BLAKE2b-256 checksum How to use checksums |
493b0a6569bfd67e6a96ebc17775ad2fb4940f4a1738804051b3793ac8c90a80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.2
|
Security for voicemcpserver 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.