Auto-register mempalace MCP server in generated opencode.json
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).
This commit is contained in:
@@ -92,6 +92,23 @@ EOF
|
|||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
esac
|
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
|
fi
|
||||||
|
|
||||||
# ── oh-my-opencode-slim setup (multi-agent orchestration) ────────────
|
# ── oh-my-opencode-slim setup (multi-agent orchestration) ────────────
|
||||||
|
|||||||
Reference in New Issue
Block a user