Kokoro Text to Speech MCP Server
The Kokoro Text to Speech MCP Server converts text into MP3 audio files with customizable voice settings and flexible storage options.
Convert text to speech: Generate MP3 audio files from text input (direct string or file)
Customize audio: Specify voice ID (e.g.,
af_heart,en_female), speech speed, and language code (e.g.,en-us)Manage files: Use custom filenames or auto-generated UUIDs, with local storage in configurable folders
S3 integration: Upload to AWS S3 with configurable credentials, region, bucket, and folder settings
Automatic cleanup: Delete local files based on retention days or after successful S3 upload
Flexible configuration: Disable S3 uploads globally or per individual request
Manages configuration through environment variables stored in .env files for customizing TTS settings and service connections.
Converts generated .wav audio files to .mp3 format for storage and distribution.
Provides access to the Kokoro ONNX weights repository for downloading necessary model files.
Utilizes ONNX model files for text-to-speech processing, specifically loading the Kokoro model weights for voice generation.
Offers a Python client interface for sending TTS requests to the server with customizable voice, speed, and file management options.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Kokoro Text to Speech MCP Serverconvert this meeting summary to audio with a professional voice"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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
Related MCP server: MCP Voice Soundboard
Configuration
Clone to a local repo.
Download the Kokoro Onnx Weights for kokoro-v1.0.onnx and voices-v1.0.bin and store in the same repo.
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 ffmpegTo 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 IDAWS_SECRET_ACCESS_KEY: Your AWS secret access keyAWS_S3_BUCKET_NAME: S3 bucket nameAWS_S3_REGION: S3 region (e.g., us-east-1)AWS_S3_FOLDER: Folder path within the S3 bucketAWS_S3_ENDPOINT_URL: Optional custom endpoint URL for S3-compatible storageMCP_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 deletionDELETE_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.pyUsing 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) or127.0.0.1(localhost only)Client should connect to
localhostor127.0.0.1
Basic Usage
python mcp_client.py --text "Hello, world!"Reading Text from a File
python mcp_client.py --file my_text.txtCustomizing Voice and Speed
python mcp_client.py --text "Hello, world!" --voice "en_female" --speed 1.2Disabling S3 Upload
python mcp_client.py --text "Hello, world!" --no-s3Command-line Options
python mcp_client.py --helpMP3 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_FOLDERin your.envfile to specify where MP3 files are storedFiles 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 daysSet
DELETE_LOCAL_AFTER_S3_UPLOAD=trueto delete local files immediately after successful S3 upload
S3 Integration
Enable/disable S3 uploads with
S3_ENABLED=trueorDISABLE_S3=trueConfigure AWS credentials and bucket settings in the
.envfileS3 uploads can be disabled per-request using the client's
--no-s3option
Available Tools
1 tooltext_to_speechB
Convert text to speech using the Kokoro TTS service.
Args:
text: The text to convert to speech
voice: Voice ID to use (default: af_heart)
speed: Speech speed (default: 1.0)
lang: Language code (default: en-us)
filename: Optional filename for the MP3 (default: auto-generated UUID)
upload_to_s3: Whether to upload to S3 if enabled (default: True)
Returns:
A dictionary with information about the generated audio file
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | ||
| voice | No | en_sarah | |
| speed | No | ||
| lang | No | en-us | |
| filename | No | ||
| upload_to_s3 | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that the output is an MP3 file and that upload to S3 is optional, which adds some context. However, it doesn't cover important aspects like rate limits, authentication requirements, error conditions, or what the returned dictionary contains. For a tool with 6 parameters and no annotation coverage, this is insufficient.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured and appropriately sized. It starts with the core purpose, then lists parameters with clear explanations, and ends with return information. Every sentence earns its place, though the formatting with 'Args:' and 'Returns:' sections is slightly verbose but still efficient.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (6 parameters, no annotations, no output schema), the description is moderately complete. It excels at parameter documentation but lacks behavioral context and usage guidelines. The absence of an output schema means the description should ideally explain the return dictionary structure, which it doesn't. It's adequate but has clear gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description provides excellent parameter semantics beyond the input schema. With 0% schema description coverage, the description fully compensates by explaining each parameter's purpose, default values, and optionality. It clarifies that 'filename' is auto-generated if not provided and that 'upload_to_s3' depends on whether S3 is enabled. This adds significant value over the bare schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Convert text to speech using the Kokoro TTS service.' It specifies the verb ('convert') and resource ('text to speech'), and mentions the specific service. However, without sibling tools, it cannot demonstrate differentiation from alternatives, so it doesn't reach the highest score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, constraints, or typical use cases. The only contextual information is the service name (Kokoro TTS), but this doesn't help an agent decide when this tool is appropriate.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
v1.0.0- Changed
text_to_speech2 fields changed- changed
Input schema / properties / speed / defaultPrevious value: -1New value: +1.2 - changed
Input schema / properties / voice / defaultPrevious value: -"af_heart"New value: +"en_sarah"
1 tool update
- First observed
text_to_speech
TDQS
Scored across 1 tool
With only one tool, there is no possibility of ambiguity or overlap between tools. The single tool has a clearly defined purpose of converting text to speech, which cannot be confused with any other functionality.
The single tool name 'text_to_speech' follows a clear verb_noun pattern and uses snake_case consistently. With only one tool, naming consistency is inherently perfect as there are no other tools to compare against.
A single tool is too few for a server's apparent scope of text-to-speech functionality. While the tool itself is well-defined, a complete TTS service would typically include additional tools such as listing available voices, managing audio files, or configuring settings, making this server feel thin and incomplete.
The server is severely incomplete for a text-to-speech domain. It lacks essential operations such as listing available voices, checking service status, managing generated audio files (beyond the single generation tool), or handling configuration. This creates significant gaps that will limit agent workflows and cause failures in more complex tasks.
Maintenance
Related MCP Connectors
MCP server for Text-to-Speech
MCP server exposing the AceDataCloud Fish Audio API (text-to-speech with voice conditioning)
Hosted pay-per-use TTS: 54 neural voices, 9 languages incl. Brazilian Portuguese. $10 free credits.
MCP server for Speech-to-Text
Related MCP Servers
- AlicenseBqualityDmaintenanceA Model Context Protocol server that provides text-to-speech capabilities using the Kokoro TTS model, offering multiple voice options and customizable speech parameters.4321MIT
- AlicenseNot gradedqualityDmaintenanceA text-to-speech MCP server with 48 voices across 9 languages, supporting emotion spans, SFX tags, and multi-speaker dialogue. Deployable via a single npx command with built-in guardrails and swappable backends.MIT
- AlicenseNot gradedqualityDmaintenanceAn OpenAI-compatible text-to-speech API server that enables voice cloning, long-form generation, and can be used as a Claude Code tool for speech synthesis.MIT
- AlicenseNot gradedqualityCmaintenanceHeadless text-to-speech and speech-to-text server with REST and MCP API, supporting Kokoro TTS and Whisper STT.MIT