Connect OpenCode to PowerMem through OpenCode's MCP support.
OpenCode MCP references:
First download the code and enter the directory:
git clone https://github.com/oceanbase/powermem
cd powermemThen open the AI agent window in OpenCode and paste this one line:
Read and follow apps/mcp-client/SETUP.md to setup PowerMem
The agent follows apps/mcp-client/SETUP.md, runs powermem-mcp directly, and configures only the current OpenCode setup.
- OpenCode installed.
- A PowerMem backend:
- Preferred for PowerMem UI/API features:
powermem-server --host 0.0.0.0 --port 8848 - Preferred for OpenCode MCP tools:
powermem-mcp stdioorpowermem-mcp streamable-http 8848
- Preferred for PowerMem UI/API features:
- PowerMem configured with your LLM provider, API key, and model.
Install powermem[server] for the HTTP API server. Install powermem[mcp] for the
local MCP command, and add seekdb when using the default embedded seekdb
storage/embedder.
Use this section only when you want to wire OpenCode by hand.
OpenCode reads MCP config from opencode.json. Common locations are:
| Scope | File |
|---|---|
| Global user config | ~/.config/opencode/opencode.json |
| Project config | opencode.json |
| Project-local config | .opencode/opencode.json |
Use global config for a personal PowerMem setup. Use project config only when the team wants to share the MCP server definition.
For local use, add PowerMem under the mcp object:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"powermem": {
"type": "local",
"command": ["powermem-mcp", "stdio"],
"enabled": true
}
}
}If your PowerMem server requires auth, pass environment variables:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"powermem": {
"type": "local",
"command": ["powermem-mcp", "stdio"],
"enabled": true,
"environment": {
"POWERMEM_API_KEY": "<your-api-key>"
}
}
}
}Start a streamable HTTP MCP endpoint:
powermem-mcp streamable-http 8848Then configure OpenCode:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"powermem": {
"type": "remote",
"url": "http://localhost:8848/mcp",
"enabled": true
}
}
}If you expose PowerMem MCP behind a remote URL, replace http://localhost:8848/mcp with that URL and add headers if required.
- Restart OpenCode or reload MCP servers.
- Confirm
powermemis listed as an enabled MCP server. - Confirm tools such as
add_memory,search_memories,get_memory_by_id,update_memory,delete_memory,delete_all_memories, andlist_memoriesare visible. - Add a memory containing
PowerMem OpenCode probe: dragonfruit-zx9. - Search for
dragonfruit-zx9and confirm the result is returned.
- If local MCP fails, run
powermem-mcp stdioin a terminal and fix missing dependencies or.envvalues. - If remote MCP fails, verify
powermem-mcp streamable-http 8848is running and thathttp://localhost:8848/mcpis reachable from OpenCode. - If tools time out, check PowerMem server logs and consider increasing the OpenCode MCP timeout.
- If auth fails, set
POWERMEM_API_KEYfor local MCP or configure remote MCP headers.
Remove the mcp.powermem entry from the OpenCode config file you edited, then restart OpenCode or reload MCP servers. For agent-guided cleanup, follow apps/mcp-client/UNINSTALL.md.