Content
# NijiVoice MCP
This is an MCP server implementation for the [Nijivoice API](https://nijivoice.com/api) using FastMCP.
## Overview
This MCP server provides functionality for performing speech synthesis using the Nijivoice API. The main features are as follows:
- Get a list of available Voice Actors
- Generate audio files from text
- Check credit balance
## Prerequisites
- Python 3.12 or higher
- [uv](https://github.com/astral-sh/uv) - Fast Python package manager and installer
- [fastmcp](https://github.com/jlowin/fastmcp) v2.2.8 or higher
- Nijivoice API key
## Installation
1. Clone the repository:
```bash
git clone https://github.com/ryoooo/nijivoice-mcp-beta.git
cd nijivoice-mcp-beta
```
2. Create a virtual environment and install dependencies using [uv](https://github.com/astral-sh/uv):
```bash
uv venv
source .venv/bin/activate # Linux/Mac
# or
.venv\Scripts\activate # Windows
uv pip install -e .
```
3. Create a `.env` file and set the Nijivoice API key:
```
NIJIVOICE_API_KEY=your_api_key_here
```
## Usage
### Starting the MCP Server
To start the server in development mode:
```bash
uv run fastmcp dev server.py
```
To start the server in production mode:
```bash
uv run fastmcp run server.py
```
### Install and Use
To install and use the MCP server:
```bash
uv run fastmcp install server.py
```
### Features
The following features are available:
#### Tools
- `get_voice_actors()`: Get a list of available voice actors
- `generate_voice(script, actor_id, speed, emotional_level, sound_duration, format)`: Generate voice
- `get_credit_balance()`: Get credit balance
#### Resources
- `voice-actors://list`: Voice actor list resource
- `voice-actors://{actor_id}`: Get information for a specific voice actor
- `credit://balance`: Credit balance resource
#### Prompt
- `voice_generation_prompt()`: Provides a prompt for voice generation
## Voice Generation Parameters
The following parameters can be specified when generating voice:
- `script`: Text to read (maximum 3,000 characters) (required)
- `actor_id`: ID of the voice actor to use (defaults to the first voice actor if omitted)
- `speed`: Reading speed (0.4 to 3.0, default: 1.0)
- `emotional_level`: Emotional 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 format when generating voice is as follows:
```json
{
"generatedVoice": {
"audioFileUrl": "URL for audio playback",
"audioFileDownloadUrl": "URL for audio download",
"duration": 1312, // Audio length (milliseconds)
"remainingCredits": 3613 // Remaining credits after generation
}
}
```
## Testing
To run tests:
```bash
uv run pytest
```
To display detailed test results:
```bash
uv run pytest -v
```
To generate a coverage report:
```bash
uv run pytest --cov=nijivoice
```
## License
[MIT](LICENSE)
## Acknowledgments
- [fastmcp](https://github.com/jlowin/fastmcp) - Python framework for building MCP (Model Context Protocol) servers
- [Nijivoice API](https://nijivoice.com/api) - API that provides high-quality speech synthesis
Connection Info
You Might Also Like
markitdown
Python tool for converting files and office documents to Markdown.
OpenAI Whisper
OpenAI Whisper MCP Server - 基于本地 Whisper CLI 的离线语音识别与翻译,无需 API Key,支持...
oh-my-opencode
Background agents · Curated agents like oracle, librarians, frontend...
claude-flow
Claude-Flow v2.7.0 is an enterprise AI orchestration platform.
ai-engineering-from-scratch
Learn it. Build it. Ship it for others. The most comprehensive open-source...
chatbox
User-friendly Desktop Client App for AI Models/LLMs (GPT, Claude, Gemini, Ollama...)