modelscope·@ryoooo/nijivoice-mcp
暂无描述。
⚠️ Notice: This project is under development and has not been fully tested. It is not recommended for use in a production environment. ⚠️
NijiVoice-MCP is an implementation of the Model Context Protocol (MCP) for the Nijivoice API. It enables access to the Nijivoice API from LLMs (Large Language Models), making it easy to perform text-to-speech synthesis.
bash
git clone https://github.com/YOUR_USERNAME/nijivoice-mcp.git cd nijivoice-mcp
pip install -e .
.env file and add the following content:NIJIVOICE_API_KEY=Your API Key DEFAULT_VOICE_ACTOR_ID=Default Voice Actor ID (optional) LOG_LEVEL=INFO
bash python main.py
This will start the MCP server, ready to accept requests from LLM clients.
Call the tools from an LLM client that utilizes the MCP server as follows:
python
actors = await tools.call("actor/get_voice_actors")
voice_result = await tools.call("voice/generate_voice", { "script": "こんにちは、にじボイスのテストです。", "voice_actor_id": "90031163-c497-44f3-a8a6-e45e4d0cb8f6", # Voice Actor ID "speed": 1.0, "emotional_level": 0.5, "sound_duration": 0.1, "format": "mp3" })
balance = await tools.call("credit/get_credit_balance")
actor/get_voice_actors(): Retrieves a list of available voice actorsvoice/generate_voice(script, voice_actor_id, speed, emotional_level, sound_duration, format): Generates a URL for the audio filevoice/generate_encoded_voice(script, voice_actor_id, speed, emotional_level, sound_duration, format): Generates Base64 encoded audio datacredit/get_credit_balance(): Retrieves the credit balanceThe following special tags can be used within scripts:
<sp 1.0>xxx</sp>: Changes the speed of the text within the tag<wait 0.3>: Inserts a pause for the specified number of secondsnijivoice-mcp/ ├── config.py # Configuration file ├── debug_api.py # Script for API debugging ├── lib/ # Libraries ├── logger.py # Logging configuration ├── main.py # Main entry point ├── mcp/ # MCP implementation │ ├── init.py # MCP server initialization │ ├── actors.py # Voice actor related tools │ ├── credits.py # Credit related tools │ ├── prompts.py # Prompt definitions │ └── voice.py # Voice generation tools ├── nijivoice/ # Nijivoice API client │ ├── init.py │ ├── api.py # API client implementation │ ├── exceptions.py # Exception definitions │ └── models.py # Data models ├── pyproject.toml # Project definition ├── server.py # Server implementation └── utils/ # Utilities ├── init.py ├── audio.py # Audio processing utilities ├── error_handling.py # Error handling └── retry.py # Retry logic### Test
bash
pytest
⚠️ Important Limitations:
If you encounter any issues:
nijivoice_mcp.log.This project is provided under the MIT License.
This project uses FastMCP and Model Context Protocol. It utilizes the voice synthesis technology of Nijivoice.
“Voiced by NIJI Voice”
暂无描述。
暂无描述。
暂无描述。
暂无描述。
暂无描述。
一个模型上下文协议服务器,为使用微软Edge文本转语音技术的AI代理提供文本转语音功能,支持多种声音、语言和语音定制。