MCP Whisper Transcription

MCP Whisper Transcription

An MCP server for audio/video transcription using MLX-optimized Whisper models, offering fast performance on Apple Silicon with support for multiple output formats and batch processing.

Category
访问服务器

README

MCP Whisper Transcription Server

An MCP (Model Context Protocol) server for audio/video transcription using MLX-optimized Whisper models. Optimized for Apple Silicon devices with ultra-fast performance.

✨ Features

  • 🚀 MLX-Optimized: Leverages Apple Silicon for blazing-fast transcription (up to 10x faster)
  • 🎯 Multiple Formats: Supports txt, md, srt, and json output formats
  • 🎬 Video Support: Automatically extracts audio from video files (MP4, MOV, AVI, MKV)
  • 📦 Batch Processing: Process multiple files in parallel with configurable workers
  • 🔧 MCP Integration: Full MCP protocol support with tools and resources
  • 📊 Performance Tracking: Built-in performance monitoring and reporting
  • 🎛️ Flexible Models: Choose from 6 different Whisper models (tiny to large-v3-turbo)
  • 🛠️ Error Handling: Robust error handling and validation
  • 📈 Concurrent Processing: Thread-safe concurrent transcription support
  • 🔇 Voice Activity Detection: Optional VAD to remove silence and speed up processing
  • 🧹 Hallucination Prevention: Advanced filtering to remove common transcription artifacts

🏆 Performance

  • Speed: Up to 10x realtime transcription on Apple Silicon
  • Memory: Optimized memory usage (< 500MB for most files)
  • Concurrent: Handle multiple transcriptions simultaneously
  • Scalable: Batch process hundreds of files efficiently

🚀 Quick Start

Prerequisites

  • Apple Silicon Mac (M1, M2, M3, or later)
  • Python 3.10+
  • FFmpeg (for video support)

Installation

  1. Install FFmpeg (if not already installed):

    brew install ffmpeg
    
  2. Clone the repository:

    git clone https://github.com/galacoder/mcp-whisper-transcription.git
    cd mcp-whisper-transcription
    
  3. Install Poetry (if not already installed):

    curl -sSL https://install.python-poetry.org | python3 -
    
  4. Install dependencies:

    poetry install
    
  5. Test the installation:

    poetry run python src/whisper_mcp_server.py --help
    

📋 Configuration

Environment Variables

Create a .env file to customize settings:

# Model Configuration
DEFAULT_MODEL=mlx-community/whisper-large-v3-turbo
OUTPUT_FORMATS=txt,md,srt,json

# Performance Settings
MAX_WORKERS=4
TEMP_DIR=./temp

# Optional: API Keys for future cloud features
# OPENAI_API_KEY=your_key_here

Available Models

Model Size Speed Memory Best For
whisper-tiny-mlx 39M ~10x ~150MB Quick drafts
whisper-base-mlx 74M ~7x ~250MB Balanced performance
whisper-small-mlx 244M ~5x ~600MB High quality
whisper-medium-mlx 769M ~3x ~1.5GB Professional use
whisper-large-v3-mlx 1550M ~2x ~3GB Maximum accuracy
whisper-large-v3-turbo 809M ~4x ~1.6GB Recommended

🔧 Usage

Claude Desktop Integration

Add to your Claude Desktop configuration file:

{
  "mcpServers": {
    "whisper-transcription": {
      "command": "poetry",
      "args": ["run", "python", "src/whisper_mcp_server.py"],
      "cwd": "/absolute/path/to/mcp-whisper-transcription"
    }
  }
}

📍 Configuration File Locations:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Standalone Usage

# Run the MCP server directly
poetry run python src/whisper_mcp_server.py

# Or use the development server
poetry run python -m src.whisper_mcp_server

🛠️ Available Tools & Resources

MCP Tools

Tool Description Key Parameters
transcribe_file Transcribe a single audio/video file file_path, model, output_formats
batch_transcribe Process multiple files in a directory directory, pattern, max_workers
list_models Show available Whisper models None
get_model_info Get details about a specific model model_id
clear_cache Clear model cache model_id (optional)
estimate_processing_time Estimate transcription time file_path, model
validate_media_file Check file compatibility file_path
get_supported_formats List supported input/output formats None

MCP Resources

Resource Description Data Provided
transcription://history Recent transcriptions List of all transcriptions
transcription://history/{id} Specific transcription details Full transcription metadata
transcription://models Available models Model specifications and status
transcription://config Current configuration Server settings and environment
transcription://formats Supported formats Input/output format details
transcription://performance Performance statistics Speed, memory, and uptime metrics

Quick Examples

# Single file transcription
result = await client.call_tool("transcribe_file", {
    "file_path": "interview.mp4",
    "output_formats": "txt,srt",
    "model": "mlx-community/whisper-large-v3-turbo"
})

# Transcription with Voice Activity Detection
result = await client.call_tool("transcribe_file", {
    "file_path": "long_interview.mp4",
    "output_formats": "txt,srt",
    "use_vad": True  # Remove silence for faster processing
})

# Batch processing
result = await client.call_tool("batch_transcribe", {
    "directory": "./podcasts",
    "pattern": "*.mp3",
    "max_workers": 4
})

# Check supported formats
formats = await client.call_tool("get_supported_formats", {})

🧪 Development

Running Tests

# Run all tests
poetry run pytest

# Run with coverage
poetry run pytest --cov=src --cov-report=html

# Run specific test file
poetry run pytest tests/test_mcp_tools.py -v

Code Quality

# Format code
poetry run black .
poetry run isort .

# Type checking (optional)
poetry run mypy src/

# Lint code
poetry run flake8 src/

Project Structure

mcp-whisper-transcription/
├── src/
│   └── whisper_mcp_server.py    # Main MCP server
├── tests/                       # Comprehensive test suite
├── examples/                    # Usage examples and test files
├── transcribe_mlx.py           # MLX Whisper integration
├── whisper_utils.py            # Utility functions
└── pyproject.toml              # Project configuration

📊 Performance Benchmarks

Test Results (Apple M3 Max)

Model Audio Duration Processing Time Speed Memory
tiny 10 minutes 1.2 minutes 8.3x 150MB
base 10 minutes 1.8 minutes 5.6x 250MB
small 10 minutes 2.5 minutes 4.0x 600MB
medium 10 minutes 4.2 minutes 2.4x 1.5GB
large-v3 10 minutes 5.8 minutes 1.7x 3GB
large-v3-turbo 10 minutes 3.1 minutes 3.2x 1.6GB

🔧 Troubleshooting

Common Issues

  1. FFmpeg not found

    brew install ffmpeg
    
  2. Model download slow

    • Models are cached in ~/.cache/huggingface/
    • First download can be slow but subsequent runs are fast
  3. Memory issues

    • Use smaller models (tiny/base) for large files
    • Reduce MAX_WORKERS for concurrent processing
  4. Permission errors

    • Ensure proper file permissions
    • Check output directory write access

See TROUBLESHOOTING.md for detailed solutions.

📋 Requirements

  • Python 3.10+
  • Apple Silicon Mac (M1, M2, M3, or later)
  • FFmpeg (for video file support)
  • 4GB+ RAM (8GB+ recommended for large models)
  • 2GB+ free disk space (for model cache)

📄 License

MIT License - see LICENSE file for details.

🤝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

🙏 Acknowledgments

  • Built with FastMCP - Modern MCP server framework
  • Powered by MLX Whisper - Apple Silicon optimization
  • Original Whisper by OpenAI - Revolutionary speech recognition
  • Thanks to the MLX team at Apple for the incredible performance optimizations

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选