Kokoro Text to Speech MCP Server

Kokoro Text to Speech MCP Server

Text-to-speech server with optional S3 storage, built for Model Context Protocol environments.

67
Stars
14
Forks
67
Watchers
3
Issues
Kokoro Text to Speech MCP Server provides a text-to-speech API that generates MP3 audio files from text input, with support for multiple voices and speech parameters. It is designed for compatibility with Model Context Protocol (MCP), allowing for easy integration and configuration in MCP-based workflows. Generated audio files can be stored locally or uploaded to AWS S3, and the server includes client utilities for interaction, as well as configurable environment options for deployment. The solution leverages Hugging Face Kokoro-TTS models and supports both direct use and cloud-friendly workflows.

Key Features

Model Context Protocol (MCP) compliant server configuration
Text-to-speech conversion with adjustable voice, speed, and language
Supports local and AWS S3 storage for generated MP3 files
Command-line client for TTS requests
Automatic MP3 file retention and cleanup options
Customizable environment via .env configuration
Integration of Kokoro-TTS models via ONNX weights
Remote or local server deployment support
Disabling/enabling S3 uploads via runtime flags
API usable in batch or interactive workflows

Use Cases

Generating voice audio from text content for accessibility applications
Integrating automated TTS in chatbot or virtual assistant systems
Creating MP3 audio files for e-learning content and audiobooks
Batch processing of text-to-speech tasks with automatic cloud storage
Streaming or on-demand audio generation for web applications
Voice rendering for notification or alert systems
Voice synthesis for customized voice apps with selectable parameters
Automated pipeline integration with model server orchestration via MCP
TTS for media production or content creation workflows
Research or prototyping of speech-enabled model services

README

Kokoro Text to Speech (TTS) MCP Server

Kokoro Text to Speech MCP server that generates .mp3 files with option to upload to S3.

Uses: https://huggingface.co/spaces/hexgrad/Kokoro-TTS

Configuration

Add the following to your MCP configs. Update with your own values.

  "kokoro-tts-mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/toyourlocal/kokoro-tts-mcp",
        "run",
        "mcp-tts.py"
      ],
      "env": {
        "TTS_VOICE": "af_heart",
        "TTS_SPEED": "1.0",
        "TTS_LANGUAGE": "en-us",
        "AWS_ACCESS_KEY_ID": "",
        "AWS_SECRET_ACCESS_KEY": "",
        "AWS_REGION": "us-east-1",
        "AWS_S3_FOLDER": "mp3",
        "S3_ENABLED": "true",
        "MP3_FOLDER": "/path/to/mp3"
      } 
    }

Install ffmmeg

This is needed to convert .wav to .mp3 files

For mac:

brew install ffmpeg

To run locally add these to your .env file. See env.example and copy to .env and modify with your own values.

Supported Environment Variables

  • AWS_ACCESS_KEY_ID: Your AWS access key ID
  • AWS_SECRET_ACCESS_KEY: Your AWS secret access key
  • AWS_S3_BUCKET_NAME: S3 bucket name
  • AWS_S3_REGION: S3 region (e.g., us-east-1)
  • AWS_S3_FOLDER: Folder path within the S3 bucket
  • AWS_S3_ENDPOINT_URL: Optional custom endpoint URL for S3-compatible storage
  • MCP_HOST: Host to bind the server to (default: 0.0.0.0)
  • MCP_PORT: Port to listen on (default: 9876)
  • MCP_CLIENT_HOST: Hostname for client connections to the server (default: localhost)
  • DEBUG: Enable debug mode (set to "true" or "1")
  • S3_ENABLED: Enable S3 uploads (set to "true" or "1")
  • MP3_FOLDER: Path to store MP3 files (default is 'mp3' folder in script directory)
  • MP3_RETENTION_DAYS: Number of days to keep MP3 files before automatic deletion
  • DELETE_LOCAL_AFTER_S3_UPLOAD: Whether to delete local MP3 files after successful S3 upload (set to "true" or "1")
  • TTS_VOICE: Default voice for the TTS client (default: af_heart)
  • TTS_SPEED: Default speed for the TTS client (default: 1.0)
  • TTS_LANGUAGE: Default language for the TTS client (default: en-us)

Running the Server Locally

Preferred method use UV

uv run mcp-tts.py

Using the TTS Client

The mcp_client.py script allows you to send TTS requests to the server. It can be used as follows:

Connection Settings

When running the server and client on the same machine:

  • Server should bind to 0.0.0.0 (all interfaces) or 127.0.0.1 (localhost only)
  • Client should connect to localhost or 127.0.0.1

Basic Usage

bash
python mcp_client.py --text "Hello, world!"

Reading Text from a File

bash
python mcp_client.py --file my_text.txt

Customizing Voice and Speed

bash
python mcp_client.py --text "Hello, world!" --voice "en_female" --speed 1.2

Disabling S3 Upload

bash
python mcp_client.py --text "Hello, world!" --no-s3

Command-line Options

bash
python mcp_client.py --help

MP3 File Management

The TTS server generates MP3 files that are stored locally and optionally uploaded to S3. You can configure how these files are managed:

Local Storage

  • Set MP3_FOLDER in your .env file to specify where MP3 files are stored
  • Files are kept in this folder unless automatically deleted

Automatic Cleanup

  • Set MP3_RETENTION_DAYS=30 (or any number) to automatically delete files older than that number of days
  • Set DELETE_LOCAL_AFTER_S3_UPLOAD=true to delete local files immediately after successful S3 upload

S3 Integration

  • Enable/disable S3 uploads with S3_ENABLED=true or DISABLE_S3=true
  • Configure AWS credentials and bucket settings in the .env file
  • S3 uploads can be disabled per-request using the client's --no-s3 option

Star History

Star History Chart

Repository Owner

mberg
mberg

User

Repository Details

Language Python
Default Branch main
Size 87 KB
Contributors 3
License Apache License 2.0
MCP Verified Nov 12, 2025

Programming Languages

Python
92.78%
Shell
7.22%

Tags

Join Our Newsletter

Stay updated with the latest AI tools, news, and offers by subscribing to our weekly newsletter.

We respect your privacy. Unsubscribe at any time.

Related MCPs

Discover similar Model Context Protocol servers

  • Speech.sh

    Speech.sh

    Command-line text-to-speech utility with MCP integration using OpenAI's API.

    Speech.sh provides robust text-to-speech capabilities from the command line by leveraging OpenAI's API and offers Model Context Protocol (MCP) compatibility for integration with AI assistants. Supporting multiple voice options, adjustable speech speed, and both tts-1 and tts-1-hd models, it ensures seamless audio conversion and playback. Flexible API key management, auto-caching, and reliable retry logic make it suitable for diverse environments. Additional features include security-focused processing, dependency validation, and compatibility with both ffmpeg and mplayer audio players.

    • 5
    • MCP
    • j3k0/speech.sh
  • TickTick MCP

    TickTick MCP

    MCP server for AI-powered TickTick task management integration

    TickTick MCP is a Model Context Protocol (MCP) server that enables standardized integration of TickTick's task management features with AI assistants and developer applications. It allows programmatic access to create, update, retrieve, complete, or delete tasks and projects in TickTick via Python. Using this MCP server, AI systems can leverage TickTick's API to help automate and manage user's to-do lists and projects through natural language or other interfaces.

    • 6
    • MCP
    • ekkyarmandi/ticktick-mcp
  • Kanboard MCP Server

    Kanboard MCP Server

    MCP server for seamless AI integration with Kanboard project management.

    Kanboard MCP Server is a Go-based server implementing the Model Context Protocol (MCP) for integrating AI assistants with the Kanboard project management system. It enables users to manage projects, tasks, users, and workflows in Kanboard directly via natural language commands through compatible AI tools. With built-in support for secure authentication and high performance, it facilitates streamlined project operations between Kanboard and AI-powered clients like Cursor or Claude Desktop. The server is configurable and designed for compatibility with MCP standards.

    • 15
    • MCP
    • bivex/kanboard-mcp
  • Teamwork MCP Server

    Teamwork MCP Server

    Seamless Teamwork.com integration for Large Language Models via the Model Context Protocol

    Teamwork MCP Server is an implementation of the Model Context Protocol (MCP) that enables Large Language Models to interact securely and programmatically with Teamwork.com. It offers standardized interfaces, including HTTP and STDIO, allowing AI agents to perform various project management operations. The server supports multiple authentication methods, an extensible toolset architecture, and is designed for production deployments. It provides read-only capability for safe integrations and robust observability features.

    • 11
    • MCP
    • Teamwork/mcp
  • Google Workspace MCP Server

    Google Workspace MCP Server

    Full natural language control of Google Workspace through the Model Context Protocol.

    Google Workspace MCP Server enables comprehensive natural language interaction with Google services such as Calendar, Drive, Gmail, Docs, Sheets, Slides, Forms, Tasks, and Chat via any MCP-compatible client or AI assistant. It supports both single-user and secure multi-user OAuth 2.1 authentication, providing a production-ready backend for custom apps. Built on FastMCP, it delivers high performance and advanced context handling, offering deep integration with the entire Google Workspace suite.

    • 890
    • MCP
    • taylorwilsdon/google_workspace_mcp
  • piapi-mcp-server

    piapi-mcp-server

    TypeScript-based MCP server for PiAPI media content generation

    piapi-mcp-server is a TypeScript implementation of a Model Context Protocol (MCP) server that connects with PiAPI to enable media generation workflows from MCP-compatible applications. It handles image, video, music, TTS, 3D, and voice generation tasks using a wide range of supported models like Midjourney, Flux, Kling, LumaLabs, Udio, and more. Designed for easy integration with clients such as Claude Desktop, it includes an interactive MCP Inspector for development, testing, and debugging.

    • 62
    • MCP
    • apinetwork/piapi-mcp-server
  • Didn't find tool you were looking for?

    Be as detailed as possible for better results