NijiVoice MCP server

Enables high-quality text-to-speech generation with customizable voice characteristics through the NijiVoice API for content creation, accessibility features, and interactive voice experiences.
Back to servers
Setup instructions
Provider
ryoooo
Release date
Apr 14, 2025
Language
Python

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.

Prerequisites

  • Python 3.12 or higher
  • uv - Fast Python package manager and installer
  • fastmcp v2.2.8 or higher
  • NijiVoice API key

Installation

  1. Clone the repository and navigate to the project directory:

    git clone https://github.com/ryoooo/nijivoice-mcp-beta.git
    cd nijivoice-mcp-beta
    
  2. 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 .
    
  3. Create a .env file and set your NijiVoice API key:

    NIJIVOICE_API_KEY=your_api_key_here
    

Usage

Starting the MCP Server

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

Installing the MCP Server

To install and use the MCP server:

uv run fastmcp install server.py

Available Features

Tools

  • get_voice_actors(): Retrieves a list of available voice actors
  • generate_voice(): Generates voice audio from text
  • get_credit_balance(): Checks remaining credit balance

Resources

  • voice-actors://list: Lists all voice actors
  • voice-actors://{actor_id}: Gets information about a specific voice actor
  • credit://balance: Gets credit balance information

Prompts

  • voice_generation_prompt(): Provides guidance for voice generation

Voice Generation Parameters

When generating voice audio, you can specify these parameters:

  • script: The text to be read (maximum 3,000 characters) (required)
  • actor_id: The ID of the voice actor to use (uses the first voice actor if omitted)
  • speed: Reading speed (0.4 to 3.0, default: 1.0)
  • emotional_level: Emotion level (0.0 to 1.5, default: -1.0 = use voice actor's default setting)
  • sound_duration: Phoneme pronunciation length (0.0 to 1.7, default: -1.0 = use voice actor's default setting)
  • format: Audio format ("mp3" or "wav", default: "mp3")

Response Format

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
  }
}

Running Tests

To run tests:

uv run pytest

For detailed test results:

uv run pytest -v

To generate a coverage report:

uv run pytest --cov=nijivoice

How to install this MCP server

For Claude Code

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.

For Cursor

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.

Adding an MCP server to Cursor globally

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"
            ]
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.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

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later