Back to MCP directory
publicPublicdnsLocal runtime

vlc-mcp-server

一个基于VLC媒体播放器的MCP服务器,支持通过MCP客户端远程控制和播放视频。适用于Linux系统,可通过Signal等客户端实现远程电影播放控制。

article

README

🚀 VLC MCP 服务器

VLC MCP 服务器是一个借助 VLC 媒体播放器来实现电影播放与控制的 Model Context Protocol (MCP) 服务器。借助任意 MCP 客户端(例如 awesome-mcp-clients),就能远程操控视频播放。

我使用运行在旧笔记本电脑上的 signal-mcp-client 连接到投影仪,这样只需发送一条信号消息就能播放电影。以下是使用方法示例:

🚀 快速开始

此安装适用于运行 Ubuntu 或类似基于 Debian 系统的 Linux 系统(例如 Raspberry Pi OS)。经过适当修改,它也应在其他系统上运行。如果成功在其他系统上运行,请随时提交拉取请求。

📦 安装指南

  1. 安装 VLC、mediainfo 和 uv:

    sudo apt-get install vlc mediainfo
    curl -LsSf https://astral.sh/uv/install.sh | sh
    
  2. 启动 VLC HTTP 服务器:

    export DISPLAY=:0 # 在远程服务器上运行时需要设置此变量
    vlc --extraintf=http --http-host=localhost --http-port=8081 --http-password=your_password
    
  3. 配置 MCP 客户端以与 VLC HTTP 接口通信。例如,在 config.json 中添加以下内容:

    {
      "vlc": {
        "host": "localhost",
        "port": 8081,
        "password": "your_password"
      }
    }
    
  4. 使用 MCP 客户端控制 VLC 播放器。例如,发送以下命令来播放媒体:

    mcpctl send vlc.play "media_url"
    

💻 使用示例

基础用法

# 安装依赖
sudo apt-get install vlc mediainfo
curl -LsSf https://astral.sh/uv/install.sh | sh

# 启动 VLC HTTP 服务器
export DISPLAY=:0
vlc --extraintf=http --http-host=localhost --http-port=8081 --http-password=your_password

# 配置 MCP 客户端
{
    "vlc": {
        "host": "localhost",
        "port": 8081,
        "password": "your_password"
    }
}

# 播放媒体
mcpctl send vlc.play "media_url"

高级用法

# 若要在系统启动时自动运行 VLC HTTP 服务器,可配置 systemd 服务
cat << EOF > "/home/$USER/.config/systemd/user/vlc-http.service"
[Unit]
Description=VLC Media Player with HTTP Interface
After=network.target sound.target

[Service]
Restart=on-failure
RestartSec=30
SyslogIdentifier=vlc-http
Environment="DISPLAY=:0"

ExecStart=/usr/bin/vlc --extraintf=http --http-host=localhost --http-port=8081 --http-password=your_password

ExecStop=/usr/bin/pkill -f '/usr/bin/vlc --extraintf=http --http-host=localhost --http-port=8081'

[Install]
WantedBy=default.target
EOF

# 启用并启动服务
systemctl --user daemon-reload
systemctl --user enable vlc-http.service
systemctl --user start vlc-http.service

# 检查服务状态和日志
systemctl --user status vlc-http.service
journalctl --user -u vlc-http.service -f

🤝 贡献指南

欢迎任何贡献!如果您发现任何问题,请在 GitHub 上提交问题或拉取请求。

  • 报告错误:请在 Issues 页面提交错误。
  • 功能请求:同样可以在 Issues 页面提出新功能的请求。
  • 代码贡献:请 Fork 仓库并在您的分支上进行更改,然后创建一个拉取请求。

🛠️ 开发指南

  1. 格式化代码: 使用 black 来格式化 Python 代码:

    black .
    
  2. 构建文档: 使用 sphinx-build 生成文档:

    sphinx-build docs/ docs/_build/
    
  3. 测试: 运行单元测试以确保功能正常。

📄 许可证

此项目在 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