Media-MCP-Server

June 22, 2026 · View on GitHub

MCP server (Streamable HTTP + optional stdio) for media processing via OpenCV 5.0, FFmpeg, and ONVIF.

Quick start (development)

cd MediaMCPServer
.\install.ps1

Then refresh MCP in your client and ensure the HTTP server is running (see docs/INSTALLATION.md).

Quick start (production package)

Extract dist\media-mcp-server-*.zip, then:

.\install.ps1

Open the extracted folder as a workspace in your MCP client and refresh the server list.

Project layout

MediaMCPServer/
├── README.md
├── install.ps1              # entry point (dev)
├── build.ps1                # entry point (dev)
├── src/                     # Delphi source (.pas, .dpr)
├── scripts/
│   ├── install.ps1
│   ├── build.ps1
│   ├── package.ps1          # create production ZIP
│   ├── dist_install.ps1     # installer inside distribution
│   ├── setup_mcp.ps1
│   ├── verify_install.ps1
│   └── tests/
├── config/
│   └── mcp.json.template
├── docs/
│   ├── INSTALLATION.md      # MCP client setup (all supported IDEs)
│   ├── WSL.md               # WSL client + Windows server (HTTP)
│   ├── EXAMPLES.md          # complex use cases & agent workflows
│   ├── DISTRIBUTION.md
│   └── models-readme.txt
├── data/media/              # user captures, output, faces, video
├── bin/                     # runtime (exe, dll, models) — gitignored
└── dist/                    # production packages — gitignored

Requirements (build machine)

ComponentPurpose
Windows 10/11 x64Platform
RAD Studio / Delphi dcc64Build server
MSVC + CMakeBuild opencv_delphi_wrapper.dll (if needed)
OpenCV 5.0 builtNative DLLs via OpenCV_DIR
Sibling repos (compile)OpenCV\OpenCV 5.0, Delphi-FFMPEG, Delphi-ONVIF
NetworkDirect download of models/DLLs via scripts\download_deps.ps1

Scripts

CommandDescription
.\install.ps1Full install (download deps + build + MCP config)
.\build.ps1Build only
.\scripts\download_deps.ps1Download models + FFmpeg + OpenCV runtime to bin\
.\scripts\download_models.ps1ONNX models only
.\scripts\download_ffmpeg_dll.ps1FFmpeg DLLs only
.\scripts\download_opencv_runtime.ps1OpenCV DLLs + build opencv_delphi_wrapper.dll
.\scripts\package.ps1Create lite ZIP in dist\ (default)
.\scripts\package.ps1 -Variant fullCreate offline full ZIP
.\scripts\release.ps1 -Version X -PublishPackage + GitHub Release
.\scripts\setup_mcp.ps1Regenerate project MCP config (HTTP, starts server)
.\scripts\setup_mcp.ps1 -Stdiostdio MCP config instead of HTTP
.\scripts\setup_mcp.ps1 -WslWSL HTTP setup (Windows side)
.\scripts\setup_wsl_http.ps1Detect WSL networking, start HTTP, write snippets
bash scripts/setup_wsl_mcp.shConfigure MCP in WSL (run inside WSL)
.\scripts\verify_install.ps1Check installation
.\scripts\tests\test_http_mcp.ps1Smoke test via Streamable HTTP (default)
.\scripts\tests\test_tools.ps1Smoke test via stdio (--stdio)
bash scripts/tests/test_http_mcp_wsl.shHTTP smoke test from WSL

install.ps1 options

.\install.ps1 -OpenCvDir "C:\opencv\build"
.\install.ps1 -Force -SkipDownload
.\install.ps1 -StrictVerify

MCP clients

Supported MCP clients and per-IDE setup: docs/INSTALLATION.md.

Complex workflow examples (webinar recap; ONVIF/RTSP warehouse monitoring; USB webcam access control): docs/EXAMPLES.md.

Quick config (Streamable HTTP — default):

.\bin\MediaMCPServer.exe
# or: .\bin\launch_http.cmd

Client config: "url": "http://127.0.0.1:8765/mcp" — see config/mcp.json.template and docs/INSTALLATION.md.

stdio (optional)

Run the server with --stdio and use command + cwd in client config — see config/mcp.stdio.json.template.

WSL: client in WSL, server on Windows — docs/WSL.md.

Environment variables

VariablePurpose
OpenCV_DIRCMake path to OpenCV build
OPENCV_MODELS_PATH / MEDIA_MCP_MODELS_PATHONNX models directory
MEDIA_MCP_DATA_PATHOverride data\media\
MEDIA_MCP_DEBUG=1Log to stderr
MEDIA_MCP_TRANSPORT=stdioForce stdio mode (default is HTTP)
MEDIA_MCP_HTTP_HOSTHTTP bind host (default 127.0.0.1)
MEDIA_MCP_HTTP_PORTHTTP port (default 8765)
MEDIA_MCP_HTTP_PATHHTTP path (default /mcp)

Tools (47)

FFmpeg: video_probe, video_grab_frame, video_scene_detect, video_trim, …
OpenCV: image_detect_objects, image_detect_faces, face_enroll, face_identify, …
Camera: webcam_list, webcam_grab_frame, video_track_object
ONVIF: camera_discover, onvif_get_stream_uri, …

Production release

On a developer machine with a full build:

.\install.ps1
.\scripts\release.ps1 -Version "1.0.3"

Creates dist\media-mcp-server-<version>-win64-lite.zip (GitHub default).
Optional full offline ZIP: -Variant both. Publish: -Publish (requires gh CLI).

See docs/RELEASE.md for the full maintainer workflow.

On target machine (no Delphi):

# download lite ZIP from GitHub Releases, extract, then:
.\install.ps1

See docs/DISTRIBUTION.md for deployment details.

Troubleshooting

IssueFix
MCP connection refusedStart HTTP server: cd bin; .\launch_http.cmd
MCP JSON errorRun .\scripts\setup_mcp.ps1
Yellow MCP statusWait or reload window; check tools count in MCP panel
Missing models.\scripts\download_models.ps1 -Force
Missing FFmpeg.\scripts\download_ffmpeg_dll.ps1 -Force
OpenCV load error.\scripts\download_opencv_runtime.ps1 -Force
DLL load failed (package)Extract full ZIP; do not copy only .exe