mcp: make the lapis server start on hosts without a local LaPis store
The free-pi lapis entry pointed at /home/ziadarafat/.pi/agent/.../memory-store.js, an arceus path. On the Deck that file does not exist, so the server never started and no lapis tools were offered for the whole session - memory had to be reached by shelling out to arceus by hand. bin/mcp-lapis is now a single wrapper that picks a strategy per host: run the local store when the checkout is present (arceus), otherwise bridge stdio over ssh to the host that has it (the Deck). The free-pi entry runs it through sh so $HOME resolves on either machine. Verified with an MCP handshake: lapis 1.4.0, tools/list returns memory-save and friends.
This commit is contained in:
1 parent
b7d5cc394f
commit
85fdeaf280
2 files changed
+37
-8
No files matched your search
+31
-3
@@ -1,6 +1,34 @@
|
||||
#!/bin/sh
|
||||
# LaPis memory MCP server (stdio) for Cursor and Antigravity.
|
||||
# LaPis memory MCP server (stdio).
|
||||
#
|
||||
# LaPis keeps one SQLite store, on arceus (~/.pi/memory/memory.db). Hosts that
|
||||
# have the checkout run it directly; hosts that do not (the Deck) bridge stdio
|
||||
# over ssh to the host that does. One wrapper, so every agent config can point
|
||||
# at the same path regardless of machine.
|
||||
set -eu
|
||||
|
||||
LAPIS="${LAPIS_DIR:-$HOME/.pi/agent/git/github.com/GeneGulanesJr/LaPis}"
|
||||
cd "$LAPIS"
|
||||
exec node "$LAPIS/cli.js" mcp
|
||||
|
||||
node_bin() {
|
||||
if command -v node >/dev/null 2>&1; then
|
||||
command -v node
|
||||
return
|
||||
fi
|
||||
for candidate in "$HOME"/.local/share/mise/installs/node/*/bin/node; do
|
||||
[ -x "$candidate" ] && { printf %s "$candidate"; return; }
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
if [ -f "$LAPIS/memory-store.js" ]; then
|
||||
NODE=$(node_bin) || { echo "mcp-lapis: no node found for the local LaPis store" >&2; exit 1; }
|
||||
exec "$NODE" "$LAPIS/memory-store.js" mcp
|
||||
fi
|
||||
|
||||
# No local store: bridge to the host that has one. LAPIS_REMOTE defaults to the
|
||||
# personal homelab host; keep it a plain "user@host" so ProxyJump/ssh config apply.
|
||||
REMOTE="${LAPIS_REMOTE:-ziadarafat@10.0.0.23}"
|
||||
REMOTE_LAPIS="${LAPIS_REMOTE_DIR:-/home/ziadarafat/.pi/agent/git/github.com/GeneGulanesJr/LaPis}"
|
||||
|
||||
exec ssh -T -o BatchMode=yes -o ServerAliveInterval=30 "$REMOTE" \
|
||||
"/home/ziadarafat/.local/share/mise/installs/node/24.22.3/bin/node $REMOTE_LAPIS/memory-store.js mcp"
|
||||
@@ -12,12 +12,13 @@
|
||||
}
|
||||
},
|
||||
"lapis": {
|
||||
"command": "node",
|
||||
"command": "sh",
|
||||
"args": [
|
||||
"/home/ziadarafat/.pi/agent/git/github.com/GeneGulanesJr/LaPis/memory-store.js",
|
||||
"mcp"
|
||||
"-c",
|
||||
"exec \"$HOME/.dotfiles/bin/mcp-lapis\""
|
||||
],
|
||||
"description": "LaPis local persistent memory (SQLite ~/.pi/memory/memory.db): memory-save, memory-search, memory-get, memory-code and memory-doc for the current project."
|
||||
"description": "LaPis persistent memory (SQLite ~/.pi/memory/memory.db): memory-save, memory-search, memory-get, memory-code and memory-doc for the current project.",
|
||||
"exposure": "codemode"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user