oai-tts
Provides tools for converting text to speech via OpenAI-compatible TTS APIs, including listing available voices and synthesizing speech with a chosen voice, instructions for tone/pacing, and configurable speed and audio format. Generated audio is uploaded to a third-party host and returned as a public URL.
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., "@oai-tts What voices are available? Then read "Good morning!" aloud in the marin voice, warm and calm."
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.
oai-tts-mcp
一个 OpenAI 兼容 TTS MCP 服务。AI 可调用它来:
查询当前模型的可用音色;
将文本按指定音色和语气转换为音频。
功能
list_voices默认请求
GET /v1/tts/voices?model={OAI_TTS_MODEL}。对 Base URL 自动规整:
https://host与https://host/v1均可,绝不会产生/v1/v1。上游请求失败、超时或响应不包含有效
voices[]时,返回内置回退音色,并标记source: "fallback"和原因。
text_to_speech请求
POST /v1/audio/speech。传入
instructions即可要求语气/表达,例如“平静、温暖、适合睡前故事,语速自然,句末轻柔收束”。默认
speed是 1.25;可选范围0.25到4。将音频上传至 Urusai 文件托管并返回公开 HTTPS URL;不返回 Base64 音频,减少上下文和客户端兼容性问题。
Related MCP server: quick-tts-mcp
要求
Node.js
>= 20pnpm
有效的 OpenAI 或 OpenAI 兼容 TTS 服务地址与 API Key
通过 npx 使用
发布到 npm 后,无需全局安装。MCP 客户端可直接调用:
{
"mcpServers": {
"oai-tts": {
"command": "npx",
"args": ["-y", "oai-tts-mcp"],
"env": {
"OAI_TTS_BASE_URL": "https://api.openai.com/v1",
"OAI_TTS_API_KEY": "your_api_key_here",
"OAI_TTS_MODEL": "gpt-4o-mini-tts",
"OAI_TTS_VOICE": "marin",
"URUSAI_API_TOKEN": "your_optional_urusai_token"
}
}
}
}npx -y 会下载并启动 npm 上的最新版本。请始终通过客户端的受保护环境变量注入 Key/Token,勿将真实凭据写入配置仓库。
安装
Set-Location "E:\Programming\oai-tts-mcp"
pnpm install参照仓库内的 env.example,将以下变量填入 MCP 客户端的 env 配置或受保护的系统环境变量:
OAI_TTS_BASE_URL=https://api.openai.com/v1
OAI_TTS_API_KEY=your_api_key_here
OAI_TTS_MODEL=gpt-4o-mini-tts
OAI_TTS_VOICE=marin
# 可选:Urusai 图床访问令牌。音频将上传至第三方并返回公开 URL;请勿上传敏感内容。
URUSAI_API_TOKEN=your_optional_urusai_token
# 可选:默认 https://api.urusai.cc/v1/upload;仅用于自建兼容上传服务或本机测试。
URUSAI_UPLOAD_URL=https://api.urusai.cc/v1/upload
推荐模型为
gpt-4o-mini-tts,它支持使用instructions细调表达。兼容服务是否支持该字段及具体音色,以该服务的实现为准。
构建与启动
pnpm build
pnpm start开发时:
pnpm devMCP 使用 stdio 通信;不要把服务日志写入 stdout。运行日志仅输出至 stderr。
MCP 客户端配置示例
以支持 stdio MCP 的客户端为例,配置命令为:
{
"mcpServers": {
"oai-tts": {
"command": "node",
"args": ["E:\\Programming\\oai-tts-mcp\\dist\\index.js"],
"env": {
"OAI_TTS_BASE_URL": "https://api.openai.com/v1",
"OAI_TTS_API_KEY": "your_api_key_here",
"OAI_TTS_MODEL": "gpt-4o-mini-tts",
"OAI_TTS_VOICE": "marin",
"URUSAI_API_TOKEN": "your_optional_urusai_token",
"URUSAI_UPLOAD_URL": "https://api.urusai.cc/v1/upload"
}
}
}
}服务仅从进程环境变量读取配置;由 MCP 客户端 env 注入是推荐且安全的方式。
工具说明
list_voices
无参数。返回文本摘要和结构化结果:
{
"voices": [
{ "voice_id": "eve", "name": "Eve", "language": "en" }
],
"source": "remote"
}若远程音色接口不可用,则返回 source: "fallback"。内置回退集为:
alloy、ash、ballad、coral、echo、fable、nova、onyx、sage、shimmer、verse、marin、cedar。
tts-1与tts-1-hd的可用音色较少;请优先调用list_voices,并以远程结果为准。
text_to_speech
参数:
参数 | 必填 | 说明 |
| 是 | 要朗读的文本,最多 4096 个字符。 |
| 否 | 音色 ID;缺省时使用 |
| 否 | 语气、情绪、节奏、口音或表达方式; |
| 否 | 语速倍率,默认 |
| 否 |
|
成功时工具仅返回文本 JSON 和结构化结果,其中 url 是图床返回的公开直链:
{
"status": "success",
"url": "https://example.com/oai-tts-...-Eve.mp3",
"model": "grok-voice-think-fast-2.0",
"voice": "Eve",
"speed": 1.25,
"format": "mp3",
"mime_type": "audio/mpeg"
}图床上传失败时,本次调用会返回错误,不会返回 Base64 音频或本地临时路径。
调用意图示例:
使用 text_to_speech,以 marin 音色、温暖平静的睡前故事语气朗读这段文本。图床上传与安全说明
text_to_speech将音频二进制上传到 Urusai 默认端点https://api.urusai.cc/v1/upload,成功后使用响应内的data.url_direct作为公开直链。生成的音频会离开本机并可能被持有 URL 的人访问;不要对机密、隐私、个人信息或未获授权的内容使用此工具。
URUSAI_API_TOKEN是可选的上传服务令牌;URUSAI_UPLOAD_URL仅用于覆盖默认端点(例如自建兼容服务)。不要把任一令牌提交到 Git。TTS API Key 和上传 Token 均不会被写入日志、构建产物或仓库;请仅通过 MCP 客户端
env或受保护的系统环境变量提供。list_voices上游请求失败会静默降级为公开内置列表;TTS 或上传失败会返回安全的错误摘要,不回显认证信息。
参考
Available Tools
2 toolslist_voices获取可用 TTS 音色ARead-only
获取当前 OAI_TTS_MODEL 的可用音色。优先调用 GET /v1/tts/voices?model=...;上游失败、超时或响应无效时自动返回内置 OpenAI 音色,并在结构化结果中标记 source=fallback。
Inputs: no named parameters.
text_to_speech将文本转换为语音A
调用 OpenAI 兼容 POST /v1/audio/speech 生成语音,并上传到 Urusai 文件托管服务。传入 instructions 可指定语气、情绪、节奏或风格;未指定 voice 时使用 OAI_TTS_VOICE;未指定 speed 时默认 1.25。成功后仅返回公开音频 URL。
Inputs: input (required), speed, voice, instructions, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have entirely distinct purposes: list_voices enumerates available voices, while text_to_speech synthesizes audio and uploads it. There is no plausible way to confuse them, and the descriptions make the boundary explicit.
Both names use consistent snake_case, which is predictable. minor deviation: list_voices follows a verb_noun pattern while text_to_speech is a noun phrase (verb implied), so it is not a perfectly uniform convention.
With only two tools the surface is thin even for a narrowly scoped TTS server, which could reasonably expose model listing, voice preview, or audio retrieval operations. It is not a mismatch, but it sits at the borderline of minimal coverage.
The core lifecycle (discover voices, then synthesize speech) is covered, including fallback behavior and defaults for voice/speed. Missing secondary operations like previewing a voice or listing models are gaps agents can work around.
Maintenance
Related MCP Connectors
Remote text-to-speech MCP server with text_to_speech and list_voices tools. Free plan.
Text to speech, voice listing and phrase library search for AI assistants. API key header.
AI voice generation: text-to-speech and voice cloning from any MCP client.
Text to speech in 149 languages: MP3 links from any assistant. Free without an account.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to convert text to speech using Microsoft Edge's Text-to-Speech service with customizable voice options, speech rate, volume, and pitch parameters.MIT
- AlicenseNot gradedqualityDmaintenanceProvides text-to-speech functionality using OpenAI's TTS API, enabling text-to-speech conversion, voice listing, and model listing.MIT
- AlicenseNot gradedqualityDmaintenanceEnables speech-to-text and text-to-speech conversion using OpenAI-compatible APIs. Supports customizable models, voices, and output directories.GPL 3.0
- AlicenseAqualityDmaintenanceEnables AI agents to synthesize natural speech using either platform system voices or premium OpenAI TTS, with automatic engine selection and graceful fallback.19 npmMIT