This MCP server enables high-quality text-to-speech generation through the OpenAI TTS API, allowing integration with Claude Desktop and other MCP-compatible clients as well as direct command-line usage.
# Clone the repository
git clone https://github.com/nakamurau1/tts-mcp.git
cd tts-mcp
# Install dependencies
npm install
# Optional: Install globally
npm install -g .
# Start the MCP server directly
npx tts-mcp tts-mcp-server --voice nova --model tts-1-hd
# Use the CLI tool directly
npx tts-mcp -t "Hello, world" -o hello.mp3
# Start with default settings
npm run server
# Start with custom settings
npm run server -- --voice nova --model tts-1-hd
# Or directly with API key
node bin/tts-mcp-server.js --voice echo --api-key your-openai-api-key
Options:
-V, --version Display version information
-m, --model <model> TTS model to use (default: "gpt-4o-mini-tts")
-v, --voice <voice> Voice character (default: "alloy")
-f, --format <format> Audio format (default: "mp3")
--api-key <key> OpenAI API key (can also be set via environment variable)
-h, --help Display help information
~/Library/Application Support/Claude/claude_desktop_config.json
){
"mcpServers": {
"tts-mcp": {
"command": "node",
"args": ["full/path/to/bin/tts-mcp-server.js", "--voice", "nova", "--api-key", "your-openai-api-key"],
"env": {
"OPENAI_API_KEY": "your-openai-api-key"
}
}
}
}
Alternatively, use npx for easier setup:
{
"mcpServers": {
"tts-mcp": {
"command": "npx",
"args": ["-p", "tts-mcp", "tts-mcp-server", "--voice", "nova", "--model", "gpt-4o-mini-tts"],
"env": {
"OPENAI_API_KEY": "your-openai-api-key"
}
}
}
}
You can provide the API key in two ways:
args
array using the --api-key
parameterenv
object as shown aboveSecurity Note: Make sure to secure your configuration file when including API keys.
# Convert text directly
tts-mcp -t "Hello, world" -o hello.mp3
# Convert from a text file
tts-mcp -f speech.txt -o speech.mp3
# Specify custom voice
tts-mcp -t "Welcome to the future" -o welcome.mp3 -v nova
Options:
-V, --version Display version information
-t, --text <text> Text to convert
-f, --file <path> Path to input text file
-o, --output <path> Path to output audio file (required)
-m, --model <n> Model to use (default: "gpt-4o-mini-tts")
-v, --voice <n> Voice character (default: "alloy")
-s, --speed <number> Speech speed (0.25-4.0) (default: 1)
--format <format> Output format (default: "mp3")
-i, --instructions <text> Additional instructions for speech generation
--api-key <key> OpenAI API key (can also be set via environment variable)
-h, --help Display help information
You can configure the tool using system environment variables:
OPENAI_API_KEY=your-api-key-here
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.
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"
]
}
}
}
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.
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.