NijiVoice MCP is a server implementation that leverages FastMCP to integrate with the NijiVoice API for voice synthesis. It provides functionality to retrieve available voice actors, generate audio from text, and check credit balance.
Clone the repository and navigate to the project directory:
git clone https://github.com/ryoooo/nijivoice-mcp-beta.git
cd nijivoice-mcp-beta
Create a virtual environment and install dependencies using uv:
uv venv
source .venv/bin/activate # Linux/Mac
# or
.venv\Scripts\activate # Windows
uv pip install -e .
Create a .env
file and set your NijiVoice API key:
NIJIVOICE_API_KEY=your_api_key_here
To start the server in development mode:
uv run fastmcp dev server.py
To start the server in production mode:
uv run fastmcp run server.py
To install and use the MCP server:
uv run fastmcp install server.py
When generating voice audio, you can specify these parameters:
The response from voice generation looks like this:
{
"generatedVoice": {
"audioFileUrl": "URL for audio playback",
"audioFileDownloadUrl": "URL for audio download",
"duration": 1312, // Duration in milliseconds
"remainingCredits": 3613 // Remaining credits after generation
}
}
To run tests:
uv run pytest
For detailed test results:
uv run pytest -v
To generate a coverage report:
uv run pytest --cov=nijivoice
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "nijivoice" '{"command":"uv","args":["run","fastmcp","run","server.py"]}'
See the official Claude Code MCP documentation for more details.
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 > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"nijivoice": {
"command": "uv",
"args": [
"run",
"fastmcp",
"run",
"server.py"
]
}
}
}
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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"nijivoice": {
"command": "uv",
"args": [
"run",
"fastmcp",
"run",
"server.py"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect