Media-MCP-Server

June 13, 2026 · View on GitHub

Use Streamable HTTP when the MCP client runs in WSL (or Linux) but the server stays on Windows. The server binary is Windows-only; WSL connects over the network.

Architecture

flowchart LR
  subgraph WSL
    Cursor["Cursor / Codex (WSL)"]
    Config[".cursor/mcp.json\nurl: http://..."]
  end
  subgraph Windows
    HTTP["MediaMCPServer.exe (HTTP)"]
    DLLs["bin\\ DLLs + models"]
  end
  Cursor --> Config
  Config -->|"HTTP POST /mcp"| HTTP
  HTTP --> DLLs
ComponentWhere it runs
MediaMCPServer.exeWindows only
MCP client (Cursor, Codex, …)WSL or Windows
Webcam / USB camera toolsWindows host
File paths in tool argsWindows paths (C:\... or /mnt/c/...)

stdio mode does not work for WSL Remote workspaces: the client expects a Linux executable, not MediaMCPServer.exe.


Quick start

1. Install on Windows (once)

cd D:\Work\Delphi\MediaMCPServer
.\install.ps1

Or extract a production ZIP and run .\install.ps1 there.

2. Start HTTP server on Windows

WSL mirrored networking (Windows 11 22H2+, networkingMode=mirrored in .wslconfig):

cd bin
.\launch_http.cmd

Classic NAT WSL2 (default on many setups): bind on all interfaces so WSL can reach the Windows host IP:

cd bin
.\launch_http_wsl.cmd

Or use the helper (auto-detects networking, can start the server):

.\scripts\setup_wsl_http.ps1 -StartServer -WriteSnippets

3. Configure MCP inside WSL

Open the project from WSL (e.g. /mnt/d/Work/Delphi/MediaMCPServer) and run:

bash scripts/setup_wsl_mcp.sh

The script probes http://127.0.0.1:8765/mcp, then falls back to the Windows host IP from /etc/resolv.conf.

Manual override:

bash scripts/setup_wsl_mcp.sh --host 172.22.192.1

4. Refresh MCP in the client

Cursor: Settings → MCP → Refresh.
Other clients: see INSTALLATION.md.

Expect 47 tools.

5. Verify from WSL

bash scripts/tests/test_http_mcp_wsl.sh

Networking modes

ModeWSL client URLWindows server bind
Mirrored (Win11+)http://127.0.0.1:8765/mcp127.0.0.1launch_http.cmd
NAT WSL2http://<windows-host-ip>:8765/mcp0.0.0.0launch_http_wsl.cmd

Find Windows host IP (NAT)

Inside WSL:

grep nameserver /etc/resolv.conf | awk '{print \$2}'

From Windows PowerShell:

.\scripts\setup_wsl_http.ps1

Enable mirrored networking (optional)

Create or edit %USERPROFILE%\.wslconfig:

[wsl2]
networkingMode=mirrored

Then: wsl --shutdown and reopen WSL.


Client configuration

Cursor / Windsurf / Claude (WSL workspace)

/.cursor/mcp.json in the WSL project root:

{
  "mcpServers": {
    "media-mcp-server": {
      "url": "http://127.0.0.1:8765/mcp"
    }
  }
}

Template: config/mcp.wsl.http.json.template

OpenAI Codex (WSL)

Project .codex/config.toml or ~/.codex/config.toml:

[mcp_servers.media-mcp-server]
url = "http://127.0.0.1:8765/mcp"
enabled = true
startup_timeout_sec = 30
tool_timeout_sec = 120

Template: config/codex.http.wsl.config.toml.template

Production package

.\install.ps1 -Mode wsl

Writes HTTP snippets to config\ and .cursor\mcp.json with the HTTP url (for workspaces opened on Windows; re-run setup_wsl_mcp.sh from WSL for WSL Remote).


Environment variables

VariableDefaultNotes
MEDIA_MCP_HTTP_HOST127.0.0.1 / 0.0.0.0Set in launch_http*.cmd
MEDIA_MCP_HTTP_PORT8765Same on Windows and WSL
MEDIA_MCP_HTTP_PATH/mcp
MCP_HTTP_HOSTautoWSL test/setup scripts only

Troubleshooting

SymptomFix
MCP red / connection refused from WSLStart HTTP on Windows; for NAT use launch_http_wsl.cmd
Works on Windows, fails in WSL with 127.0.0.1Use NAT URL: setup_wsl_mcp.sh --host $(grep nameserver /etc/resolv.conf | awk '{print \$2}')
Firewall blocks WSLAllow MediaMCPServer.exe on private networks, or use mirrored networking
stdio config with .exe in WSL RemoteSwitch to HTTP url config
Webcam tools empty in WSLExpected — cameras are enumerated on Windows; server must run on Windows
File not found in toolsUse Windows path (D:\...) or WSL path (/mnt/d/...) consistently

Enable server logs on Windows:

$env:MEDIA_MCP_DEBUG = "1"
cd bin
.\launch_http.cmd

Scripts reference

ScriptRun wherePurpose
scripts/setup_wsl_http.ps1WindowsDetect WSL networking, start HTTP, write snippets
scripts/setup_wsl_mcp.shWSLWrite .cursor/mcp.json, auto-detect URL
scripts/tests/test_http_mcp_wsl.shWSLSmoke test HTTP MCP
bin/launch_http.cmdWindowsHTTP on 127.0.0.1 (mirrored WSL)
bin/launch_http_wsl.cmdWindowsHTTP on 0.0.0.0 (NAT WSL2)

See also: INSTALLATION.md, DISTRIBUTION.md.