Skip to main content
Glama

VoxCPM Audio MCP

本地语音与歌声合成 MCP 服务,把已经安装好的 VoxCPM2 和 SoulX-Singer 暴露给支持 MCP 的客户端。

功能

  • speak:用 VoxCPM2 生成普通语音、情感旁白或参考音色克隆。

  • speak_segments:把多段文字分别合成,再按设定停顿拼接成完整旁白。

  • sing_metadata:用 SoulX-Singer 读取目标元数据并生成歌声。

  • sing_notes:直接输入音素、MIDI 音高和每字时长生成歌声。

  • health:检查模型路径、FFmpeg、VoxCPM2 服务和 GPU 显存。

服务只返回本地音频文件路径,不包含模型权重。

Related MCP server: leanvox-mcp

Codex 插件

本仓库同时是一个 Codex 插件包:

.codex-plugin/plugin.json   插件清单
.mcp.json                   本地 MCP 启动配置
skills/audio/SKILL.md       音频合成技能说明
scripts/launch_mcp.cmd      MCP 启动器
scripts/ensure_mcp.ps1      插件环境安装
scripts/start_models.ps1    启动 VoxCPM2 并检查 SoulX-Singer
scripts/stop_models.ps1     停止 VoxCPM2
scripts/manage_cache.ps1    音频缓存统计和清理
scripts/show_logs.ps1       查看 MCP JSONL 日志

插件会在 %LOCALAPPDATA%\OpenAI\Codex\Plugins\voxcpm-audio-mcp 创建独立虚拟环境、日志目录和缓存目录,不修改系统 Python。

本地安装

可以使用仓库中的 examples/marketplace.json 作为本地市场配置,或把该仓库作为本地插件目录添加到 Codex。插件安装后,MCP 会通过 scripts/launch_mcp.cmd 自动安装依赖并启动。

也可以直接添加这个 GitHub 仓库作为插件市场:

codex plugin marketplace add ll861181031/voxcpm-audio-mcp

热门 Agent 支持

这个仓库同时提供两套兼容格式:

  • 根级 plugin.json + mcp.json:标准 Agent Plugins 布局

  • .codex-plugin/plugin.json + .mcp.json:Codex 兼容布局

已适配的 MCP 客户端包括:

Agent

状态

Codex

已支持

Claude Desktop

已支持

Claude Code

已支持

Cursor

已支持

Windsurf

已支持

Cline

已支持

Continue

已支持

VS Code MCP 客户端

已支持

通用 stdio MCP 客户端

已支持

可以生成任意客户端可粘贴的标准 mcpServers JSON:

.\.venv\Scripts\python.exe .\scripts\generate_agent_config.py --agent cursor

也可以写入文件:

.\.venv\Scripts\python.exe .\scripts\generate_agent_config.py --agent claude-desktop --output claude-desktop.json

详细说明见 docs/agent-support.md。

Python Agent 框架

仓库还提供三个框架接入示例:

examples/frameworks/generic_mcp_client.py
examples/frameworks/openai_agents.py
examples/frameworks/langchain_mcp.py

分别对应官方 Python MCP SDK、OpenAI Agents SDK 和 LangChain。

常用维护脚本

.\scripts\start_models.ps1
.\scripts\stop_models.ps1
.\scripts\manage_cache.ps1
.\scripts\manage_cache.ps1 -Clean
.\scripts\show_logs.ps1

manage_cache.ps1 默认只做预览;加 -Clean 才会删除超过保留期且超出保留数量的音频文件。

前置条件

  • Windows 10/11

  • Python 3.10+

  • 已安装 VoxCPM2 本地服务,默认 D:\Desktop\VoxCPM2

  • 已安装 SoulX-Singer,默认 D:\Desktop\SoulX-Singer

  • 可用 FFmpeg,默认 D:\Desktop\VoxCPM2\tools\ffmpeg\bin\ffmpeg.exe

  • NVIDIA GPU 或使用 device=cpu

安装

cd C:\Users\lsr\Documents\Codex\2026-09-16\yan\outputs\voxcpm-audio-mcp
powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\install.ps1

安装脚本会创建独立 .venv,不会修改系统 Python。

配置

复制 .env.example 为 .env,按本机路径修改。也可以直接设置环境变量。

关键变量:

VOXCPM_URL=http://127.0.0.1:8808
VOXCPM_START_SCRIPT=D:\Desktop\VoxCPM2\Start-VoxCPM.ps1
SOULX_HOME=D:\Desktop\SoulX-Singer
SOULX_MODEL_PATH=D:\Desktop\SoulX-Singer\pretrained_models\SoulX-Singer\model.pt
FFMPEG=D:\Desktop\VoxCPM2\tools\ffmpeg\bin\ffmpeg.exe
MIN_FREE_VRAM_MB=6000

启动 MCP

powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\run.ps1

或者直接运行:

.\.venv\Scripts\python.exe -m voxcpm_audio_mcp.server

该服务使用 stdio transport,适合由 Codex、Claude Desktop 或其他 MCP 客户端启动。

Codex MCP 配置示例

参见 examples/mcp_config.json:

{
  "mcpServers": {
    "voxcpm-audio": {
      "command": "C:\\Users\\lsr\\Documents\\Codex\\2026-09-16\\yan\\outputs\\voxcpm-audio-mcp\\.venv\\Scripts\\python.exe",
      "args": ["-m", "voxcpm_audio_mcp.server"],
      "env": {
        "VOXCPM_HOME": "D:\\Desktop\\VoxCPM2",
        "SOULX_HOME": "D:\\Desktop\\SoulX-Singer",
        "FFMPEG": "D:\\Desktop\\VoxCPM2\\tools\\ffmpeg\\bin\\ffmpeg.exe"
      }
    }
  }
}

工具示例

普通说话

{
  "text": "你好呀,今天也要开开心心的哦。",
  "control_instruction": "年轻可爱女声,清亮甜美,亲切自然,带一点笑意。",
  "cfg_value": 2.2,
  "inference_timesteps": 14,
  "output_format": "mp3"
}

分段情感旁白

{
  "segments": [
    {
      "text": "一九三四年十月,赣南秋风卷着细雨。",
      "control_instruction": "低沉凝重,缓缓追忆。",
      "pause_ms": 900
    },
    {
      "text": "这一送,是百姓的不舍。",
      "control_instruction": "深情、克制,句尾放慢。",
      "pause_ms": 1200
    }
  ],
  "cfg_value": 2.3,
  "inference_timesteps": 16
}

按音符唱歌

phonemes、note_pitches 和 durations_ms 必须一一对应。<SP> 表示停顿。

{
  "phonemes": [
    "<SP>",
    "zh_yi1", "zh_shan3", "zh_yi1", "zh_shan3",
    "zh_liang4", "zh_jing1", "zh_jing1",
    "<SP>",
    "zh_man3", "zh_tian1", "zh_dou1", "zh_shi4",
    "zh_xiao3", "zh_xing1", "zh_xing1"
  ],
  "note_pitches": [0, 60, 60, 67, 67, 69, 69, 67, 0, 65, 65, 64, 64, 62, 62, 60],
  "durations_ms": [200, 350, 350, 350, 350, 350, 350, 500, 300, 350, 350, 350, 350, 350, 350, 600],
  "text": "<SP> 一 闪 一 闪 亮 晶 晶 <SP> 满 天 都 是 小 星 星",
  "device": "auto"
}

显存策略

  • speak 需要 VoxCPM2 服务,默认占用约 8GB 显存。

  • sing_notes 在 device=auto 时,如果可用显存低于 MIN_FREE_VRAM_MB,会自动回退到 CPU。

  • 强制 device=cuda 时,显存不足会直接报错,不会抢占正在运行的任务。

  • VoxCPM2 和 SoulX-Singer 不建议同时常驻。当前 12GB 显卡上建议串行调用。

安全与合规

  • 只处理本地文件,不自动上传音频或文本。

  • 参考音频和音色克隆仅用于本人声音或已获授权的声音。

  • 不包含模型权重,模型需由用户自行安装和确认许可证。

  • MCP 默认通过 stdio 运行,不开放网络端口。

隐私

  • 不收集账号、联系方式或使用统计。

  • 不上传用户文本、参考音频或生成音频。

  • 日志只记录工具名称、参数摘要、输出路径和错误信息,不记录完整文本。

  • 所有模型和输出默认保存在本机。

许可证

MIT。模型权重和第三方模型许可证由各自项目决定,本仓库不包含这些权重。

开发与测试

uv pip install -e ".[dev]"
.\.venv\Scripts\python.exe -m pytest

Available Tools

5 tools
healthA

检查本地模型、FFmpeg、VoxCPM2 服务和 GPU 显存状态。

NameRequiredDescriptionDefault

No parameters

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It usefully enumerates exactly what subsystems are probed, which is real behavioral disclosure, and '检查' implies a read-only operation, but it says nothing about return format, latency, or whether checks fail gracefully.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single compact sentence that front-loads the verb and lists the checked components with no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter diagnostic with no output schema, the description covers what is inspected. The remaining gap is that the shape of the health report is undocumented, but that is a minor omission for a tool this simple.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool takes zero parameters, so the baseline is 4; there is nothing for the description to disambiguate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (检查 / check) plus four concrete resources: local model, FFmpeg, VoxCPM2 service, and GPU VRAM. It is unmistakably a diagnostic tool versus the speech-oriented siblings, though it does not name any sibling explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is only implied: an agent can infer this is a pre-flight/diagnostic check to run before calling speak or sing_* tools. There is no explicit 'use when' statement, no conditions, and no mention of alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

sing_metadataC

用 SoulX-Singer 根据已写好的目标元数据生成带旋律的歌声。

NameRequiredDescriptionDefault
deviceNoauto
controlNoscore
auto_shiftNo
pitch_shiftNo
output_formatNomp3
prompt_wav_pathNo
normalize_loudnessNo
prompt_metadata_pathNo
target_metadata_pathYes

TDQS

C2.4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

There are no annotations, so the description carries the full behavioral burden, yet it says nothing about that this is a local model inference (GPU/CPU), that it can be slow, whether output is overwritten, or how the produced audio is returned. It only reveals the underlying model name and the metadata precondition.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

One sentence with no filler, so it is concise, but it is concise to the point of under-specification. For a tool with 9 parameters and no schema documentation, that brevity is a liability rather than a virtue.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 9 parameters, no annotations, no output schema, and zero schema descriptions, the one-line description falls well short. An agent would not know how to set control or whether a prompt is required to clone a voice.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 9 parameters, but none have descriptions and the coverage is 0%; the description only implicitly references target_metadata_path. Important parameters such as control (score vs melody), prompt_wav_path/prompt_metadata_path (voice cloning references), pitch_shift, and output_format are left entirely unexplained.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: generate melodic singing (带旋律的歌声) from pre-written target metadata using SoulX-Singer. An agent can distinguish this task from speak/speak_segments (speech) and infer a difference from sing_notes, though it never explicitly names or contrasts with those siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to choose sing_metadata over sing_notes, no prerequisites for what 'pre-written target metadata' means or how to obtain it, and no mention of when to use a prompt WAV/metadata. The only implied condition is that metadata must already exist.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

sing_notesC

用音素、MIDI 音高和每字时长直接生成唱歌,不需要手写完整元数据。

NameRequiredDescriptionDefault
textNo
deviceNoauto
languageNoMandarin
phonemesYes
auto_shiftNo
pitch_shiftNo
durations_msYes
note_pitchesYes
output_formatNomp3
prompt_wav_pathNo
normalize_loudnessNo
prompt_metadata_pathNo

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full behavioral burden, yet it discloses almost nothing beyond 'this produces singing'. It says nothing about what audio is returned, how the device/prompt WAV affect execution, whether generation is expensive or requires a model download, or what happens when the three arrays have mismatched lengths.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single front-loaded sentence with no filler, and the key inputs are stated before the 'no metadata needed' benefit. It is efficient, though the terseness borders on under-specification for a 12-parameter tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With 12 parameters, zero schema description coverage, no annotations, and no output schema, the definition leaves an agent unable to determine array alignment rules, default behavior of auto_shift/pitch_shift, or what the tool returns. The one-sentence description is far too thin for this complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% across 12 parameters. The description only names the three required ones (phonemes, note_pitches, durations_ms) without explaining units, alignment, or length constraints, and the nine optional parameters — text, device, language, auto_shift, pitch_shift, output_format, prompt_wav_path, prompt_metadata_path, normalize_loudness — are entirely undocumented in both schema and description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific action (generate singing) and the three inputs that drive it (phonemes, MIDI pitches, per-character durations), so the purpose is unmistakable. The clause '不需要手写完整元数据' implicitly distinguishes it from the sing_metadata sibling, though it never names that sibling outright.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied: use this when you already have phonemes/pitches/durations and want to skip writing full metadata. However, it never explicitly says when to prefer sing_metadata or speak/speak_segments instead, nor does it state prerequisites for the prompt_wav_path and prompt_metadata_path options.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

speakC

用本地 VoxCPM2 生成说话或情感旁白。返回音频文件路径。

NameRequiredDescriptionDefault
seedNo
textYes
cfg_valueNo
output_formatNomp3
normalize_loudnessNo
control_instructionNo自然、清晰、亲切的普通话,语速适中,情绪真实。
inference_timestepsNo
reference_audio_pathNo

TDQS

C2.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It discloses the engine (local VoxCPM2) and that the result is a file path, which is useful, but says nothing about voice cloning via a reference audio, latency/cost of local inference, whether output files are overwritten, or how the control instruction actually steers emotion.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two short sentences, front-loaded with purpose then return value; no filler. It is efficient, though the brevity edges into under-specification given the parameter surface.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Eight parameters, zero annotation coverage, and no output schema, yet the description explains neither the knobs nor the output beyond 'a file path'. For a TTS tool with a voice-reference parameter and a tunable control instruction, this is well short of what an agent needs to call it confidently.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% across 8 parameters, and the description mentions none of them. The terms '情感旁白' hint that control_instruction drives emotional delivery, but seed, cfg_value, inference_timesteps, normalize_loudness, and reference_audio_path (a high-impact voice-cloning input) are left entirely opaque.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource (generate speech / emotional narration with local VoxCPM2) plus the return artifact (audio file path). It implicitly contrasts with the singing siblings (sing_notes, sing_metadata) by naming narration/speech, but never explicitly distinguishes itself from speak_segments.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to pick this over speak_segments, when a reference voice should be used, or any prerequisites (model availability, GPU, language support). The agent must infer the single-utterance vs. segmented distinction from sibling names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

speak_segmentsC

把多段文字分别用 VoxCPM2 合成,并按停顿拼接成一条情感旁白。

NameRequiredDescriptionDefault
seedNo
segmentsYes
cfg_valueNo
output_formatNomp3
normalize_loudnessNo
inference_timestepsNo
reference_audio_pathNo

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full behavioral burden. It does disclose the two-stage behavior (per-segment synthesis, then pause-based concatenation into one track), but says nothing about the return artifact (file path vs. audio payload), latency/model cost, or side effects of a 7-parameter generation call.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single compact sentence with the action and composition behavior front-loaded and no filler. It is efficient, though the brevity comes at the cost of the missing information noted elsewhere.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 7-parameter generation tool with no annotations and no output schema, the definition is too thin: nothing about what is returned, whether a reference voice is required, or what the numeric knobs change. An agent could call it, but not confidently or optimally.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is reported at 0% for the top-level parameters: seed, cfg_value, output_format, normalize_loudness, inference_timesteps, and reference_audio_path are undocumented in both schema and description. The phrase '按停顿拼接' hints at the per-segment pause_ms, but the description explains none of the remaining six parameters or how reference audio affects the output.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific verb+resource: synthesize each of several text segments with VoxCPM2 and concatenate them by pause into one emotional narration. This clearly separates it in spirit from the single-utterance sibling 'speak', but it never names that sibling or explicitly states the boundary.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

'多段文字' implies the tool is for multi-segment narration, so the when-to-use is inferable, but there is no explicit guidance to prefer 'speak' for a single utterance, no prerequisites, and no mention of the conditions under which segmentation is warranted.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 5 tool updatesv0.3.0
    • First observedhealth
    • First observedsing_metadata
    • First observedsing_notes
    • First observedspeak
    • First observedspeak_segments

TDQS

B3.2/5.0

Scored across 5 tools

Disambiguation4/5

speak and speak_segments both synthesize speech, and sing_metadata/sing_notes both synthesize singing; however, descriptions distinguish single vs. multi-segment speech and metadata vs. note-level singing input. An agent can generally tell them apart, though the overlapping pairs may cause occasional misselection.

Naming Consistency4/5

Most names follow a snake_case verb_noun or verb_object pattern (speak_segments, sing_metadata, sing_notes), with speak as a bare verb and health as a noun utility. The convention is consistent enough to be predictable.

Tool Count5/5

Five tools are well-scoped for an audio synthesis server: two speech modes, two singing modes, and a health check. No obvious bloat or thinness.

Completeness4/5

The surface covers single and segmented speech, metadata-based and note-based singing, plus system health, which is strong for the stated purpose. Minor gaps like voice/model listing or audio management are not fatal and can be worked around.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers