From adaf7ba2ff52728a2f275d550122c297db18b3be Mon Sep 17 00:00:00 2001 From: Joakim Persson Date: Mon, 27 Apr 2026 19:58:36 +0200 Subject: [PATCH] Auto-register mempalace MCP server in generated opencode.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When entrypoint-user.sh generates a fresh opencode.json (from OPENCODE_PROVIDER env var), post-process it to add the mempalace MCP server config if mempalace is installed. Uses python3 for safe JSON merging — works for all 4 provider variants without duplicating the mcp block in each heredoc. The MCP server gives opencode access to 29 mempalace tools (search, knowledge graph, diaries, wing/room/drawer management) with zero manual config. Users who mount their own opencode.json are unaffected (the generation block only runs when no config file exists). --- entrypoint-user.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/entrypoint-user.sh b/entrypoint-user.sh index f685974..a1e168b 100644 --- a/entrypoint-user.sh +++ b/entrypoint-user.sh @@ -92,6 +92,23 @@ EOF EOF ;; esac + + # Add MemPalace MCP server if mempalace is installed + if command -v mempalace &>/dev/null && command -v python3 &>/dev/null; then + # Use python3 to merge the mcp block into the existing JSON + python3 -c " +import json, sys +with open('$CONFIG_FILE') as f: + config = json.load(f) +config.setdefault('mcp', {})['mempalace'] = { + 'type': 'local', + 'command': ['python3', '-m', 'mempalace.mcp_server'] +} +with open('$CONFIG_FILE', 'w') as f: + json.dump(config, f, indent=2) + f.write('\n') +" 2>/dev/null && echo "MemPalace MCP server added to opencode config." + fi fi # ── oh-my-opencode-slim setup (multi-agent orchestration) ────────────