Files
obra__episodic-memory/cli/mcp-server-wrapper
Jesse Vincent 47ce8ce5fc Release v1.0.5: Fix sqlite-vec optional dependency installation
Fix MCP server startup error by ensuring platform-specific sqlite-vec
packages are installed correctly. The issue was that npm would use an
existing package-lock.json that didn't include the platform-specific
optional dependencies.

Changes:
- Wrapper script now deletes package-lock.json before npm install
- Add package-lock.json to .gitignore to prevent cross-platform issues
- Bump version to 1.0.5
- Update CHANGELOG.md

Testing:
- Reproduced error by removing sqlite-vec-darwin-arm64 package
- Confirmed fix: deleting package-lock.json ensures correct installation
- All 71 tests pass

Fixes: Error "Loadable extension for sqlite-vec not found. Was the
sqlite-vec-darwin-arm64 package installed?"
2025-10-25 13:41:21 -07:00

37 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Wrapper script for MCP server that ensures dependencies are installed
# This runs before the MCP server starts
# Determine plugin root directory
if [ -n "$CLAUDE_PLUGIN_ROOT" ]; then
PLUGIN_ROOT="$CLAUDE_PLUGIN_ROOT"
else
# Fall back to script directory
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PLUGIN_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
fi
# Check if node_modules exists
if [ ! -d "$PLUGIN_ROOT/node_modules" ]; then
echo "Installing episodic-memory dependencies (first run only)..." >&2
echo "This may take 30-60 seconds..." >&2
# Remove package-lock.json if it exists to ensure platform-specific optional deps are installed
# See: https://github.com/npm/cli/issues/4828
rm -f "$PLUGIN_ROOT/package-lock.json"
# Install dependencies - npm will auto-install optionalDependencies for current platform
(cd "$PLUGIN_ROOT" && npm install --prefer-offline --no-audit --no-fund) >&2
if [ $? -ne 0 ]; then
echo "ERROR: Failed to install dependencies." >&2
echo "Please run manually: cd \"$PLUGIN_ROOT\" && npm install" >&2
exit 1
fi
echo "Dependencies installed successfully." >&2
fi
# Start the MCP server
exec node "$PLUGIN_ROOT/dist/mcp-server.js"