MS-Lucidia-Voice-Gateway-MCP 是一个模型上下文协议(MCP)服务器,它借助 Windows 内置语音服务,提供文字转语音(TTS)和语音转文字(STT)功能。该服务器通过 PowerShell 命令调用本地 Windows 语音 API(SAPI),无需依赖外部 API 或服务,使用起来更加便捷和安全。
git clone https://github.com/ExpressionsBot/MS-Lucidia-Voice-Gateway-MCP.git
cd MS-Lucidia-Voice-Gateway-MCP
npm install
npm run build
npm run test
http://localhost:3000 在浏览器中⽤ Windows SAPI 语⾳将⽂字转为语⾔。
参数:
text(必需):要转换的⽂字voice(可选):要使⽤的语⾳(例如,“Microsoft David Desktop”)speed(可选):语⾔速度,范围 0.5 到 2.0(默认:1.0)例:
fetch('http://localhost:3000/tts', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
text: "Hello, this is a test",
voice: "Microsoft David Desktop",
speed: 1.0
})
});
记录⾳频并将其转换为⽂字,使⽤ Windows 语⾔识别。
参数:
duration(可选):录制时⻓(秒,默认:5,最⼤:60)例:
fetch('http://localhost:3000/stt', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
duration: 5
})
}).then(response => response.json())
.then(data => console.log(data.text));
确保 Windows 语⾔识别已启⽤:
检查可⽤的语⾳:
Add-Type -AssemblyName System.Speech
(New-Object System.Speech.Synthesis.SpeechSynthesizer).GetInstalledVoices().VoiceInfo.Name
测试语⾔识别:
MIT