语音合成插件

一个为Claude Code提供离线语音合成功能的插件,使用本地运行的Kokoro-82M神经文本转语音引擎。

  • by nathanphelps
  • Python
  • 本地部署
  • 2 星标
  • 更新于
在 GitHub 查看 nathanphelps/claude-voice-mcp

使用说明

Claude Voice MCP

A Claude Code plugin that gives Claude a voice. After every response, Claude speaks a conversational summary aloud using Kokoro-82M, a high-quality neural text-to-speech engine that runs locally on your machine.

No API keys. No cloud services. Fully offline after setup.

Demo

Once installed, Claude automatically speaks after every response. You can also ask Claude to change voices, adjust speed, or list available voices naturally in conversation.

Setup

Prerequisites

  • Claude Code CLI installed and working
  • uv (Python package manager)

Platform-specific:

Platform Extra requirement
Windows Visual C++ 2015-2022 Redistributable (usually already installed)
macOS brew install libomp (required by ONNX Runtime)
Linux sudo apt install libportaudio2 (Debian/Ubuntu) or sudo dnf install portaudio (Fedora)

Install the Plugin

  1. In Claude Code, run:

    /install-plugin https://github.com/nathanphelps/claude-voice-mcp
    
  2. Run the install script to download TTS models (~337 MB) and verify dependencies:

    Windows (PowerShell):

    powershell -ExecutionPolicy ByPass -File install.ps1
    

    macOS / Linux:

    ./install.sh
    

    Important: The install script pre-downloads the Kokoro model files. Without this step, the first speak call will hang while downloading 337 MB in the background.

  3. Restart Claude Code. The voice plugin activates automatically.

Available Voices

28 voices across two accents and two genders. Default is af_heart.

American Female

ID Name
af_heart Heart (default, highest quality)
af_alloy Alloy
af_aoede Aoede
af_bella Bella
af_jessica Jessica
af_kore Kore
af_nicole Nicole
af_nova Nova
af_river River
af_sarah Sarah
af_sky Sky

American Male

ID Name
am_adam Adam
am_echo Echo
am_eric Eric
am_fenrir Fenrir
am_liam Liam
am_michael Michael
am_onyx Onyx
am_puck Puck
am_santa Santa

British Female

ID Name
bf_alice Alice
bf_emma Emma
bf_isabella Isabella
bf_lily Lily

British Male

ID Name
bm_daniel Daniel
bm_fable Fable
bm_george George
bm_lewis Lewis

Usage

The plugin is always active — Claude speaks after every response automatically. No commands needed.

You can interact with the voice naturally:

  • "Switch to a British male voice"
  • "Use the voice am_michael"
  • "List all available voices"
  • "Speak a bit faster"
  • "Read that last part again"

MCP Tools

The plugin exposes three tools that Claude calls automatically:

Tool Description
speak Synthesize and play text aloud. Accepts text, voice (optional), and speed (optional, default 1.0).
list_voices List available voices. Filter by language: en (all English), a (American), b (British), all (everything).
set_default_voice Change the session default voice by ID (e.g. am_michael).

Speed Control

Pass a speed multiplier to the speak tool:

  • 0.8 — slower
  • 1.0 — normal (default)
  • 1.2 — faster

How It Works

The plugin runs as an MCP (Model Context Protocol) server. Claude Code launches it automatically when the plugin is active.

  1. Claude generates a text response
  2. An always-active skill directs Claude to call the speak tool
  3. The speak tool synthesizes audio using Kokoro-82M (ONNX) and plays it through your speakers via sounddevice

All processing is local. Audio is generated by the Kokoro neural TTS model (~310 MB ONNX) running on CPU via ONNX Runtime. No GPU required.

Troubleshooting

First speak call hangs

Run the install script (install.ps1 or install.sh). The hang is caused by model files downloading on first use. The install script pre-downloads them.

No audio output

  • Check that your system default audio output device is set correctly
  • On Linux, ensure libportaudio2 is installed
  • Test audio with: python -c "import sounddevice; print(sounddevice.query_devices())"

Model loading is slow on first call

The Kokoro model takes ~2 seconds to load into memory on the first speak call of each session. Subsequent calls are fast.

Credits

License

MIT