Skip to main content
Glama
Z-bitlance

CosyVoice MCP Server

by Z-bitlance

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.py

Claude 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使用服务的标准流程:

  1. 获取角色列表get_supported_roles

  2. 设置合适角色set_character_role

  3. 执行语音合成

    • 播放语音: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来改进本项目。

A
license - permissive license
Not graded
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    A 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.
    11
    1
    MIT
  • A
    license
    B
    quality
    F
    maintenance
    A 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.
    1
    12
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    A 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.
    7
    149
    16
    ISC
  • A
    license
    Not graded
    quality
    C
    maintenance
    A 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

View all related MCP servers

Related MCP Connectors

  • Hosted pay-per-use TTS: 54 neural voices, 9 languages incl. Brazilian Portuguese. $10 free credits.

  • Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer

  • MCP server exposing the AceDataCloud Fish Audio API (text-to-speech with voice conditioning)

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Z-bitlance/cosyVoice-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server