Back to MCP directory
publicPublicdnsLocal runtime

mcp_transcribe_online_vids

一个基于FastMCP的服务,利用Replicate和0x0.st实现YouTube/Bilibili视频的在线转录功能,提供带时间戳的文本输出和临时文件托管。

article

README

🚀 MCP 在线视频转录

MCP 在线视频转录是一个基于 FastMCP 的服务器项目,它为大型语言模型(LLMs)提供了访问并转录来自 YouTube 和 Bilibili 在线视频的能力。借助 Replicate0x0.st 进行临时文件托管,让视频转录更加高效便捷。

✨ 主要特性

  • 可转录 YouTube 和 Bilibili 视频,并带有时间戳输出,方便用户精准定位内容。
  • 支持自动音频提取和格式转换,无需用户手动操作。
  • 通过 WhisperX 模型进行云转录,确保转录的准确性。
  • 提供大文件的临时文件托管服务,解决大文件处理难题。

📦 安装指南

先决条件

  • Python 3.12 及以上版本。
  • 推荐使用 Conda 进行环境管理。

环境设置

# 创建并激活 conda 环境
conda create --name mcp_transcribe_online_vids python=3.12
conda activate mcp_transcribe_online_vids

# 安装所需的系统包
conda install conda-forge::uv conda-forge::ffmpeg conda-forge::sqlite

# 安装 Python 依赖项
uv pip install -r requirements.txt

配置

  1. 复制 .env.template 文件到 .env

    cp .env.template .env
    
  2. 使用你的凭证编辑 .env 文件:

    • REPLICATE_API_TOKEN:可从 Replicate 的 API 密钥页面 获取。
    • ZERO_X_URL:0x0.st 实例的 URL(默认为公共实例)。
    • TEMP_FILE_PATH:临时文件目录。
    • LOCAL_FILE_SIZE_LIMIT:直接上传到 API 的最大文件大小(单位:MB)。

💻 使用示例

启动服务器

python main.py

可用工具

  • get_youtube_transcript(url):用于转录 YouTube 视频。
  • get_bilibili_transcript(url):用于转录 Bilibili 视频。

基础用法

from fastmcp import MCPClient
import asyncio

async def get_transcript():
    client = MCPClient("http://localhost:8000")
    async with client:
        transcript = await client.call_tool("get_youtube_transcript",
            {"url": "https://www.youtube.com/watch?v=dQw********"})
        print(transcript)

# 运行异步函数
asyncio.run(get_transcript())

📚 详细文档

部署选项

有关生产环境部署,请参阅 FastMCP 传输选项。若要自定义传输,可修改 main.py 中的 mcp.run() 调用。

自托管文件存储

强烈推荐为文件存储搭建自己的 0x0.st 实例。你可以按照 托管说明 配置你的实例。

发展路线图

  • [ ] 添加工具以检索视频元数据(标题、日期、描述)。
  • [ ] 添加 YAML 部署配置。
  • [ ] 增加更多文件存储选项(Google Cloud、S3)。
  • [ ] 完成本地转录功能,使用 WhisperX
  • [ ] 支持其他媒体来源,例如 Spotify 播客。

贡献指南

有关如何为项目做出贡献,请参阅 Contributing 部分

📄 许可证

[项目许可证信息]

联系方式

  • 项目主页:[https://github.com/your-repository]
  • 作者邮箱:[你的邮箱地址]
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