Access memory management from MCP

Updated at:

AI coding assistants (collectively referred to as agents in this topic) require persistent long-term memory to carry project context across sessions. PolarDB memory management can be connected to mainstream agents. After the connection, agents automatically gain the ability to add, retrieve, and manage long-term memories without any code. This topic describes how to configure PolarDB memory management in Qoder, QoderWork, Claude Code, Codex, OpenCode, Hermes Agent, OpenClaw, and the Python MCP SDK.

Prerequisites

Before you start, obtain the connection parameters and make sure that your environment meets the connection requirements.

Connection parameters

Parameter

Description

Endpoint

In the <host>:<port> format. You can view the corresponding endpoint of PolarDB memory management in the Basic Information tab, in the Connection Management area.

Note

The client environment must be able to connect to PolarDB memory management over the network. If the client runs on your on-premises machine or in an environment outside the same VPC, apply for a Public network address first and add the public IP address of your machine to the application whitelist.

MCP endpoint

Append the /mcp path to the endpoint, that is, http://<host>:<port>/mcp. Required only for the MCP connection method.

Transport protocol

Streamable HTTP, based on the JSON-RPC 2.0 specification.

Authentication method

Carry the API key in the request header Authorization: Token <API_KEY> (that is, PolarDB memory management's secret.access.apikey parameter value).

Note

For managed platforms that cannot customize request headers, Authorization: Bearer <API_KEY> is also accepted. The two formats are equivalent.

Placeholder and environment variable conventions

The <API_KEY>, <host>, and <port> placeholders in the examples of this topic must be replaced with your actual API key and endpoint. Store the API key in the MEM0_API_KEY environment variable and set it in your operating system in advance:

export MEM0_API_KEY="<API_KEY>"

Some configuration examples use the ${MEM0_API_KEY:-apikey} syntax, which reads the MEM0_API_KEY environment variable first and falls back to the default value apikey when the variable is not set.

Choose a connection method

Qoder, QoderWork, QwenWork, Claude Code, Codex, OpenCode, Hermes Agent, and OpenClaw all support quick connection. Choose a method from the following table.

Connection method

Applicable scenario

Automatic recall and saving

Method 1 (recommended): Install and connect by using natural language

The agent reads the installation instructions and completes the connection by itself. No manual commands are required.

Yes

Method 2 (recommended): Install and connect from the command line

Run the one-click installation command in a terminal yourself.

Yes

Method 3: Configure the MCP server manually

You need to manage the MCP configuration file yourself, or your agent version does not support the one-click script.

No. You must explicitly ask the agent to read and write memories in the conversation.

Method 1 and Method 2 are based on the same polarmemory CLI. They have different entry points but the same result: both automatically complete CLI installation, hooks or plug-in registration, skill installation, and connectivity verification. After the connection, relevant memories are automatically recalled on each query and new memories are automatically saved at the end of each conversation turn, so these two methods are recommended. If neither applies, use Method 3 to write the MCP configuration for a single agent manually.

Method 1 (recommended): Install and connect by using natural language

Copy the following text and send it to your agent. The agent automatically completes the installation and connection setup of the polarmemory CLI.

Read https://cdn.jsdelivr.net/npm/@aliyunpolar/polarmemory/bootstrap/install.md, install the polarmemory CLI as described there, and configure your own connection with API key <API_KEY> and endpoint http://<host>:<port>.

After sending it, verify the connection result as described in Apply the configuration and verify the connection

Method 2: Install and connect from the command line

Run the one-click installation command in a terminal. Choose the Linux/macOS/WSL or Windows PowerShell version based on your operating system.

Installation commands

Qoder

Note

You can download and install the plugin through the official Qoder marketplace. Download link: Qoder marketplace.

  • Linux/macOS/WSL:

    curl -fsSL 'https://cdn.jsdelivr.net/npm/@aliyunpolar/polarmemory/bootstrap/install.sh' | sh -s -- --agent qoder --api-key <API_KEY> --base-url http://<host>:<port>
  • Windows PowerShell:

    & ([ScriptBlock]::Create((irm 'https://cdn.jsdelivr.net/npm/@aliyunpolar/polarmemory/bootstrap/install.ps1'))) -Agent qoder -ApiKey <API_KEY> -BaseUrl http://<host>:<port>

QoderWork

  • Linux/macOS/WSL:

    curl -fsSL 'https://cdn.jsdelivr.net/npm/@aliyunpolar/polarmemory/bootstrap/install.sh' | sh -s -- --agent qoderwork --api-key <API_KEY> --base-url http://<host>:<port>
  • Windows PowerShell:

    & ([ScriptBlock]::Create((irm 'https://cdn.jsdelivr.net/npm/@aliyunpolar/polarmemory/bootstrap/install.ps1'))) -Agent qoderwork -ApiKey <API_KEY> -BaseUrl http://<host>:<port>

QwenWork

  • Linux/macOS/WSL:

    curl -fsSL 'https://cdn.jsdelivr.net/npm/@aliyunpolar/polarmemory/bootstrap/install.sh' | sh -s -- --agent qwenwork --api-key <API_KEY> --base-url http://<host>:<port>
  • Windows PowerShell:

    curl -fsSL 'https://cdn.jsdelivr.net/npm/@aliyunpolar/polarmemory/bootstrap/install.sh' | sh -s -- --agent qwenwork --api-key <API_KEY> --base-url http://<host>:<port>

Claude Code

  • Linux/macOS/WSL:

    curl -fsSL 'https://cdn.jsdelivr.net/npm/@aliyunpolar/polarmemory/bootstrap/install.sh' | sh -s -- --agent claude --api-key <API_KEY> --base-url http://<host>:<port>
  • Windows PowerShell:

    & ([ScriptBlock]::Create((irm 'https://cdn.jsdelivr.net/npm/@aliyunpolar/polarmemory/bootstrap/install.ps1'))) -Agent claude -ApiKey <API_KEY> -BaseUrl http://<host>:<port>

Codex

  • Linux/macOS/WSL:

    curl -fsSL 'https://cdn.jsdelivr.net/npm/@aliyunpolar/polarmemory/bootstrap/install.sh' | sh -s -- --agent codex --api-key <API_KEY> --base-url http://<host>:<port>
  • Windows PowerShell:

    & ([ScriptBlock]::Create((irm 'https://cdn.jsdelivr.net/npm/@aliyunpolar/polarmemory/bootstrap/install.ps1'))) -Agent codex -ApiKey <API_KEY> -BaseUrl http://<host>:<port>

OpenCode

  • Linux/macOS/WSL:

    curl -fsSL 'https://cdn.jsdelivr.net/npm/@aliyunpolar/polarmemory/bootstrap/install.sh' | sh -s -- --agent opencode --api-key <API_KEY> --base-url http://<host>:<port>
  • Windows PowerShell:

    & ([ScriptBlock]::Create((irm 'https://cdn.jsdelivr.net/npm/@aliyunpolar/polarmemory/bootstrap/install.ps1'))) -Agent opencode -ApiKey <API_KEY> -BaseUrl http://<host>:<port>

Hermes Agent

  • Linux/macOS/WSL:

    curl -fsSL 'https://cdn.jsdelivr.net/npm/@aliyunpolar/polarmemory/bootstrap/install.sh' | sh -s -- --agent hermes --api-key <API_KEY> --base-url http://<host>:<port>
  • Windows PowerShell:

    & ([ScriptBlock]::Create((irm 'https://cdn.jsdelivr.net/npm/@aliyunpolar/polarmemory/bootstrap/install.ps1'))) -Agent hermes -ApiKey <API_KEY> -BaseUrl http://<host>:<port>

OpenClaw

  • Linux/macOS/WSL:

    curl -fsSL 'https://cdn.jsdelivr.net/npm/@aliyunpolar/polarmemory/bootstrap/install.sh' | sh -s -- --agent openclaw --api-key <API_KEY> --base-url http://<host>:<port>
  • Windows PowerShell:

    & ([ScriptBlock]::Create((irm 'https://cdn.jsdelivr.net/npm/@aliyunpolar/polarmemory/bootstrap/install.ps1'))) -Agent openclaw -ApiKey <API_KEY> -BaseUrl http://<host>:<port>

After the installation, restart the agent and verify the connection as described in Apply the configuration and verify the connection. When multiple people share the same PolarDB memory management instance, you can append a memory isolation parameter to the installation command. For details, see Memory isolation.

Install the CLI manually (when the script is unavailable)

If you cannot access the script URL, install the CLI and complete the connection setup manually. The value of <agent> is the same as in the commands for each platform above.

npm install -g @aliyunpolar/polarmemory
polarmemory setup --agent <agent> --api-key <API_KEY> --base-url http://<host>:<port>

After the installation, you also need to restart the corresponding agent to apply the configuration.

Method 3: Configure the MCP server manually

If you need to manage the MCP configuration file yourself, or your agent version does not support the one-click script, write the configuration manually according to the tab of your agent. This method only registers the MCP server and does not include hooks or the skill, so memories are not recalled or saved automatically. You must explicitly ask the agent to read and write memories in the conversation.

The following examples all use mem0 as the MCP server name. The commands hermes mcp test mem0 and codex mcp remove mem0 use mem0 to refer to this server name. The value of the type field that each agent uses to declare a remote server is different (Qoder uses http, QoderWork uses streamable-http, and OpenCode uses remote). Follow the example in the tab of your agent and do not reuse values across agents.

Qoder

Note

MCP tools are available only in Agent mode of Qoder.

Use the console method for quick connection of a standalone environment. Use the configuration file method when team sharing or project-versioned management is required.

Quick connection through the console

  1. Open Qoder Settings. On macOS, press Shift+Command+,. On Windows, press Ctrl+Shift+,.

  2. Go to MCP Services > My Services > + Add.

  3. Select Add by Configuration and paste the following JSON. What you paste in the console is a single server fragment without the mcpServers wrapper.

    {
      "mem0": {
        "type": "http",
        "url": "http://<host>:<port>/mcp",
        "headers": {
          "Authorization": "Token ${MEM0_API_KEY:-apikey}"
        }
      }
    }
  4. Set the API key in the .env file at the project root.

    MEM0_API_KEY=<API_KEY>

Connect through a configuration file

Qoder supports configuration files at three scopes. Their paths and recommended purposes are as follows:

Scope

Path

Recommended for Git commit

User level (global)

~/.qoder/settings.json

Project level (shared)

<project>/.mcp.json

Yes

Project level (local)

<project>/.qoder/settings.local.json

No (suitable for storing keys)

  • For team sharing, use the project level (shared) scope and create .mcp.json at the project root:

    {
      "mcpServers": {
        "mem0": {
          "type": "http",
          "url": "http://<host>:<port>/mcp",
          "headers": {
            "Authorization": "Token ${MEM0_API_KEY:-apikey}"
          }
        }
      }
    }
  • For personal use when you need to write the key directly, use the project level (local) scope. Enter the actual API key in .qoder/settings.local.json and do not commit it to Git:

    {
      "mcpServers": {
        "mem0": {
          "type": "http",
          "url": "http://<host>:<port>/mcp",
          "headers": {
            "Authorization": "Token <API_KEY>"
          }
        }
      }
    }
Note

The top-level key that Qoder uses in configuration files is mcpServers, which differs from the servers format of VS Code. Do not mix them.

QoderWork

  1. In QoderWork, go to Connectors and click + Add > Paste JSON Configuration.

  2. Paste the following content in the dialog box:

{
  "mcpServers": {
    "mem0": {
      "type": "streamable-http",
      "url": "http://<host>:<port>/mcp",
      "headers": {
        "Authorization": "Token ${MEM0_API_KEY:-apikey}"
      }
    }
  }
}

Set the MEM0_API_KEY environment variable, or replace ${MEM0_API_KEY:-apikey} with your actual API key.

QwenWork

  1. In QwenWork, go to Connectors and click + Add > Paste JSON Configuration.

  2. Paste the following content in the dialog box:

{
  "mcpServers": {
    "mem0": {
      "type": "streamable-http",
      "url": "http://<host>:<port>/mcp",
      "headers": {
        "Authorization": "Token ${MEM0_API_KEY:-apikey}"
      }
    }
  }
}

Set the MEM0_API_KEY environment variable, or replace ${MEM0_API_KEY:-apikey} with your actual API key.

Claude Code

Note

Applicable version: Claude Code 0.2.34 and later.

Use the command line method for quick connection of a standalone machine. Use a project-level configuration file for team sharing. Use the user-level scope when all projects need access.

Quick add from the command line

  1. Run the following command in the terminal to register the MCP server in one line:

    claude mcp add --transport http mem0 http://<host>:<port>/mcp \
      --header "Authorization: Token <API_KEY>"
  2. Verify that the server is added:

    claude mcp list

    After you enter the Claude Code interactive interface, type /mcp to view the connection status.

Project-level configuration file (recommended for teams)

  1. Create the .mcp.json file at the project root and commit it to Git to enable team sharing:

    {
      "mcpServers": {
        "mem0": {
          "type": "http",
          "url": "http://<host>:<port>/mcp",
          "headers": {
            "Authorization": "Token ${MEM0_API_KEY:-apikey}"
          }
        }
      }
    }
  2. Set the environment variable in the terminal:

    export MEM0_API_KEY="<API_KEY>"

User-level configuration (applies across projects)

To allow all projects to access PolarDB memory management, use the user-level scope:

claude mcp add --transport http mem0 --scope user \
  http://<host>:<port>/mcp \
  --header "Authorization: Token <API_KEY>"

Codex

The command line method cannot specify the authentication header, and a complete connection still requires editing the configuration file, so using the configuration file method directly is recommended.

Quick add from the command line

  1. Store the complete authentication header value in an environment variable.

    export MEM0_AUTH_HEADER="Token <API_KEY>"
  2. Add the MCP server and verify.

    codex mcp add mem0 --url http://<host>:<port>/mcp
    codex mcp list
Note

The command line method cannot specify the authentication header directly. After adding the server, follow the Connect through a configuration file method below, and in ~/.codex/config.toml add env_http_headers for this server.

Connect through a configuration file

Codex configures MCP servers in TOML format and supports two scopes:

Scope

Path

Description

User level

~/.codex/config.toml

Applies to all projects.

Project level

<project>/.codex/config.toml

Loaded only in trusted project directories.

  1. Store the complete authentication header value in an environment variable.

    export MEM0_AUTH_HEADER="Token <API_KEY>"
  2. Edit ~/.codex/config.toml and add the following configuration.

    [mcp_servers.mem0]
    url = "http://<host>:<port>/mcp"
    env_http_headers = { Authorization = "MEM0_AUTH_HEADER" }
  3. Verify that the server is added.

    codex mcp list
Important
  • MEM0_AUTH_HEADER stores the complete authentication header value and must include the Token prefix. Entering only the API key causes a 401 error.

  • Use env_http_headers instead of http_headers to avoid hardcoding the key in the configuration file.

  • Remove a configured server: codex mcp remove mem0.

OpenCode

OpenCode supports configuration files at two scopes. The project-level configuration takes precedence over the user-level configuration. Use the project-level configuration for team sharing and the user-level configuration for reuse across projects.

Scope

Path

Recommended for Git commit

User level (global)

~/.config/opencode/opencode.json

Project level

<project>/opencode.json

Yes

  1. Add the following content under the mcp field of the configuration file:

    {
      "$schema": "https://opencode.ai/config.json",
      "mcp": {
        "mem0": {
          "type": "remote",
          "url": "http://<host>:<port>/mcp",
          "enabled": true,
          "headers": {
            "Authorization": "Token {env:MEM0_API_KEY}"
          }
        }
      }
    }
  2. Verify that the server is added:

    opencode mcp list
Important
  • You must set "type": "remote" for a remote server. Otherwise, OpenCode starts it as a local process.

  • The top-level key that OpenCode uses is mcp, which differs from the mcpServers format of Qoder and Claude Code. Do not mix them.

  • The environment variable syntax of OpenCode is {env:VAR}, which differs from the ${VAR} syntax of Qoder and Claude Code.

  • Set enabled to false to temporarily disable the server without deleting the configuration.

Hermes Agent

Note

Applicable version: Hermes Agent 0.17 and later (built-in MCP client, depends on mcp==1.26.0).

The interactive add automatically saves the API key, verifies the connection, and writes the configuration, so it is recommended. If you need to manage the configuration content yourself, use the YAML configuration file method instead.

Interactive add

  1. Run the following command to complete the add through an interactive guide:

    hermes mcp add mem0 --url "http://<host>:<port>/mcp"
  2. The command automatically completes the following operations:

    • Prompts you to enter the API key and saves it to ~/.hermes/.env.

    • Connects to the PolarDB memory management server to verify the connection and discovers the available MCP tools.

    • Writes the configuration to ~/.hermes/config.yaml.

  3. Start Hermes to use it:

    hermes

YAML configuration file

  1. Store the API key.

    echo 'MEM0_API_KEY=<API_KEY>' >> ~/.hermes/.env
  2. Edit ~/.hermes/config.yaml.

    mcp_servers:
      mem0:
        url: "http://<host>:<port>/mcp"
        headers:
          Authorization: "Token ${MEM0_API_KEY}"
        timeout: 180
        connect_timeout: 60
  3. Verify the connection.

    hermes mcp test mem0
Note

Hermes environment variables support only the ${VAR_NAME} syntax. The default value syntax ${VAR:-default} is not supported.

Management commands

Command

Description

hermes mcp list

View the configured MCP servers.

hermes mcp test mem0

Test the connection status of PolarDB memory management.

hermes mcp remove mem0

Remove the configured PolarDB memory management MCP server.

(Optional) Advanced configuration

To customize the timeout, keepalive, tool filtering, or sampling capabilities, refer to the following configuration. The tools.include field takes MCP tool names. For the values, see Common MCP tools reference.

mcp_servers:
  mem0:
    url: "http://<host>:<port>/mcp"
    headers:
      Authorization: "Token ${MEM0_API_KEY}"
    timeout: 180
    connect_timeout: 60
    keepalive_interval: 60    # Keepalive interval, in seconds
    tools:
      include: ["add_memory_v1_memories_post", "search_memories_v2_memories_search_post", "get_all_memories_v2_memories_post"]
    sampling:
      enabled: true
      model: "gpt-4"
      max_tokens_cap: 4096

OpenClaw

  1. Edit ~/.openclaw/openclaw.json and add the following content under mcp.servers:

    {
      "mcp": {
        "servers": {
          "mem0": {
            "url": "http://<host>:<port>/mcp",
            "headers": {
              "Authorization": "Token <API_KEY>"
            }
          }
        }
      }
    }
  2. Verify that the server is added:

    openclaw mcp status

    You can also use openclaw mcp probe mem0 to open a live connection and list the available tools.

Important
  • Do not set auth: "oauth". When it is enabled, the static Authorization header is ignored.

  • The key that OpenClaw uses is mcp.servers, which differs from both the mcpServers format of Qoder and Claude Code and the mcp format of OpenCode. Do not mix them.

Qoder Cloud Agents

The mcp_servers[] of Qoder Cloud Agents supports only the name, type, and url fields. Custom request headers are not supported, and authentication is injected by the platform from the Vault, so you must complete the configuration through the API. The $QODER_PAT in the following commands is your Qoder personal access token.

Connect through the API

The first three steps are one-time configuration. The Vault and the agent can be reused by multiple sessions. After that, you only need to run step 4 each time you start a session.

  1. Create a Vault.

    curl -X POST https://api.qoder.com/api/v1/cloud/vaults \
    -H "Authorization: Bearer $QODER_PAT" \
    -H "Content-Type: application/json" \
    -d '{"display_name": "PolarDB Memory"}'
    
  2. Append a credential to the Vault. The mcp_server_url must exactly match the mcp_servers[].url in the next step (including the trailing slash). The platform matches credentials by this URL exactly.

    curl -X POST https://api.qoder.com/api/v1/cloud/vaults/<vault_id>/credentials \
    -H "Authorization: Bearer $QODER_PAT" \
    -H "Content-Type: application/json" \
    -d '{
      "auth": {
        "type": "static_bearer",
        "mcp_server_url": "http://<host>:<port>/mcp",
        "token": "<API_KEY>"
      }
    }'
    
  3. Create an agent and declare the MCP endpoint in mcp_servers.

    curl -X POST https://api.qoder.com/api/v1/cloud/agents \
    -H "Authorization: Bearer $QODER_PAT" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "mem0-agent",
      "model": "ultimate",
      "system": "You can use the mem0 tool to read and write long-term memories. Retrieve relevant memories before answering.",
      "tools": [{"type": "agent_toolset_20260401", "enabled_tools": ["Bash", "Read", "Write"]}],
      "mcp_servers": [{"name": "mem0", "type": "url", "url": "http://<host>:<port>/mcp"}]
    }'
    
  4. When creating a session, associate the Vault through vault_ids. The platform injects the credential automatically.

    curl -X POST https://api.qoder.com/api/v1/cloud/sessions \
    -H "Authorization: Bearer $QODER_PAT" \
    -H "Content-Type: application/json" \
    -d '{
      "agent": "<agent_id>",
      "vault_ids": ["<vault_id>"]
    }'
    

Apply the configuration and verify the connection

The configuration written by all three methods is loaded when the agent session starts. After the connection is complete, apply the configuration first and then verify the connection result.

  1. Restart the corresponding agent or start a new session. For OpenClaw, run openclaw gateway restart. A running graphical agent must be exited completely and then started again.

  2. If you connected through Method 1, Method 2, or a manual CLI installation, run the following command to view the connection status. In the output, connected, hooks_installed, and skill_installed all showing true means the connection succeeded.

    polarmemory status --agent <agent> --json
  3. If you connected through Method 3, run the verification command given in the tab of your agent and confirm that the MCP server is registered and connected normally.

Important

For Codex, you must also confirm that in ~/.codex/config.toml the [features] section has hooks = true set. Otherwise, memories are not recalled or saved automatically.

Memory isolation

Memories belong to a user_id. When multiple people share the same PolarDB memory management instance, you can specify different user_id values to isolate memories. How to specify it for each connection path is as follows:

  • One-click installation script and the polarmemory setup command: append --user-id <id> (-UserId <id> in Windows PowerShell). The default value is default.

  • Python MCP SDK sample script: pass --user-id my_agent_001 on the command line, or specify it through the user_id parameter in the code.

  • Calling the v2 API directly: user_id must be placed inside the filters object.

Usage examples

Whichever method you use, you can start chatting directly after the connection is complete. An agent connected through Method 1 or Method 2 automatically recalls and saves memories based on the conversation. You can also explicitly ask it to read or write memories:

> Remember that my production database is PolarDB PostgreSQL 16, deployed in the Beijing region.
> Search my memories about database deployment.
> List all my memories.

If no memory recall or saving appears in the conversation, first follow Apply the configuration and verify the connection to confirm that all three status fields are true, and then follow FAQ to troubleshoot.

Common MCP tools reference

After the connection is set up, the agent automatically selects the appropriate tool based on the conversation, so you usually do not need to remember the tool names. The following tool list is mainly for developers to reference when building custom agents.

Tool name

Description

add_memory_v1_memories_post

Add a memory.

search_memories_v2_memories_search_post

Search memories.

get_all_memories_v2_memories_post

Retrieve all memories.

delete_memory_v1_memories__memory_id__delete

Delete a memory.

merge_memories_v1_memories_merge_post

Merge memories.

extract_user_profile_v1_profile_extract_post

Extract a user profile.

When calling a tool of the v2 API, filters is a required field and user_id must be placed inside the filters object. For parameter descriptions, you can visit http://<host>:<port>/docs to view the real-time updated API documentation.

Connect through the Python MCP SDK (advanced usage)

To fine-tune the MCP connection and tool calls in a custom agent, you can use the Python MCP SDK. The run example and code integration example below are both based on the sample script mcp_client_example.py. The add_memory, search_memory, and get_all_memories in the script are Python function names wrapped by the script, and are not the same set of names as the MCP tool names in Common MCP tools reference. The two cannot be used interchangeably.

Install dependencies

pip install "mcp>=1.0" httpx

Run the example

Set the API key and run the sample script:

export MEM0_API_KEY="<API_KEY>"
python mcp_client_example.py
python mcp_client_example.py --url http://<host>:<port>/mcp
python mcp_client_example.py --user-id my_agent_001

Code integration example

The following example shows how to call the add_memory and search_memory functions wrapped by the sample script in a custom agent:

import asyncio
from mcp_client_example import add_memory, search_memory, get_all_memories

async def main():
    user_id = "my_agent_001"

    await add_memory(
        user_id=user_id,
        messages=[
            {"role": "user", "content": "My project uses PolarDB."},
            {"role": "assistant", "content": "OK, recorded."}
        ]
    )

    results = await search_memory(user_id=user_id, query="database")
    print(results)

asyncio.run(main())

FAQ

How do I confirm that the connection succeeded?

See Apply the configuration and verify the connection for the determination method: the connection succeeds when all three status fields connected, hooks_installed, and skill_installed show true.

How do I uninstall?

Run polarmemory uninstall --agent <agent> first, and then run npm uninstall -g @aliyunpolar/polarmemory. Reversing the order leaves stale hook entries in the agent configuration.

What do I do if the one-click installation script fails?

Troubleshoot in the following order:

  1. Confirm that you can access the script URL: curl -I https://cdn.jsdelivr.net/npm/@aliyunpolar/polarmemory/bootstrap/install.sh. If your network restricts access, use Install the CLI manually (when the script is unavailable) instead.

  2. Confirm that the Node.js version is 20 or later: node -v. The script does not install Node.js automatically.

  3. Confirm that you passed --base-url. This parameter is required.

What do I do if MCP tools are not visible after configuration?

Troubleshoot in the following order:

  1. Confirm that the MEM0_API_KEY environment variable is set correctly.

  2. Test the network connectivity from the client to the endpoint of PolarDB memory management, and confirm that the IP address of the client is added to the application whitelist.

  3. Check the connection status by client type:

    • Claude Code: type /mcp in the interactive interface.

    • Qoder, QoderWork, and QwenWork: check the connection status of the entry in the MCP server list.

    • Codex: run codex mcp list.

    • OpenCode: run opencode mcp list.

    • Hermes Agent: run hermes mcp test mem0.

    • OpenClaw: run openclaw mcp status.

What do I do if memories are not automatically recalled or saved after the connection?

Troubleshoot in the following order:

  1. Restart the agent or start a new session as described in Apply the configuration and verify the connection, and confirm that all three status fields show true.

  2. Run polarmemory setup --agent <agent> again to repair the configuration. You do not need to pass the API key and endpoint again.

  3. For Codex, you must also confirm that in ~/.codex/config.toml the [features] section has hooks = true set. Otherwise, memories are not recalled or saved automatically.

What do I do if the request returns 401 Unauthorized?

The authentication header format is Token <API_KEY> or Bearer <API_KEY>. The two are equivalent. Confirm that the API key is correct and has not expired, and that there is exactly one space between Token/Bearer and the key.

What do I do if a tool call reports filters is a required property?

The v2 API requires the filters field (see Common MCP tools reference for the constraints), and user_id must be placed inside the filters object. Example:

{
  "query": "search content",
  "filters": {"user_id": "your_user_id"}
}

What do I do if the Python SDK occasionally returns 400 errors?

In a multi-worker deployment on the server side, a session cleanup request may reach a different worker. The tool call itself has already succeeded. The sample script uses the except* syntax of Python to ignore such errors safely, which does not affect the actual results of memory storage and retrieval.