Back to MCP directory
publicPublicdnsLocal runtime

mcp-server-whisper

MCP Server Whisper是一个基于OpenAI Whisper和GPT-4o模型的音频处理服务器,提供高级音频转录、格式转换、批量处理和文本转语音等功能,通过Model Context Protocol标准实现与AI助手的无缝交互。

article

README

🚀 MCP 服务器耳语

MCP 服务器耳语是一个强大的工具,它借助标准化协议和先进技术,能够高效地完成音频处理和转录任务。

🚀 快速开始

你可以按照以下步骤快速使用 MCP 服务器耳语。

📦 安装指南

使用 pip 安装

pip install mcp-server-whisper

💻 使用示例

基础用法

from mcp_server_whisper import start

# 启动 MCP 服务器耳语,默认配置
start()

高级用法

# 指定自定义音频文件路径
AUDIO_FILES_PATH = "/path/to/your/audio/files"
start(audio_files_path=AUDIO_FILES_PATH)

📚 详细文档

配置说明

系统要求

  • Python 3.10 或更高版本
  • Node.js (推荐 v16.24.0 或更高)
  • Omi 屏幕录制器(仅限 Mac)

安装依赖项

npm install --save-exact \
  asyncio \
  fast-mcp \
  mcp-server-whisper \
  openai \
  pydub \
  ruff \
  mypy

配置选项

MCP 服务器配置

通过创建 mcp_server_whisper_config.json 文件进行配置:

{
  "servers": {
    "whisper": {
      "host": "localhost",
      "port": 3001,
      "workers": 4,
      "max_body_size": "5mb"
    }
  },
  "openai": {
    "api_key": "your_openai_api_key",
    "model": "gpt-4o-transcribe",
    "temperature": 0.7
  }
}

开发工具

工具链

项目使用现代 Python 开发工具:

# 运行测试
pytest

# 带覆盖率的测试
pytest --cov=src

# 格式化代码
ruff format src

# 检查代码风格
ruff check src

# 运行类型检查(严格模式)
mypy --strict src

项目架构

关键组件

  • MCP 协议:通过标准化的 MCP 工具接口暴露音频处理功能。
  • 并行处理:使用 asyncio 和批处理提升性能。
  • 文件管理:实现音频文件的检测、验证、转换和压缩。
  • 丰富转录:借助 OpenAI 的不同模型(包括 gpt-4o-transcribe)提供高质量转录。
  • 优化性能:内置缓存机制以加速重复操作。

贡献指南

如何贡献

  1. 在 GitHub 上 fork 仓库
  2. 创建功能分支 (git checkout -b feature/amazing-feature)
  3. 提交代码更改
  4. 运行测试和检查 (pytest && ruff check src && mypy --strict src)
  5. 提交变更 (git commit -m 'Add some amazing feature')
  6. 推送到分支 (git push origin feature/amazing-feature)
  7. 创建 Pull Request

📄 许可证

本项目遵循 MIT 许可证,具体内容详见 LICENSE 文件。

致谢

感谢以下项目和技术:

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client