一个简单的模型上下文协议(MCP)服务器,它使用 MLX Whisper 在 Apple Silicon Mac 上提供音频转录功能。
mlx-community/whisper-large-v3-turbo 模型uv run 自动管理依赖项uv (pip install uv 或 curl -sS https://astral.sh/uv/install.sh | bash)直接运行:
uv run mlx_whisper_mcp.py
就这样!该脚本会自动安装其依赖项并启动 MCP 服务器。 注意:第一次运行脚本时,可能需要更长时间启动,因为它会下载 Whisper 模型(约 1.6GB)。后续运行会更快。
有两种主要方式将此服务器与 Claude Desktop 集成:
uv(推荐)mlx_whisper_mcp.py 的目录。uv tool run fastmcp install mlx_whisper_mcp.py
fastmcp 将设置必要的配置以启动服务器,包括通过 uv run 处理其依赖项。如果您希望手动配置 Claude Desktop:
编辑您的 Claude Desktop 配置文件:
# 在 macOS 上:
code ~/Library/Application\ Support/Claude/claude_desktop_config.json
# 在 Windows 上:
code %APPDATA%\Claude\claude_desktop_config.json
添加 MLX Whisper MCP 服务器配置。
重要: 将下面 cwd 字段中的 /absolute/path/to/mlx_whisper_mcp/ 替换为您系统中包含 mlx_whisper_mcp.py 的实际绝对路径。
{
"mcpServers": {
"mlx-whisper": {
"command": "uv",
"args": [
"run",
"mlx_whisper_mcp.py"
],
"cwd": "/absolute/path/to/mlx_whisper_mcp/"
}
}
}
此配置告诉 Claude Desktop 使用 uv run 执行 mlx_whisper_mcp.py,并将当前工作目录 (cwd) 设置为脚本的位置。uv run 将处理为脚本定义的依赖项安装。
重启 Claude Desktop。
该服务器提供了以下工具:
transcribe_file从磁盘上的路径转录音频文件。
参数:
file_path: 音频文件的路径language: (可选)强制特定语言的语言代码task: "transcribe" 或 "translate"(翻译成英文)transcribe_audio从 base64 编码的数据中转录音频。
参数:
audio_data: base64 编码的音频数据language: (可选)强制特定语言的语言代码file_format: 音频文件格式(如 wav、mp3 等)task: "transcribe" 或 "translate"(翻译成英文)download_youtube下载 YouTube 视频。
参数:
url: YouTube 视频的 URLkeep_file: 如果为 True,则保留下载的文件(默认值:True)transcribe_youtube下载并转录 YouTube 视频。
参数:
url: YouTube 视频的 URLlanguage: (可选)强制特定语言的语言代码task: "transcribe" 或 "translate"(翻译成英文)keep_file: 如果为 True,则保留下载的文件(默认值:True)此服务器使用 MCP Python SDK 将 MLX Whisper 的转录能力暴露给像 Claude 这样的客户端。当请求转录时:
~/.mlx-whisper-mcp/downloadsApache 许可证 2.0 详情见 LICENSE。