Skip to main content

An MCP (Model Contex Protocol) Server to play and control movies using VLC.

Project description

VLC MCP Server

An MCP (Model Contex Protocol) Server to play and control movies using VLC. I use this MCP server together with my signal-mcp-client on an old laptop connected to my beamer. This way I can play a movie from my laptop by sending a signal message.

The Anthropic API key is used to use claude-haiku to summarize all existing videos in your video folder.

Usage

This installation is for Linux systems running Ubuntu or a similar Debian-based system like Raspberry Pi OS. With a few modifications it should also work on other systems. Feel free to create a pull request if you get it working on another system.

  1. Install VLC, mediainfo and uv.

    sudo apt-get install vlc mediainfo
    curl -LsSf https://astral.sh/uv/install.sh | sh
    
  2. Start the VLC http server:

    export DISPLAY=:0 # needed when running it remotely on a server
    vlc --extraintf=http --http-host=localhost --http-port=8081 --http-password=your_password
    
  3. Add the server to the MCP config file of your client.

    {
        "name": "vlc-mcp-server",
        "command": "uvx",
        "args": [
            "vlc-mcp-server"
        ],
        "env": {
            "ANTHROPIC_API_KEY": "your-key",
            "ROOT_VIDEO_FOLDER": "path/to/your/video/folder",
            "VLC_HTTP_HOST": "localhost",
            "VLC_HTTP_PORT": "8081",
            "VLC_HTTP_PASSWORD": "your_password"
        }
    }
    

    or clone the repo and use uv with a directory:

    {
        "name": "vlc-mcp-server",
        "command": "uv",
        "args": [
            "--directory",
            "path/to/root/dir/",
            "run",
            "vlc_mcp_player/main.py"
        ],
        "env": {
            "the same as above"
        }
    }
    

Contributing

Contributions to this project are welcome. Feel free to report bugs, suggest ideas, or create merge requests.

Development

Testing

Clone the repo and use mcp-client-for-testing to test the tools of the server.

uvx mcp-client-for-testing \
    --config '
    [
        "the json config from above"
    ]
    ' \
    --client_log_level "INFO" \
	--server_log_level "INFO" \
    --tool_call '{"name": "show_video", "arguments": {"video_title": "David Lynch - Dune", "subtitle_language_code": "en"}}'

Formatting and Linting

The code is formatted and linted with ruff:

uv run ruff format
uv run ruff check --fix

Building with uv

Build the package using uv:

uv build

Releasing a New Version

To release a new version of the package to PyPI, create and push a new Git tag:

  1. Checkout the main branch and get the current version:

    git checkout main
    git pull origin main
    git describe --tags
    
  2. Create and push a new Git tag:

    git tag v0.2.0
    git push origin v0.2.0
    

The GitHub Actions workflow will automatically build and publish the package to PyPI when a new tag is pushed. The python package version number will be derived directly from the Git tag.

Running as a Systemd Service

To ensure the VLC HTTP interface runs automatically on boot and restarts if it fails (on Linux systems), you can set it up as a systemd user service. User services run under your specific user account.

This setup assumes that you have completed the setup steps.

  1. Enable User Lingering to keep your user session active after logging out.

    sudo loginctl enable-linger $USER
    
  2. Create Systemd Service Directory

    mkdir -p /home/$USER/.config/systemd/user/
    
  3. Create Service File for VLC HTTP Server. Make sure vlc is installed using apt and not using snap or change the path to the vlc binary.

    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=8080'
    
    [Install]
    WantedBy=default.target
    EOF
    
  4. Enable and Start the Services

    systemctl --user daemon-reload
    systemctl --user enable vlc-http.service
    systemctl --user start vlc-http.service
    
  5. Check Service Status and Logs

    systemctl --user status vlc-http.service
    journalctl --user -u vlc-http.service -f
    

License

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vlc_mcp_server-0.1.4.tar.gz (36.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vlc_mcp_server-0.1.4-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file vlc_mcp_server-0.1.4.tar.gz.

File metadata

  • Download URL: vlc_mcp_server-0.1.4.tar.gz
  • Upload date:
  • Size: 36.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for vlc_mcp_server-0.1.4.tar.gz
Algorithm Hash digest
SHA256 6148143d1172f562d4f132fd3b917d72c9f8f66e5b7e1511dc700c7845c876d7
MD5 3d482976063162e443a83b36c3612611
BLAKE2b-256 ae492599389c8c5a219d7a9c5d2e24f3c565712eb7f2acd2a141eb5b83665f2a

See more details on using hashes here.

Provenance

The following attestation bundles were made for vlc_mcp_server-0.1.4.tar.gz:

Publisher: publish.yml on piebro/vlc-mcp-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vlc_mcp_server-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: vlc_mcp_server-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for vlc_mcp_server-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8f723bb126d812823302a9c2952f04d52292474bb61c1a07e368985da7597773
MD5 1bef104bdbc5c2389fd30b2edb30c6ec
BLAKE2b-256 2cc5875b25ccda0630396d88f245a4efba9f6fe0821e98055c90ce44d1eb9781

See more details on using hashes here.

Provenance

The following attestation bundles were made for vlc_mcp_server-0.1.4-py3-none-any.whl:

Publisher: publish.yml on piebro/vlc-mcp-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page