Merge pull request #340 from messelink/fix/mcp-pipx-compat

fix: add mempalace-mcp entry point for pipx/uv compatibility
This commit is contained in:
Igor Lins e Silva
2026-04-21 01:36:51 -03:00
committed by GitHub
12 changed files with 15 additions and 27 deletions
+1 -5
View File
@@ -1,9 +1,5 @@
{ {
"mempalace": { "mempalace": {
"command": "python3", "command": "mempalace-mcp"
"args": [
"-m",
"mempalace.mcp_server"
]
} }
} }
+1 -5
View File
@@ -9,11 +9,7 @@
"commands": [], "commands": [],
"mcpServers": { "mcpServers": {
"mempalace": { "mempalace": {
"command": "python3", "command": "mempalace-mcp"
"args": [
"-m",
"mempalace.mcp_server"
]
} }
}, },
"keywords": [ "keywords": [
+1 -1
View File
@@ -3,7 +3,7 @@ set -euo pipefail
HOOK_NAME="${1:?Usage: mempal-hook.sh <hook-name>}" HOOK_NAME="${1:?Usage: mempal-hook.sh <hook-name>}"
INPUT_FILE=$(mktemp) || { echo "Failed to create temp file" >&2; exit 1; } INPUT_FILE=$(mktemp) || { echo "Failed to create temp file" >&2; exit 1; }
cat > "$INPUT_FILE" cat > "$INPUT_FILE"
cat "$INPUT_FILE" | python3 -m mempalace hook run --hook "$HOOK_NAME" --harness codex cat "$INPUT_FILE" | mempalace hook run --hook "$HOOK_NAME" --harness codex
EXIT_CODE=$? EXIT_CODE=$?
rm -f "$INPUT_FILE" 2>/dev/null rm -f "$INPUT_FILE" 2>/dev/null
exit $EXIT_CODE exit $EXIT_CODE
+1 -5
View File
@@ -21,11 +21,7 @@
"hooks": "./hooks.json", "hooks": "./hooks.json",
"mcpServers": { "mcpServers": {
"mempalace": { "mempalace": {
"command": "python3", "command": "mempalace-mcp"
"args": [
"-m",
"mempalace.mcp_server"
]
} }
}, },
"interface": { "interface": {
+2 -2
View File
@@ -5,13 +5,13 @@
Run the MCP server: Run the MCP server:
```bash ```bash
python -m mempalace.mcp_server mempalace-mcp
``` ```
Or add it to Claude Code: Or add it to Claude Code:
```bash ```bash
claude mcp add mempalace -- python -m mempalace.mcp_server claude mcp add mempalace -- mempalace-mcp
``` ```
## Available Tools ## Available Tools
+1 -1
View File
@@ -65,7 +65,7 @@ echo "[$(date '+%H:%M:%S')] PRE-COMPACT triggered for session $SESSION_ID" >> "$
if [ -n "$MEMPAL_DIR" ] && [ -d "$MEMPAL_DIR" ]; then if [ -n "$MEMPAL_DIR" ] && [ -d "$MEMPAL_DIR" ]; then
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_DIR="$(dirname "$SCRIPT_DIR")" REPO_DIR="$(dirname "$SCRIPT_DIR")"
python3 -m mempalace mine "$MEMPAL_DIR" >> "$STATE_DIR/hook.log" 2>&1 mempalace mine "$MEMPAL_DIR" >> "$STATE_DIR/hook.log" 2>&1
fi fi
# Silent: return empty JSON to not block. "decision": "allow" is invalid — # Silent: return empty JSON to not block. "decision": "allow" is invalid —
+1 -2
View File
@@ -144,7 +144,6 @@ if [ "$SINCE_LAST" -ge "$SAVE_INTERVAL" ] && [ "$EXCHANGE_COUNT" -gt 0 ]; then
# 1. TRANSCRIPT_PATH (from Claude Code) — mine the directory it lives in # 1. TRANSCRIPT_PATH (from Claude Code) — mine the directory it lives in
# 2. MEMPAL_DIR (user-configured) — mine that directory # 2. MEMPAL_DIR (user-configured) — mine that directory
# At least one should work. If neither is set, nothing mines. # At least one should work. If neither is set, nothing mines.
PYTHON="$(command -v python3)"
MINE_DIR="" MINE_DIR=""
if [ -n "$TRANSCRIPT_PATH" ] && [ -f "$TRANSCRIPT_PATH" ]; then if [ -n "$TRANSCRIPT_PATH" ] && [ -f "$TRANSCRIPT_PATH" ]; then
MINE_DIR="$(dirname "$TRANSCRIPT_PATH")" MINE_DIR="$(dirname "$TRANSCRIPT_PATH")"
@@ -153,7 +152,7 @@ if [ "$SINCE_LAST" -ge "$SAVE_INTERVAL" ] && [ "$EXCHANGE_COUNT" -gt 0 ]; then
MINE_DIR="$MEMPAL_DIR" MINE_DIR="$MEMPAL_DIR"
fi fi
if [ -n "$MINE_DIR" ]; then if [ -n "$MINE_DIR" ]; then
"$PYTHON" -m mempalace mine "$MINE_DIR" >> "$STATE_DIR/hook.log" 2>&1 & mempalace mine "$MINE_DIR" >> "$STATE_DIR/hook.log" 2>&1 &
fi fi
# MEMPAL_VERBOSE toggle: # MEMPAL_VERBOSE toggle:
+1 -1
View File
@@ -367,7 +367,7 @@ def cmd_instructions(args):
def cmd_mcp(args): def cmd_mcp(args):
"""Show how to wire MemPalace into MCP-capable hosts.""" """Show how to wire MemPalace into MCP-capable hosts."""
base_server_cmd = "python -m mempalace.mcp_server" base_server_cmd = "mempalace-mcp"
if args.palace: if args.palace:
resolved_palace = str(Path(args.palace).expanduser()) resolved_palace = str(Path(args.palace).expanduser())
+1 -1
View File
@@ -49,7 +49,7 @@ If this fails, report the error and stop.
Run the following command to register the MemPalace MCP server with Claude: Run the following command to register the MemPalace MCP server with Claude:
claude mcp add mempalace -- python -m mempalace.mcp_server claude mcp add mempalace -- mempalace-mcp
If this fails, report the error but continue to the next step (MCP If this fails, report the error but continue to the next step (MCP
configuration can be done manually later). configuration can be done manually later).
+1 -1
View File
@@ -2,7 +2,7 @@
""" """
MemPalace MCP Server — read/write palace access for Claude Code MemPalace MCP Server — read/write palace access for Claude Code
================================================================ ================================================================
Install: claude mcp add mempalace -- python -m mempalace.mcp_server [--palace /path/to/palace] Install: claude mcp add mempalace -- mempalace-mcp [--palace /path/to/palace]
Tools (read): Tools (read):
mempalace_status — total drawers, wing/room breakdown mempalace_status — total drawers, wing/room breakdown
+1
View File
@@ -38,6 +38,7 @@ Repository = "https://github.com/MemPalace/mempalace"
[project.scripts] [project.scripts]
mempalace = "mempalace.cli:main" mempalace = "mempalace.cli:main"
mempalace-mcp = "mempalace.mcp_server:main"
[project.entry-points."mempalace.backends"] [project.entry-points."mempalace.backends"]
chroma = "mempalace.backends.chroma:ChromaBackend" chroma = "mempalace.backends.chroma:ChromaBackend"
+3 -3
View File
@@ -334,9 +334,9 @@ def test_mcp_command_prints_setup_guidance(monkeypatch, capsys):
captured = capsys.readouterr() captured = capsys.readouterr()
assert "MemPalace MCP quick setup:" in captured.out assert "MemPalace MCP quick setup:" in captured.out
assert "claude mcp add mempalace -- python -m mempalace.mcp_server" in captured.out assert "claude mcp add mempalace -- mempalace-mcp" in captured.out
assert "\nOptional custom palace:\n" in captured.out assert "\nOptional custom palace:\n" in captured.out
assert "python -m mempalace.mcp_server --palace /path/to/palace" in captured.out assert "mempalace-mcp --palace /path/to/palace" in captured.out
assert "[--palace /path/to/palace]" not in captured.out assert "[--palace /path/to/palace]" not in captured.out
assert captured.err == "" assert captured.err == ""
@@ -349,7 +349,7 @@ def test_mcp_command_uses_custom_palace_path_when_provided(monkeypatch, capsys):
captured = capsys.readouterr() captured = capsys.readouterr()
expanded = str(Path("~/tmp/my palace").expanduser()) expanded = str(Path("~/tmp/my palace").expanduser())
assert "python -m mempalace.mcp_server --palace" in captured.out assert "mempalace-mcp --palace" in captured.out
assert expanded in captured.out assert expanded in captured.out
assert "Optional custom palace:" not in captured.out assert "Optional custom palace:" not in captured.out
assert "[--palace /path/to/palace]" not in captured.out assert "[--palace /path/to/palace]" not in captured.out