diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..05b5a08 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +# Generated by windows/sync.sh — see windows/README.md +windows/pkg/lmcp.lua +windows/pkg/server.lua +windows/pkg/json.lua + +# Bundled Lua + LuaSocket runtime for the Windows MSI; downloaded +# separately, not in git. +windows/pkg/lua/ + +# Editor / OS noise +*.swp +*.swo +.DS_Store diff --git a/windows/README.md b/windows/README.md new file mode 100644 index 0000000..f33092f --- /dev/null +++ b/windows/README.md @@ -0,0 +1,41 @@ +# lmcp Windows MSI build + +This directory contains the WiX manifest and packaging files for the +Windows MSI build of lmcp. + +## Workflow + +```sh +# 1. Pull the Lua + LuaSocket runtime into pkg/lua/ (one-time, see below). +# 2. Sync the lmcp .lua sources from the root of the repo: +./sync.sh +# 3. Bump windows/lmcp.wxs `Version="…"` to match the release tag. +# 4. Invoke WiX: +candle.exe lmcp.wxs +light.exe lmcp.wixobj -o lmcp-1.x.y.msi +``` + +## What's tracked vs. generated + +- **Tracked** (edit in git): + - `lmcp.wxs` — WiX MSI manifest + - `sync.sh` — copies root .lua sources → `pkg/` + - `README.md` — this file + - `pkg/install_service.bat` — Windows service installer + - `pkg/start.bat` — manual launcher + +- **Generated / external** (gitignored): + - `pkg/lmcp.lua`, `pkg/server.lua`, `pkg/json.lua` — produced by + `sync.sh`. Never edit directly; edit the root files and re-sync. + - `pkg/lua/` — the Lua + LuaSocket runtime drop-in. Download + separately and place here. Suggested source: the lua-binaries + project (https://github.com/rjpcomputing/luaforwindows) or a + similar pre-built bundle. The MSI expects `pkg/lua/lua.exe`, + `pkg/lua/lua54.dll`, and the `pkg/lua/socket/` + `pkg/lua/mime/` + subdirectories per the manifest. + +## Issue history + +Issue #18 (closed in v1.1.0) introduced this workflow after the +`pkg/` lua sources had silently drifted ~6 months out of date, +missing every feature added since April 2026. diff --git a/windows/lmcp.wxs b/windows/lmcp.wxs new file mode 100644 index 0000000..f446613 --- /dev/null +++ b/windows/lmcp.wxs @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/windows/pkg/install_service.bat b/windows/pkg/install_service.bat new file mode 100644 index 0000000..afe222a --- /dev/null +++ b/windows/pkg/install_service.bat @@ -0,0 +1,24 @@ +@echo off +REM Install lmcp as a Windows service using NSSM (Non-Sucking Service Manager) +REM Download nssm from https://nssm.cc if not present + +if not exist "%~dp0nssm.exe" ( + echo ERROR: nssm.exe not found in %~dp0 + echo Download from https://nssm.cc and place nssm.exe here. + exit /b 1 +) + +set INSTALL_DIR=%~dp0 +set SERVICE_NAME=lmcp + +echo Installing lmcp as Windows service... +%INSTALL_DIR%nssm.exe install %SERVICE_NAME% "%INSTALL_DIR%lua\lua.exe" "%INSTALL_DIR%server.lua" +%INSTALL_DIR%nssm.exe set %SERVICE_NAME% AppDirectory "%INSTALL_DIR%" +%INSTALL_DIR%nssm.exe set %SERVICE_NAME% AppEnvironmentExtra "LMCP_PORT=8080" +%INSTALL_DIR%nssm.exe set %SERVICE_NAME% DisplayName "lmcp MCP Server" +%INSTALL_DIR%nssm.exe set %SERVICE_NAME% Description "Lightweight MCP server in Lua" +%INSTALL_DIR%nssm.exe set %SERVICE_NAME% Start SERVICE_AUTO_START +%INSTALL_DIR%nssm.exe start %SERVICE_NAME% + +echo Done. Service '%SERVICE_NAME%' installed and started. +echo Check: sc query %SERVICE_NAME% diff --git a/windows/pkg/start.bat b/windows/pkg/start.bat new file mode 100644 index 0000000..4c09d34 --- /dev/null +++ b/windows/pkg/start.bat @@ -0,0 +1,7 @@ +@echo off +REM lmcp — Lua MCP Server +REM Start the server on port 8080 (or LMCP_PORT if set) +cd /d "%~dp0" +if not defined LMCP_PORT set LMCP_PORT=8080 +echo Starting lmcp on port %LMCP_PORT%... +lua\lua.exe server.lua diff --git a/windows/sync.sh b/windows/sync.sh new file mode 100755 index 0000000..45f6f63 --- /dev/null +++ b/windows/sync.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# windows/sync.sh — refresh windows/pkg/ from root .lua sources (issue #18). +# +# Run BEFORE invoking the WiX build so the MSI bundles whatever is in +# master. The .lua files in windows/pkg/ are regenerated on every run +# and are gitignored — never edit them directly. +# +# Idempotent: re-running just re-copies. Safe to call from a Makefile, +# a CI step, or by hand before `candle.exe + light.exe`. + +set -eu + +here=$(dirname "$(readlink -f "$0")") +root=$(cd "$here/.." && pwd) + +for f in lmcp.lua server.lua json.lua; do + if [ ! -f "$root/$f" ]; then + echo "windows/sync.sh: missing source $root/$f" >&2 + exit 1 + fi + cp "$root/$f" "$here/pkg/$f" + echo " synced $f" +done + +echo "windows/sync.sh: done — pkg/ matches root .lua at $(date +%Y-%m-%dT%H:%M:%S)"