MCP server

Memoria exposes its memory operations as an MCP (Model Context Protocol) server. Any MCP-aware client — Claude Code, Claude Desktop, Cursor, your own agent — can connect and use Memoria's twelve tools without writing API glue.

The server lives at https://api.memoria.premex.se/mcp and speaks streamable HTTP.

Connect from Claude Code (recommended)

Memoria supports OAuth 2.1, so you don't need to paste API keys into config files. From any project:

claude mcp add memoria https://api.memoria.premex.se/mcp

When you first use a Memoria tool, Claude Code opens a browser tab. Sign in with your Memoria account, pick the brain you want this session bound to, click Authorize. Done — the access token is stored by Claude Code, refreshed automatically, and never touches your repo.

Connect with an API key (alternative)

For long-running agents or CI environments where browser flow isn't an option, use a mem_live_* API key directly:

{
  "mcpServers": {
    "memoria": {
      "url": "https://api.memoria.premex.se/mcp",
      "headers": {
        "Authorization": "Bearer mem_live_…"
      }
    }
  }
}

The API key already binds to a single brain (created when you generated the key in the dashboard), so no brain picker shows up.

Want the setup in one line — including the agent-teaching skill? The memoria CLI installs the binary, wires this MCP entry, and keeps your key out of the config file. It's the recommended path for Claude Code on the web and other cloud environments — see the CLI guide.

The twelve tools

Generic tools

ToolWhat it does
rememberStore a new memory. Triggers the full 7-stage extraction pipeline.
recallHybrid retrieval — dense + sparse + graph, fused and re-ranked.
forgetMark an edge as no-longer-valid (bi-temporal soft delete).
relateManually create or update a relationship between two entities.
recall_historyInspect how a fact has changed over time.
get_playbookFetch a stored playbook by slug.

Coding pack

These wrap the generic tools with automatic metadata, optimised for coding agents.

ToolWhat it does
record_decisionCapture an architectural decision with rationale.
record_conventionNote a project-specific coding convention.
record_gotchaStash a gotcha that bit you so it won't bite again.
record_session_outcomeEnd-of-session summary — what shipped, what's pending.
recall_repo_contextPre-flight recall for a repo: decisions, conventions, gotchas.
regenerate_playbookRebuild a generated playbook from current memories.

Authentication details (for advanced users)

The MCP server implements:

  • RFC 9728 — OAuth 2.0 Protected Resource Metadata
  • RFC 8414 — OAuth 2.0 Authorization Server Metadata
  • RFC 7636 — PKCE (S256, mandatory)
  • RFC 7591 — Dynamic Client Registration

Discovery endpoints:

GET /.well-known/oauth-protected-resource
GET /.well-known/oauth-authorization-server

Public clients only (token_endpoint_auth_methods_supported: ["none"]). Refresh tokens rotate on every use; the old token is invalidated.

Troubleshooting

  • "Protected resource URL doesn't match" — your client is comparing against http://. Check that /.well-known/oauth-protected-resource returns https://.
  • Tool calls return 401 with invalid_token — your access token expired. Refresh tokens last 30 days; access tokens last 1 hour and refresh automatically.
  • "No brain selected" on the consent screen — pick a brain before clicking Authorize. If you have only one brain, it's pre-selected; with multiple brains the first is pre-selected.

See Brains for how brain selection bonds to API keys and OAuth tokens.