MCP Media Server

MCP Media Server

Enables browsing and playing media files from a local Movies directory through natural language commands. Supports listing all movies and launching playback using the system's default media player.

Category
访问服务器

README

MCP Media Server

A Model Context Protocol (MCP) server and client for listing and playing media files from ~/Media/MOVIES. Supports stdio, HTTP, and HTTPS transports, compatible with Claude Desktop.

Features

  • List Movies: Browse all media files in your Movies directory
  • Play Movies: Start playback using system default media player
  • Multiple Transports: stdio (for Claude Desktop), HTTP, and HTTPS
  • Cross-Platform: Works on Linux, ( later macOS, and Windows )

Installation

# Install dependencies
pip install -r requirements.txt

# Or install individually
pip install mcp starlette uvicorn sse-starlette

Quick Start

Server

stdio (for Claude Desktop):

python media_server.py --transport stdio

HTTP:

python media_server.py --transport http --host 0.0.0.0 --port 3000

HTTPS: there is no built in https (regardless of what said) use Caddy as reverse proxy to handle https and forwad http to media_server


### Client

**List movies via stdio:**
```bash
python media_client.py --protocol stdio --command list

Play movie via stdio:

python media_client.py --protocol stdio --command play --movie "example.mp4"

List movies via HTTP:

python media_client.py --protocol http --url http://localhost:3000/sse --command list

Play movie via HTTPS:

python media_client.py --protocol https --url https://localhost:3001/sse \
    --command play --movie "example.mp4"

Caddy for https

pi5c.example.com:3001 {
	tls /etc/caddy/certs/fullchain.pem /etc/caddy/certs/privkey.pem
	reverse_proxy localhost:3000
}

In my case "pi5c.example.com" is public DNS entry with a local IP. There has got to be a better way, but it works for now.

I have a wildcard cert for *.example.com which I copied locally Copy the certs to /etc/caddy/certs/ (create if missing) and change owner to caddy

mkdir -p /etc/caddy/certs
cp /etc/letsencrypt/live/example.com/fullchain.pem /etc/caddy/certs/
cp /etc/letsencrypt/live/example.com/privkey.pem /etc/caddy/certs/
chown caddy:caddy /etc/caddy/certs/*
chmod 644 /etc/caddy/certs/fullchain.pem
chmod 600 /etc/caddy/certs/privkey.pem

Configuration

Media Directory

By default, the server looks for media files in ~/Media/MOVIES. To change this, edit the MEDIA_DIR variable in media_server.py:

MEDIA_DIR = Path.home() / "Media" / "MOVIES"

Supported File Types

The following video formats are supported:

  • .mp4, .mkv, .avi, .mov, .wmv, .flv, .webm, .m4v, .mpg, .mpeg

To add more formats, edit the MEDIA_EXTENSIONS set in media_server.py.

Claude Desktop Integration

Add to your Claude Desktop configuration (claude_desktop_config.json):

{
  "mcpServers": {
    "media-server": {
      "command": "python",
      "args": ["/path/to/media_server.py", "--transport", "stdio"]
    }
  }
}

n8n Integration

UNTESTED For n8n, use the HTTP or HTTPS transport:

  1. Start the server with HTTP/HTTPS transport
  2. In n8n, use the HTTP Request node to connect to http://your-server:8000/sse
  3. Use POST requests to /messages endpoint for MCP communication

Media Player Requirements

The server will automatically detect and use available media players:

Linux:

  • MPV (mpv) this is the only player that works reliably
  • VLC (vlc)
  • MPlayer (mplayer)
  • Or system default (xdg-open)

macOS:

  • Uses open command (system default player)

Windows:

  • Uses os.startfile() (system default player)

Install a Player (Linux)

# Ubuntu/Debian
sudo apt install vlc

# Fedora
sudo dnf install vlc

# Arch
sudo pacman -S vlc

API Reference

Tools

list_movies

Lists all media files in the Movies directory.

Arguments: None

Returns: List of movies with name, path, size, and file type

Example:

{
  "name": "list_movies",
  "arguments": {}
}

play_movie

Plays a specific movie using the system's default media player.

Arguments:

  • filename (string, required): Name of the movie file

Returns: Status message indicating success or error

Example:

{
  "name": "play_movie",
  "arguments": {
    "filename": "example.mp4"
  }
}

Server Command-Line Options

usage: media_server.py [-h] [--transport {stdio,http,https}] [--host HOST]
                       [--port PORT] [--certfile CERTFILE] [--keyfile KEYFILE]

optional arguments:
  --transport {stdio,http}
                        Transport protocol to use (default: stdio)
  --host HOST          Host to bind to for HTTP/HTTPS (default: 127.0.0.1)
  --port PORT          Port to bind to for HTTP/HTTPS (default: 8000)

Client Command-Line Options

usage: media_client.py [-h] --protocol {stdio,http,https} --command {list,play}
                       [--movie MOVIE] [--url URL] [--server-script SERVER_SCRIPT]

optional arguments:
  --protocol {stdio,http,https}
                        Protocol to use for connecting to server
  --command {list,play}
                        Command to execute (list or play)
  --movie MOVIE        Movie filename to play (required for 'play' command)
  --url URL            Server URL for HTTP/HTTPS (e.g., http://localhost:8000/sse)
  --server-script SERVER_SCRIPT
                        Path to server script for stdio (default: media_server.py)

Troubleshooting

No media player found

Install MPV or another supported media player:

sudo apt install mpv  # Linux

Connection errors with HTTP/HTTPS

  • Check that the server is running
  • Verify the URL includes /sse endpoint
  • For HTTPS, ensure certificate files are valid

Permission errors

Ensure the ~/Media/MOVIES directory exists and is readable:

mkdir -p ~/Media/MOVIES
chmod 755 ~/Media/MOVIES

Security Notes

  • The server only accesses files in the configured media directory
  • The server does not modify or delete any files

License

MIT License - Feel free to use and modify as needed.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选