Skip to content

feat: Add self-hosted MemOS server support#73

Open
ChaoXu1997 wants to merge 2 commits intoMemTensor:mainfrom
ChaoXu1997:feature/self-hosted-support
Open

feat: Add self-hosted MemOS server support#73
ChaoXu1997 wants to merge 2 commits intoMemTensor:mainfrom
ChaoXu1997:feature/self-hosted-support

Conversation

@ChaoXu1997
Copy link
Copy Markdown

Summary

This PR adds support for self-hosted MemOS servers to the cloud plugin, enabling users to deploy their own MemOS API while still using this plugin.

Changes

1. Self-hosted Mode Detection (lib/memos-cloud-api.js)

  • Auto-detect self-hosted mode when baseUrl is localhost or private IP (192.168.x.x, 10.x.x.x)
  • Use different API endpoints for self-hosted vs cloud:
    • Cloud: /search/memory, /add/message
    • Self-hosted: /product/search, /product/add
  • Skip API key validation for self-hosted mode

2. Plugin Kind Change (index.js, openclaw.plugin.json)

  • Changed kind from "lifecycle" to "memory"
  • This allows OpenClaw to recognize the plugin as a memory slot plugin
  • Enables automatic memory write functionality via Gateway hooks

3. API Key Skip Logic

  • Self-hosted MemOS servers don't require API key authentication
  • Added conditional check: if (!cfg.apiKey && cfg.serverMode !== "self-hosted")

Configuration Example

{
  "memos-cloud-openclaw-plugin": {
    "enabled": true,
    "config": {
      "baseUrl": "http://localhost:8000",
      "userId": "openclaw-user",
      "agentId": "moss-server",
      "multiAgentMode": true,
      "recallEnabled": true,
      "addEnabled": true,
      "timeoutMs": 30000
    }
  }
}

Testing

  • ✅ Self-hosted mode detection works correctly
  • ✅ Memory search returns results from local MemOS server
  • ✅ Memory add successfully stores to local server
  • ✅ Plugin recognized as memory slot by OpenClaw Gateway

Related

ChaoXu added 2 commits March 22, 2026 19:33
- Changed kind from 'lifecycle' to 'memory' to be recognized as memory slot plugin
- Added comments for self-hosted mode API key skip logic
- Self-hosted MemOS servers don't require API key authentication

This fixes the issue where the plugin was not recognized as a memory slot
plugin by OpenClaw Gateway, preventing automatic memory write functionality.
- Auto-detect server mode (cloud/self-hosted) based on baseUrl
- Skip API key check for self-hosted mode
- Use /product/* endpoints for self-hosted servers
- Support both cloud and self-hosted response formats
- Backward compatible with existing cloud users

Tested: search and add operations work correctly with self-hosted MemOS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant