Get the FREE Ultimate OpenClaw Setup Guide →

MCP_tts_server

MCP Server wrapper for TTS engines (Kokoro TTS and OpenAI TTS)

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio kristofferv98-mcp_tts_server uv run tts_mcp.py \
  --env OPENAI_API_KEY="Your OpenAI API key for OpenAI TTS functionality"

How to use

The MCP TTS Server exposes a unified interface for Text-to-Speech using either a local Kokoro engine or the cloud-based OpenAI TTS engine. It streams audio to clients in real time when possible and supports queueing, playback control, and voice customization via natural language instructions (for OpenAI TTS). To integrate with Claude Desktop or other MCP-enabled clients, connect to the MCP server named mcp_tts_server and invoke the tts function, choosing the engine you want via the engine parameter. You can also stop playback or clear the queue with the tts_stop_playback_and_clear_queue function. Voices are available for Kokoro (default is a Kokoro voice) and a set of OpenAI voices, with adjustable playback speed and optional instructions to customize OpenAI TTS output.

How to install

Prerequisites:

  • Python 3.10 or higher
  • uv package manager
  • OpenAI API key (for OpenAI TTS)

Quick installation steps:

Clone the repository

git clone https://github.com/kristofferv98/MCP_tts_server.git cd MCP_tts_server

Create and activate a virtual environment with uv

uv venv source .venv/bin/activate # On Windows: .venv\Scripts\activate

Install the package in editable mode

uv pip install -e .

Prepare environment (example)

cp .env.example .env

Edit .env to set your OpenAI API key

OPENAI_API_KEY=your_openai_api_key_here

Run the MCP server

uv run tts_mcp.py

Optional: run the simpler Kokoro-only server for testing

uv run simple_tts_mcp.py

Additional notes

Environment variables and configuration:

  • OPENAI_API_KEY is required if you plan to use OpenAI TTS. Ensure the API key has TTS access.
  • The server exposes two engines: Kokoro (local) and OpenAI (cloud). You can select the engine per request via the engine parameter in the tts MCP function.
  • Playback speed can be adjusted with the speed parameter (typical range 0.8 to 1.5).
  • If streaming audio is not available, the server can fall back to file-based playback.
  • Claude Desktop users can install the server via fastmcp or manually add an mcpServers entry pointing to uv run tts_mcp.py. Ensure the directory path is correct for your environment.
  • Available Kokoro voices: default is af_heart. OpenAI voices include alloy, ash, ballad, coral, echo, fable, onyx, nova, sage, shimmer; default OpenAI model is gpt-4o-mini-tts.
  • For development and testing, you can run fastmcp dev ./tts_mcp.py to launch the MCP Inspector UI.

Related MCP Servers

Sponsor this space

Reach thousands of developers