# OpenCode

OpenCode can use Memside through MCP to load selected Memories, checkpoints,
Operating Rules, and other saved project context. This helps an OpenCode
session begin with the context needed for planning, coding, or review.

The configuration below uses a local bridge to connect OpenCode to the hosted
Memside MCP server.

## Before starting

1. Install a current OpenCode version.
2. Confirm that Node.js and `npx` are available.
3. Sign in to Memside.
4. Open **Settings > Developer & API**.
5. Create an API key and copy it when shown.

## Open the OpenCode configuration

Open or create `opencode.json`.

Common locations:

- Windows: `%USERPROFILE%\.config\opencode\opencode.json`
- macOS: `~/.config/opencode/opencode.json`

## Add Memside

Add the following entry and replace the placeholder with the Memside API key:

```json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "memside": {
      "type": "local",
      "command": [
        "npx",
        "-y",
        "mcp-remote",
        "https://api.memside.com/mcp/",
        "--header",
        "Authorization: Bearer mem_sk_example_key"
      ],
      "enabled": true
    }
  }
}
```

Save the file and restart OpenCode.

If the installed OpenCode version supports OAuth for remote MCP servers, add
Memside as a remote server with `https://api.memside.com/mcp/` and complete the
Memside sign-in instead.

## Confirm the connection

Open the MCP server status in OpenCode. Confirm that `memside` is enabled and
its tools are available.

Then start with a read-only request:

```text
Use Memside to find the active checkpoint and relevant Operating Rules.
```

## Troubleshooting

- Restart OpenCode after changing `opencode.json`.
- Check that the configuration is valid JSON.
- Confirm that Node.js and `npx` are available.
- Confirm that the Memside API key is active.
- Use the native remote OAuth setup when it is available in the installed
  OpenCode version.

## Next steps

- [Connection overview](/connect/mcp-and-api/)
- [API keys](/developers/api-keys/)
- [Troubleshooting](/help/troubleshooting/)
