一款高性能的模型上下文协议(MCP)服务器,使用whisper.cpp提供本地语音转文字功能,并针对Apple Silicon进行了优化。
brew install whisper-cpp)brew install ffmpeg) - 自动处理MP3、M4A、FLAC、OGG等格式git clone https://github.com/your-username/local-stt-mcp.git
cd local-stt-mcp/mcp-server
npm install
npm run build
# 下载whisper模型
npm run setup:models
# 对于说话人分离,设置HuggingFace令牌
export HF_TOKEN="your_token_here" # 从huggingface.co获取免费令牌
说话人分离注意事项:需要HuggingFace账户并接受pyannote/speaker-diarization-3.1许可。
在您的MCP客户端配置中添加:
{
"mcpServers": {
"whisper-mcp": {
"command": "node",
"args": ["path/to/local-stt-mcp/mcp-server/dist/index.js"]
}
}
}
| 工具 | 描述 |
|---|---|
transcribe | 基本音频转录,带有自动格式转换 |
transcribe_long | 长音频文件处理,带分块和格式转换 |
transcribe_with_speakers | 说话人分离和转录,支持格式 |
list_models | 显示可用的whisper模型 |
health_check | 系统诊断 |
version | 服务器版本信息 |
Apple Silicon基准测试:
详细性能比较见/benchmarks/目录。
mcp-server/
├── src/ # TypeScript源代码
│ ├── tools/ # MCP工具实现
│ ├── whisper/ # whisper.cpp集成
│ ├── utils/ # 说话人分离及实用工具
│ └── types/ # 类型定义
├── dist/ # 编译后的JavaScript
└── python/ # Python依赖
# 构建
npm run build
# 开发模式(监视)
npm run dev
# 代码检查与格式化
npm run lint
npm run format
# 类型检查
npm run type-check
MIT许可证 - 详情见LICENSE文件。