Kokoro TTS MCP Server is a text-to-speech (TTS) tool that uses the open-weight Kokoro TTS model to generate MP3 files and optionally upload them to an S3 bucket. It is based on the MCP (Model Context Protocol) protocol and provides server and client scripts for easy integration into MCP-enabled applications.
Main capabilities:
- Text-to-speech: Convert text into MP3 audio files.
- Voice customization: Supports setting the default voice (TTS_VOICE, default af_heart), speed (TTS_SPEED, default 1.0), and language (TTS_LANGUAGE, default en-us).
- S3 upload: Can upload generated MP3 files to AWS S3 or S3-compatible storage services, with support for custom endpoints.
- File management: Configurable MP3 storage folder, retention days (automatic cleanup), and whether to delete local files after upload.
- Client tool: Provides the mcp_client.py script, which supports reading text from a file, custom voice and speed, disabling S3 upload, and more.
Usage:
- Clone the repository locally.
- Download the Kokoro Onnx weight files (kokoro-v1.0.onnx and voices-v1.0.bin) and place them in the same repository directory.
- Configure the MCP client (update it with your own values).
- Copy env.example to .env and modify the environment variables, including AWS credentials, S3 bucket information, server host and port, etc.
- Run the server: the UV method is recommended.
- Use the client to send TTS requests, with parameters adjustable via command-line options.
Environment variables:
- AWS_ACCESS_KEY_ID: AWS access key ID
- AWS_SECRET_ACCESS_KEY: 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 S3-compatible storage endpoint
- MCP_HOST: Server bind host (default 0.0.0.0)
- MCP_PORT: Listening port (default 9876)
- MCP_CLIENT_HOST: Client connection hostname (default localhost)
- DEBUG: Enable debug mode (set to "true" or "1")
- S3_ENABLED: Enable S3 upload (set to "true" or "1")
- MP3_FOLDER: MP3 file storage path (default is the 'mp3' folder under the script directory)
- MP3_RETENTION_DAYS: Number of days to retain MP3 files; automatically deleted after expiration
- DELETE_LOCAL_AFTER_S3_UPLOAD: Whether to delete the local MP3 after a successful S3 upload (set to "true" or "1")
- TTS_VOICE: Default voice (default af_heart)
- TTS_SPEED: Default speed (default 1.0)
- TTS_LANGUAGE: Default language (default en-us)
Use cases:
- Automated workflows that need to convert text to speech and store or upload it.
- Integration into MCP-enabled AI applications or workflows.
- Scenarios that require locally generating MP3 files and optionally uploading them to cloud storage.
Limitations:
- You need to download the model weight files yourself.
- You need to configure AWS credentials and S3 bucket information (if using S3 upload).
- The default voice and language may be limited, depending on model support.
- No detailed information is provided about model performance, audio quality, or supported languages.