Mnemon Mcp

io.github.nikitacometa由 GitHub 帳號 nikitacometa 發布v1.0.1更新於 Oct 24, 2026

Persistent layered memory for AI agents. SQLite FTS5, fact versioning, zero-cloud.

已驗證STDIO僅桌面資料庫知識與記憶

概覽

AI 產生的概覽

為 AI 助理提供持久化的長期記憶,存放在本機 SQLite 檔案中,支援分層記憶、事實版本管理,以及全文或混合檢索。

可以做什麼
Mnemon 提供十個 MCP 工具,用來儲存、搜尋、更新、刪除、檢視、匯出記憶,以及執行健康診斷,另外還支援工作階段追蹤與知識庫匯入。記憶分為情境、語意、程序與資源四層,更新後的事實以取代鏈保留,而不是直接刪除。檢索預設使用 SQLite FTS5,設定嵌入提供者後可啟用向量與混合模式。資源與提示詞可提供統計、近期記憶,以及回想或日誌工作流程。
適用情境
當助理需要跨對話記住事實、偏好、規則與過去的工作階段,而且希望這些記憶留在自己的機器上時,適合使用。它適合本機優先的情境,單一 SQLite 檔案比雲端記憶服務更容易備份與稽核。
執行需求
以本機 stdio 程序執行,透過 npm 套件 mnemon-mcp 安裝,因此需要 Node.js。SQLite 資料庫會自動建立於 MNEMON_DB_PATH(預設 ~/.mnemon-mcp/memory.db)。預設全文檢索不需要帳號或 API 金鑰;向量或混合檢索需要將 MNEMON_EMBEDDING_PROVIDER 設為 openai 或 ollama,使用 OpenAI 時還需要 MNEMON_EMBEDDING_API_KEY。選用的 HTTP 傳輸使用 MNEMON_AUTH_TOKEN、MNEMON_HOST 與 MNEMON_PORT。
安裝前請注意
記憶庫會保存助理寫入的任何內容,應把資料庫檔案視為敏感資料並主動備份。向量檢索會把記憶內容傳送給所設定的嵌入提供者;使用 OpenAI 代表資料離開本機,Ollama 則可維持在本機。選用的 HTTP 傳輸在未設定 MNEMON_AUTH_TOKEN 時會拒絕綁定非本機位址,而 MNEMON_ALLOW_INSECURE_HTTP=1 會關閉這項保護。工具可以更新、刪除與清理記憶,memory_delete 也會重新啟用被取代的前一版本。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Mnemon Mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

mnemon-mcp

[CI] [npm version] [Node.js] [License: MIT]

Persistent layered memory for AI agents. Local-first. Zero-cloud. Single SQLite file.

Landing Page · npm · GitHub

Your AI agent forgets everything after each session. Mnemon fixes that.

It gives any MCP-compatible client — OpenClaw, Claude Code, Cursor, Windsurf, or your own — a structured long-term memory backed by a single SQLite database on your machine. No API keys, no cloud, no telemetry. Just npm install and your agent remembers.

[mnemon-mcp demo — memory_add, memory_search, memory_inspect, memory_update]


Why Layered Memory?

Flat key-value stores treat "what happened yesterday" the same as "never commit without tests." That's wrong — different kinds of knowledge have different lifetimes and access patterns.

Mnemon organizes memories into four layers:

LayerWhat it storesHow it's accessedLifetime
EpisodicEvents, sessions, journal entriesBy date or periodDecays (30-day half-life)
SemanticFacts, preferences, relationshipsBy topic or entityStable
ProceduralRules, workflows, conventionsLoaded at startupRarely changes
ResourceReference material, book notesOn demandDecays slowly (90 days)

A journal entry from last Tuesday and a coding rule that never changes live in different layers — because they should.

Retrieval Quality

Retrieval is measured against a 50-case golden set on a real 797-memory bilingual (RU/EN) corpus, through the actual MCP server — not a reimplementation. Current numbers (methodology & history):

MetricFTS-onlyVector-onlyHybrid (RRF)
Composite score88.989.291.7
Recall@50.9070.8980.919
MRR0.8170.8320.878
nDCG@50.8160.8280.869
Negative precision1.0001.0001.000

Hybrid beats both legs individually, which is the whole argument for fusing them: lexical search has the better raw recall, vector search the better ranking, and RRF keeps both instead of averaging them away.

The eval doc tracks the failures too — score drift under corpus growth, the BM25 field-weight bug the eval caught, the two cases where fusion still loses to pure lexical search, and what the golden set does not cover. Numbers you can't audit are marketing; read how these are produced.

Architecture

mermaid
flowchart LR    C["MCP client<br/>Claude Code · Cursor · …"] -- "stdio / HTTP" --> T["10 tools · 4 resources · 3 prompts"]    T --> R["retrieval pipeline<br/>FTS5 · vector · RRF fusion"]    T --> M["memories + supersede chains"]    I["KB import pipeline<br/>markdown → memories"] --> M    M -- triggers --> F["FTS5 index (stemmed EN+RU)"]    R --> F    R --> V["sqlite-vec (optional, BYOK)"]

One SQLite file holds memories, the FTS5 index, and the optional vector index. Writes go through transactions that keep the supersede-chain invariant; reads run the staged retrieval pipeline described under Search.

The full picture — module boundaries, write/read paths, invariants, and known limitations — is in docs/ARCHITECTURE.md. Design decisions are recorded as ADRs: SQLite+FTS5 core, hybrid RRF retrieval, synchronous driver, layered memory model.

Quick Start

Install

bash
npm install -g mnemon-mcp

Or from source:

bash
git clone https://github.com/nikitacometa/mnemon-memory-mcp.gitcd mnemon-memory-mcp && npm install && npm run build

Configure Your MCP Client

OpenClaw
bash
openclaw mcp register mnemon-mcp --command="mnemon-mcp"

Or add to ~/.openclaw/mcp_config.json:

json
{  "mnemon-mcp": {    "command": "mnemon-mcp"  }}
Claude Code

Add to ~/.claude/mcp.json:

json
{  "mcpServers": {    "mnemon-mcp": {      "command": "mnemon-mcp"    }  }}
Cursor / Windsurf / Other MCP clients

Add to your client's MCP config:

json
{  "mcpServers": {    "mnemon-mcp": {      "command": "mnemon-mcp"    }  }}
Running from source?

Use the full path to the compiled entry point:

json
{  "mnemon-mcp": {    "command": "node",    "args": ["/absolute/path/to/mnemon-mcp/dist/index.js"]  }}

Verify

bash
echo '{"jsonrpc":"2.0","method":"tools/list","id":1}' | mnemon-mcp

You should see 10 tools in the response. The database (~/.mnemon-mcp/memory.db) is created automatically on first run.

That's it. Your agent now has persistent memory.

What It Can Do

10 MCP Tools

ToolWhat it does
memory_addStore a memory with layer, entity, confidence, importance, and optional TTL
memory_searchFull-text or exact search with filters by layer, entity, date, scope, confidence
memory_updateUpdate in-place or create a versioned replacement (superseding chain)
memory_deleteDelete a memory; re-activates its predecessor if any
memory_inspectGet layer statistics or trace a single memory's version history
memory_exportExport to JSON, Markdown, or Claude-md format with filters
memory_healthRun diagnostics: expired entries, orphaned chains, stale memories; optionally GC
memory_session_startStart an agent session — returns session ID for grouping memories
memory_session_endEnd a session with optional summary; returns duration and memory count
memory_session_listList sessions with filters by client, project, or active status

MCP Resources & Prompts

Resources — live data your agent can read:

URIReturns
memory://statsAggregate stats per layer
memory://recentMemories created/updated in last 24h
memory://layer/{layer}All active memories in a layer
memory://entity/{name}All active memories about an entity

Prompts — pre-built workflows:

PromptPurpose
recall"Tell me everything you know about X"
context-loadLoad relevant context before starting a task
journalCreate a structured journal entry

Search

Four modes, all supporting layer / entity / scope / date / confidence filters:

FTS mode (default without embeddings) — tokenized full-text search with BM25 ranking. Multi-word queries use AND; if too few results, OR supplements with a score penalty. Progressive AND relaxation tries top-3 most specific terms before falling back to full OR.

Hybrid mode (default when embeddings configured) — combines FTS5 + vector search via Reciprocal Rank Fusion. Detects quoted entities in queries (e.g., 'Essentialism') and runs weighted sub-queries for cross-reference retrieval.

Vector mode — pure cosine similarity search over embeddings.

Exact mode — LIKE substring match for precise phrase lookups.

Scores: bm25 × (0.3 + 0.7 × importance) × decay(layer) × recency

Recency boost: 1 / (1 + daysSince / 365) — gently rewards recently created memories without penalizing old ones.

Stemming

Snowball stemmer applied at both index time and query time for English and Russian. This means "running" matches "runs", and "книги" matches "книга". Stop words are filtered from queries to improve precision.

Fact Versioning

Knowledge evolves. Mnemon doesn't delete old facts — it chains them:

v1: "Team uses React 17"  →  superseded_by: v2v2: "Team uses React 19"  →  supersedes: v1 (active)

Search returns only the latest version. memory_inspect with include_history: true reveals the full chain. memory_delete re-activates the predecessor — nothing is lost.

Vector Search (Optional, BYOK)

Enable semantic similarity search by providing your own embedding API:

bash
# OpenAIMNEMON_EMBEDDING_PROVIDER=openai MNEMON_EMBEDDING_API_KEY=sk-... mnemon-mcp
# Ollama (local, free)MNEMON_EMBEDDING_PROVIDER=ollama mnemon-mcp

This unlocks two additional search modes:

  • mode: "vector" — pure cosine similarity search
  • mode: "hybrid" — FTS5 + vector combined via Reciprocal Rank Fusion

Requires sqlite-vec (installed as optional dependency). New memories are embedded on add; existing ones can be backfilled.

Embedding configuration
VariableDefaultDescription
MNEMON_EMBEDDING_PROVIDER—openai or ollama (unset = disabled)
MNEMON_EMBEDDING_API_KEY—API key (required for OpenAI)
MNEMON_EMBEDDING_MODELtext-embedding-3-small / nomic-embed-textModel name
MNEMON_EMBEDDING_DIMENSIONS1024 / 768Vector dimensions
MNEMON_OLLAMA_URLhttp://localhost:11434Ollama endpoint

Importing a Knowledge Base

Got a folder of Markdown files? Import them in bulk:

bash
cp config.example.json ~/.mnemon-mcp/config.json   # edit this firstnpm run import:kb -- --kb-path /path/to/your/kb     # incremental (skips unchanged files)

The config maps glob patterns to memory layers:

json
{  "owner_name": "your-name",  "extra_stop_words": [],  "mappings": [    {      "glob": "journal/*.md",      "layer": "episodic",      "entity_type": "user",      "entity_name": "$owner",      "importance": 0.6,      "split": "h2"    },    {      "glob": "people/*.md",      "layer": "semantic",      "entity_type": "person",      "entity_name": "from-heading",      "importance": 0.8,      "split": "h3"    }  ]}

Config Fields

FieldTypeDescription
owner_namestringYour name — used for $owner substitution in entity_name
extra_stop_wordsstring[]Words to filter from FTS queries (e.g., your name forms)
globstringFile pattern to match
layerstringTarget memory layer
entity_typestringuser / person / project / concept / file / rule / tool
entity_namestringLiteral name, "$owner", or "from-heading" (extract from H2/H3)
splitstring"whole" (one memory per file), "h2", or "h3" (split on headings)
importancenumber0.0–1.0, affects search ranking
confidencenumber0.0–1.0, filterable in search
scopestringOptional namespace

HTTP Transport

For remote or multi-client setups:

bash
MNEMON_AUTH_TOKEN=your-secret MNEMON_HOST=0.0.0.0 MNEMON_PORT=3000 npm run start:http
EndpointDescription
POST /mcpMCP JSON-RPC (Bearer auth if token set)
GET /health{"status":"ok","version":"..."}

Binds to 127.0.0.1 by default. Binding to any other host requires MNEMON_AUTH_TOKEN — the server refuses to expose the memory store to the network unauthenticated (override with MNEMON_ALLOW_INSECURE_HTTP=1 on a trusted network). Rate limiting (100 req/min/IP by default), opt-in CORS, 1MB body limit, timing-safe auth, graceful shutdown on SIGTERM.

Configuration Reference

VariableDefaultDescription
MNEMON_DB_PATH~/.mnemon-mcp/memory.dbDatabase path
MNEMON_KB_PATH.Knowledge base root for import
MNEMON_CONFIG_PATH~/.mnemon-mcp/config.jsonImport config path
MNEMON_AUTH_TOKEN—Bearer token for HTTP transport
MNEMON_HOST127.0.0.1HTTP transport bind address
MNEMON_PORT3000HTTP transport port
MNEMON_CORS_ORIGIN—CORS Access-Control-Allow-Origin (no CORS headers unless set)
MNEMON_RATE_LIMIT100Max requests per minute per IP (0 = off)

Tool Reference

memory_add — full parameter list
ParameterTypeRequiredDescription
contentstringYesMemory text (max 100K chars)
layerstringYesepisodic / semantic / procedural / resource
titlestringNoShort title (max 500 chars)
entity_typestringNouser / project / person / concept / file / rule / tool
entity_namestringNoEntity name for filtering
confidencenumberNo0.0–1.0 (default 0.8)
importancenumberNo0.0–1.0 (default 0.5)
scopestringNoNamespace (default global)
source_filestringNoSource file path — triggers auto-supersede of matching entries
ttl_daysnumberNoAuto-expire after N days
valid_from / valid_untilstringNoTemporal fact window (ISO 8601)
memory_search — full parameter list
ParameterTypeRequiredDescription
querystringYesSearch text
modestringNofts (default), exact, vector, hybrid
layersstring[]NoFilter by layers
entity_namestringNoFilter by entity (supports aliases)
scopestringNoFilter by scope
date_from / date_tostringNoDate range (ISO 8601)
as_ofstringNoTemporal fact filter — facts valid at this date
min_confidencenumberNoMinimum confidence
min_importancenumberNoMinimum importance
limitnumberNoMax results (default 10, max 100)
offsetnumberNoPagination offset
memory_update — full parameter list
ParameterTypeRequiredDescription
idstringYesMemory ID
contentstringNoNew content
titlestringNoNew title
confidencenumberNoNew confidence
importancenumberNoNew importance
supersedebooleanNotrue = versioned replacement; false (default) = in-place
new_contentstringNoContent for superseding entry
memory_delete
ParameterTypeRequiredDescription
idstringYesMemory ID. Re-activates predecessor if part of a superseding chain
memory_inspect
ParameterTypeRequiredDescription
idstringNoMemory ID (omit for aggregate stats)
layerstringNoFilter stats by layer
entity_namestringNoFilter stats by entity
include_historybooleanNoShow superseding chain
memory_export
ParameterTypeRequiredDescription
formatstringYesjson / markdown / claude-md
layersstring[]NoFilter by layers
scopestringNoFilter by scope
date_from / date_tostringNoDate range
limitnumberNoMax entries (default all, max 10K)
memory_health
ParameterTypeRequiredDescription
cleanupbooleanNotrue = garbage-collect expired entries (default: report only)

Returns: status (healthy / warning / degraded), per-layer stats, expired entries, orphaned chains, stale/low-confidence counts, cleaned count when cleanup=true.

memory_session_start
ParameterTypeRequiredDescription
clientstringYesClient identifier (e.g. claude-code, cursor, api)
projectstringNoProject scope for this session
metaobjectNoAdditional session metadata

Returns: id (session UUID), started_at (ISO 8601).

memory_session_end
ParameterTypeRequiredDescription
idstringYesSession ID to end
summarystringNoSummary of what was accomplished (max 10K chars)

Returns: id, ended_at, duration_minutes, memories_count.

memory_session_list
ParameterTypeRequiredDescription
limitnumberNoMax sessions (default 20, max 100)
clientstringNoFilter by client
projectstringNoFilter by project
active_onlybooleanNoOnly return sessions that haven't ended (default false)

Returns: array of sessions with id, client, project, started_at, ended_at, summary, memories_count.

How It Compares

mnemon-mcpmem0basic-memoryEngramAnthropic KG
ArchitectureSQLite FTS5 + vectorCloud API + QdrantMarkdown + vectorSQLite FTS5JSON file
Memory structure4 typed layersFlatFlatFlat + sessionsGraph
SearchFTS5 + hybrid RRFSemanticHybridFTS5Exact
Fact versioningSuperseding chainsPartialNoNoNo
StemmingEN + RU (Snowball)EN onlyEN onlyNoneNone
EmbeddingsBYOK (OpenAI / Ollama)Built-inFastEmbedNoneNone
Dependencies0 requiredQdrant, Neo4jPython 3.12Go binaryNone
Cloud requiredNoYesNoNoNo
CostFree$19–249/moFreeFreeFree
Setupnpm install -gDocker + API keyspip + depsGo installBuilt-in
LicenseMITApache 2.0AGPLMITMIT

Extended competitive analysis with sources: docs/COMPETITORS.md.

Development

bash
npm run dev        # run via tsx (no build step)npm run build      # TypeScript → dist/npm run lint       # eslint (flat config)npm test           # vitest — unit + integration + MCP dispatch + HTTP transport + hybrid RRFnpm run bench      # performance benchmarksnpm run db:backup  # backup database

CI runs build + lint + tests on Node 20 and 22, then smoke-tests the compiled server over real JSON-RPC (tools/list must match the exact tool set).

Stack: TypeScript 5.9 (strict mode), better-sqlite3, @modelcontextprotocol/sdk, Snowball stemmer, Zod, vitest.

See CONTRIBUTING.md for code guidelines.

Design Principles

  • Air-gapped by default — zero telemetry, ever. Out of the box nothing leaves the machine; the only component that talks to the network is the optional embedder, and only to the provider you configure (including a local Ollama).
  • Single file — one SQLite database, zero ops, instant backup via file copy.
  • Deterministic search — FTS5, not embeddings, is the default. Interpretable, reproducible, no GPU needed.
  • Structured over flat — layers encode access patterns; superseding chains encode time.
  • Minimal — 4 production dependencies. Works everywhere Node runs.
  • Measured, not asserted — retrieval changes are judged against a golden set, regressions included.

License

MIT

來源:README.md,提交 4e1a320

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.0.1最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分