mem0-mcp-selfhosted CLAUDE.md

mem0-mcp-selfhosted CLAUDE.md is an instructions file for Claude Code from elvismdev/mem0-mcp-selfhosted. It costs 865 tokens per session, scanned A, original, MIT.

A project instruction file that tells a coding agent how the mem0-mcp-selfhosted repository is organised, tested, and built. It also explains how the project stores and searches persistent memories between sessions.

In plain words
What is it for?
Use it when changing, testing, or debugging this repository, especially when choosing between unit, contract, integration, or full test commands.
Why use it?
It gives the agent the repository context needed to work consistently without making the developer repeat project details. It also documents which tests need extra services such as databases or local AI tools.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions Claude Code.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/elvismdev/mem0-mcp-selfhosted/claude-md
Clone the repo
git clone --depth 1 https://github.com/elvismdev/mem0-mcp-selfhosted

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for mem0-mcp-selfhosted CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/elvismdev/mem0-mcp-selfhosted/claude-md.svg)](https://agentmods.dev/instructions/elvismdev/mem0-mcp-selfhosted/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/elvismdev/mem0-mcp-selfhosted/claude-md"><img src="https://agentmods.dev/badge/instructions/elvismdev/mem0-mcp-selfhosted/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 865 This file is loaded in full into every session.
When invoked 865 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00865 $0.00865
Opus 5 $0.00432 $0.00432
Sonnet 5 $0.00173 $0.00173
Haiku 4.5 $0.00086 $0.00086

Measured 6d ago against content hash e5731251948b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

mem0-mcp-selfhosted CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 43 lines

How it starts

The opening of the file, as written. The whole thing — 43 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

This file provides guidance to Claude Code when working with code in this repository.

MCP Servers

  • mem0: Persistent memory across sessions. At the start of each session, search_memories for relevant context before asking the user to re-explain anything. Use add_memory whenever you discover project architecture, coding conventions, debugging insights, key decisions, or user preferences. Use update_memory when prior context changes. Save information like: "This project uses PostgreSQL with Prisma", "Tests run with pytest -v", "Auth uses JWT validated in middleware". When in doubt, save it — future sessions benefit from over-remembering.

Build & Test Commands

pip install -e ".[dev]"              # Install with dev dependencies
python3 -m pytest tests/unit/ -v     # Unit tests (mocked, no infra needed)
python3 -m pytest tests/contract/ -v # Contract tests (validates mem0ai internals)
python3 -m pytest tests/integration/ -v  # Integration tests (requires live Qdrant + Neo4j + Ollama)
python3 -m pytest tests/ -v          # All tests
python3 -m pytest tests/ -m "not integration" -v  # Skip integration
python3 -m pytest tests/unit/test_auth.py::TestIsOatToken -v  # Single test class
python3 -m pytest tests/unit/test_auth.py::TestIsOatToken::test_oat_token_detected -v  # Single test

Architecture

Self-hosted MCP server using mem0ai as a library. 11 tools (9 memory + 2 graph), FastMCP orchestrator.

Module roles:

  • server.py — FastMCP orchestrator, registers all tools + memory_assistant prompt
  • config.py — Env vars → mem0ai MemoryConfig dict, handles all 5 graph LLM provider configs
  • auth.py — 3-tier token fallback: MEM0_ANTHROPIC_TOKEN~/.claude/.credentials.jsonANTHROPIC_API_KEY
  • llm_anthropic.py — Custom Anthropic provider registered with mem0ai's LlmFactory; handles OAT headers, structured outputs (JSON schema via output_config), and tool-call parsing
  • llm_router.pySplitModelGraphLLM routes by tool name: extraction tools → Gemini, contradiction tools → Claude
  • helpers.py_mem0_call() error wrapper, call_with_graph() threading lock for per-call graph toggle, safe_bulk_delete() iterates+deletes individually (never calls memory.delete_all()), patch_graph_sanitizer() monkey-patches mem0ai's relationship sanitizer for Neo4j compliance
  • graph_tools.py — Direct Neo4j Cypher queries with lazy driver init
  • __init__.py — Suppresses mem0ai telemetry before any imports

Read the full file on GitHub · 43 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 43 lines · 865 tokens per session scan A e5731251948b

Subscribe to this mod's changes

mem0-mcp-selfhosted CLAUDE.md is an instructions file published in the GitHub repository elvismdev/mem0-mcp-selfhosted (107 stars, last pushed 5mo ago), licensed MIT. It adds 865 tokens to every session, about $0.0043 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.