Setup guide

Connecting OmniMem to OpenCode

OpenCode is an open source terminal coding agent. It supports remote MCP servers over Streamable HTTP, so it connects straight to OmniMem's /mcp endpoint.

Quick setup

Create or edit ~/.config/opencode/opencode.json for global access:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "omnimem": {
      "type": "remote",
      "url": "http://127.0.0.1:8765/mcp",
      "oauth": false,
      "timeout": 15000
    }
  }
}

OpenCode uses "mcp" as the top-level key (not "mcpServers") and "type": "remote" for anything on a network.

On the desktop app, Copy MCP URL in the tray or menu bar menu gives you the address.

"oauth": false stops OpenCode trying to negotiate OAuth when it sees a 401. That's what you want with a plain access token. If you've switched on OmniMem's OAuth for a remote server and want OpenCode to sign in through the login page, leave it out and OpenCode will run the flow itself.

If OmniMem has an access token set (MCP_AUTH_TOKEN, or Access token on the Configuration page), add it as a header:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "omnimem": {
      "type": "remote",
      "url": "http://127.0.0.1:8765/mcp",
      "headers": {
        "Authorization": "Bearer {env:OMNIMEM_TOKEN}"
      },
      "oauth": false,
      "timeout": 15000
    }
  }
}

Set OMNIMEM_TOKEN in your shell. OpenCode uses {env:VAR_NAME}, single braces and no dollar.

Coming from 6.x, change /sse to /mcp.

Config file locations

OpenCode merges config from all of these, later ones winning on conflicts:

Priority Location Use when
Lowest ~/.config/opencode/opencode.json OmniMem should be available everywhere (recommended)
Higher opencode.json in the project root Only this project needs OmniMem
Highest OPENCODE_CONFIG_CONTENT environment variable Inline JSON for CI or testing

Using OmniMem with OpenCode

Once it's configured the tools are available to the model automatically:

Verifying the connection

Start an OpenCode session and ask:

Call the OmniMem health tool to check the connection

You should get back the record and vector counts per namespace, whether the embedding model is loaded, and the uptime.

Known quirks

Notes

By Ric HarveyUpdated All guidesThis guide on Forgejo