YC

ybouhjira/claude-code-tts

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

21 stars 14 forks 质量 55 趋势 10MIT

🔊 Claude Code 的文本转语音 MCP 插件——在编码时听到音频反馈(OpenAI TTS)

概览

这是一个基于Claude Code的文本转语音MCP服务器插件,利用OpenAI的TTS API将文本转换为语音。工作时还能从Claude那里获得音频反馈! - : 每个Claude响应都会自动口述(通过停止钩子) - : 合金、回声、寓言、黑玛瑙、新星、闪光 - : 非阻塞队列并发处理 - : 一次播放一个音频,无重叠 - : macOS(afplay)、Linux(mpv/ffplay/mpg123)、Windows(PowerShell) - : 用于无MCP的直接TTS语音文本二进制 - (用于源代码构建) - 带TTS访问 - : - macOS:afplay(内置)- Linux:mpv、ffplay或mpg123 - Windows:PowerShell(内置) 或者添加到你的shell配置文件(~/.zshrc 或 ~/.bashrc)。 把文本转成语音并大声播放。 获取TTS系统的当前状态。 这个插件包含一个自动说出每个Claude回复的第一句话。不需要配置——它就是能正常工作。 钩子在背景运行,不会阻挡克劳德的回应。

概述(AI 翻译)

这是一个基于Claude Code的文本转语音MCP服务器插件,利用OpenAI的TTS API将文本转换为语音。工作时还能从Claude那里获得音频反馈!

特色

  • 确定性自动语音:每个Claude回应都会自动口述(通过停止钩子)
  • **6 高品质声音:合金、回声、寓言、黑玛瑙、新星、闪光
  • 工人池架构:非阻塞队列,并发处理
  • Mutex保护播放:一次播放一个音频,不重叠
  • 跨平台:macOS(afplay)、Linux(mpv/ffplay/mpg123)、Windows(PowerShell)
  • 独立CLI:speak-text 二进制用于无MCP的直接TTS

快速安装

或者手动安装:

要求

  • Go 1.21+(用于从源代码构建)
  • OpenAI API 密钥 带 TTS 访问
  • 音频播放器:
  • macOS:afplay(内置)
  • Linux:mpv、ffplay 或 mpg123
  • Windows:PowerShell(内置)

配置

设置你的OpenAI API密钥:

或者添加到你的壳配置文件(~/.zshrc 或 ~/.bashrc)。

建筑

用途

说话(文字,语音)

把文本转成语音并大声播放。

参数: |参数 |类型 |必需 |描述 |

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Claude Code TTS Plugin

A Text-to-Speech MCP server plugin for Claude Code that converts text to speech using OpenAI’s TTS API. Get audio feedback from Claude as you work!

Features

  • Deterministic Auto-Speak: Every Claude response is automatically spoken (via Stop hook)
  • 6 High-Quality Voices: alloy, echo, fable, onyx, nova, shimmer
  • Worker Pool Architecture: Non-blocking queue with concurrent processing
  • Mutex-Protected Playback: One audio plays at a time, no overlapping
  • Cross-Platform: macOS (afplay), Linux (mpv/ffplay/mpg123), Windows (PowerShell)
  • Standalone CLI: speak-text binary for direct TTS without MCP

Quick Install

# One-liner installation
curl -fsSL https://raw.githubusercontent.com/ybouhjira/claude-code-tts/main/install.sh | bash

Or install manually:

git clone https://github.com/ybouhjira/claude-code-tts.git ~/.claude/plugins/claude-code-tts
cd ~/.claude/plugins/claude-code-tts
make install

Requirements

  • Go 1.21+ (for building from source)
  • OpenAI API Key with TTS access
  • Audio Player:
    • macOS: afplay (built-in)
    • Linux: mpv, ffplay, or mpg123
    • Windows: PowerShell (built-in)

Configuration

Set your OpenAI API key:

export OPENAI_API_KEY="sk-..."

Or add to your shell profile (~/.zshrc or ~/.bashrc).

Architecture

┌─────────────────────────────────────────────────────────────┐
│                     Claude Code                              │
│                         │                                    │
│                    MCP Protocol                              │
│                         │                                    │
│  ┌──────────────────────▼──────────────────────────────┐    │
│  │              TTS MCP Server (Go)                     │    │
│  │  ┌─────────────────────────────────────────────┐    │    │
│  │  │              Tool Handlers                   │    │    │
│  │  │   speak(text, voice)  │  tts_status()       │    │    │
│  │  └─────────────┬─────────┴─────────────────────┘    │    │
│  │                │                                     │    │
│  │  ┌─────────────▼─────────────────────────────┐      │    │
│  │  │           Worker Pool (2 workers)          │      │    │
│  │  │  ┌─────────┐    ┌─────────────────────┐   │      │    │
│  │  │  │ Job     │───►│ Queue (50 slots)    │   │      │    │
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →