MLX Whisper MCP Server

MLX Whisper MCP Server

site icon
2025.04.11 3
Python音频转录语音转文字YouTube 转录内容生成
MLX Whisper MCP Server 是一个基于 Model Context Protocol (MCP) 的服务器,专门为 Apple Silicon Mac 提供音频转录功能。它利用 MLX Whisper 模型,支持从磁盘直接转录音频文件、处理 base64 编码的音频数据、下载并转录 YouTube 视频等多种功能。该服务器自包含脚本,通过 `uv run` 自动管理依赖,适合需要高质量音频转录的场景。
View on GitHub

Overview

基本能力

产品定位

MLX Whisper MCP Server 是一个专注于音频转录的服务,特别优化用于 Apple Silicon Mac,提供高质量的语音转文字功能。

核心功能

  • 从磁盘直接转录音频文件
  • 处理 base64 编码的音频数据
  • 下载并转录 YouTube 视频
  • 使用高质量的 mlx-community/whisper-large-v3-turbo 模型
  • 自包含脚本,自动管理依赖
  • 丰富的控制台输出便于调试
  • 转录文本与音频文件保存在同一位置

适用场景

  • 需要将音频内容转换为文字的场景
  • 需要处理 YouTube 视频转录的需求
  • 在 Apple Silicon Mac 上运行的高效音频处理

工具列表

  1. transcribe_file: 转录磁盘上的音频文件
  2. 参数: file_path, language (可选), task ("transcribe" 或 "translate")
  3. transcribe_audio: 转录 base64 编码的音频数据
  4. 参数: audio_data, language (可选), file_format, task ("transcribe" 或 "translate")
  5. download_youtube: 下载 YouTube 视频
  6. 参数: url, keep_file (默认为 True)
  7. transcribe_youtube: 下载并转录 YouTube 视频
  8. 参数: url, language (可选), task ("transcribe" 或 "translate"), keep_file (默认为 True)

常见问题解答

  • Import Error: 确保在 Apple Silicon Mac 上运行
  • File Not Found: 使用绝对路径引用音频文件
  • Memory Issues: 长音频文件可能导致内存压力
  • YouTube Download Errors: 部分视频可能受限或需要认证
  • JSON Errors: 确保服务器日志输出正确指向 stderr

使用教程

使用依赖

  • Python 3.12 或更高版本
  • Apple Silicon Mac (M系列)
  • 安装 uv: bash pip install uv # 或 curl -sS https://astral.sh/uv/install.sh | bash

安装教程

直接运行:

uv run mlx_whisper_mcp.py

脚本将自动安装依赖并启动 MCP 服务器。

与 Claude Desktop 集成

  1. 编辑 Claude Desktop 配置文件:
  2. macOS: code ~/Library/Application\ Support/Claude/claude_desktop_config.json
  3. Windows: code %APPDATA%\Claude\claude_desktop_config.json
  4. 添加 MLX Whisper MCP 服务器配置: json { "mcpServers": { "mlx-whisper": { "command": "uv", "args": [ "--directory", "/absolute/path/to/mlx_whisper_mcp/", "run", "mlx_whisper_mcp.py" ] } } }
  5. 重启 Claude Desktop

调试方式

运行后,查看控制台输出以确认服务器正常运行。使用示例提示测试功能: - "Transcribe the audio file at /Users/username/Desktop/recording.mp3" - "Download and transcribe this YouTube video: https://www.youtube.com/watch?v=dQw4w9WgXcQ"

许可证

该项目遵循 Apache-2.0 开源许可条款,请参阅 Apache-2.0 了解完整条款。