Kokoro TTS MCP server

Integrates with the Kokoro TTS engine to provide customizable text-to-speech capabilities, supporting cross-platform audio playback and file output for applications requiring high-quality speech synthesis.
Back to servers
Provider
Giannis Anni
Release date
Mar 06, 2025
Language
Python
Stats
5 stars

This MCP server provides text-to-speech capabilities using the Kokoro TTS engine, making it easy to integrate speech synthesis into your applications through the Model Context Protocol (MCP).

Installation

Prerequisites

  • Python 3.10 or higher
  • uv package manager

Setup Instructions

  1. Install the uv package manager:
curl -LsSf https://astral.sh/uv/install.sh | sh
  1. Clone the repository and install dependencies:
uv venv
source .venv/bin/activate  # On Windows, use: .venv\Scripts\activate
uv pip install .

Usage

The server exposes a single MCP tool called generate_speech with the following parameters:

  • text (required): The text to convert to speech
  • voice (optional): Voice to use for synthesis (default: "af_heart")
  • speed (optional): Speech speed multiplier (default: 1.0)
  • save_path (optional): Directory to save audio files
  • play_audio (optional): Whether to play the audio immediately (default: False)

Example Code

Here's how to use the TTS server in your Python code:

from mcp.client import Client

async with Client() as client:
    await client.connect("kokoro-tts")
    
    # Generate and play speech
    result = await client.call_tool(
        "generate_speech",
        {
            "text": "Hello, world!",
            "voice": "af_heart",
            "speed": 1.0,
            "play_audio": True
        }
    )

MCP Configuration

Add this configuration to your MCP settings file to make the server accessible:

{
  "mcpServers": {
    "kokoro-tts": {
      "command": "/Users/giannisan/pinokio/bin/miniconda/bin/uv",
      "args": [
        "--directory",
        "/Users/giannisan/Documents/Cline/MCP/kokoro-tts-mcp",
        "run",
        "tts-mcp.py"
      ]
    }
  }
}

Features

  • Text-to-speech synthesis with customizable voices
  • Adjustable speech speed
  • Support for saving audio to files or direct playback
  • Cross-platform audio playback support (Windows, macOS, Linux)

Platform Support

Audio playback works on:

  • Windows (using start command)
  • macOS (using afplay command)
  • Linux (using aplay command)

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later