Back to Browse

Memoria MCP Server

Developer ToolsLow Risk10.0MCP RegistryLocal
Free

Server data from the Official MCP Registry

Persistent, plain-text memory for Claude — as a Markdown repo you own.

About

Persistent, plain-text memory for Claude — as a Markdown repo you own.

Security Report

10.0
Low Risk10.0Low Risk

Valid MCP server (2 strong, 2 medium validity signals). No known CVEs in dependencies. Package registry verified. Imported from the Official MCP Registry.

4 files analyzed · 1 issue found

Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.

Permissions Required

This plugin requests these system permissions. Most are normal for its category.

file_system

Check that this permission is expected for this type of plugin.

env_vars

Check that this permission is expected for this type of plugin.

database

Check that this permission is expected for this type of plugin.

What You'll Need

Set these up before or after installing:

Root directory of the memory store. Defaults to ~/.memoria locally (or /data/memoria in Docker).Optional

Environment variable: MEMORIA_DIR

Embedding provider: auto (local MiniLM if installed, else hash; never remote), openai (explicit opt-in: sends content to OpenAI), minilm or hash.Optional

Environment variable: MEMORIA_EMBEDDINGS

Bearer token authenticating /mcp, /ingest and /dashboard/api. Required for the HTTP transport.Required

Environment variable: MEMORIA_API_KEY

OAuth 2.1 client secret for remote clients (claude.ai). Required when BIND_ALL=true; keep it distinct from the API key.Required

Environment variable: MEMORIA_OAUTH_CLIENT_SECRET

AES-256-GCM master key (64 hex chars) for the collector's encrypted buffer and credential store. Required when BIND_ALL=true.Required

Environment variable: MEMORIA_ENCRYPTION_KEY

External URL of this server. Pins the OAuth discovery metadata so it is never derived from the Host header. Required when exposed.Optional

Environment variable: MEMORIA_PUBLIC_URL

How to Install

Add this to your MCP configuration file:

{
  "mcpServers": {
    "memoria-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@agrippa87/memoria-mcp@0.3.3"
      ],
      "env": {
        "MEMORIA_DIR": "your-memoria-dir-here",
        "MEMORIA_API_KEY": "your-memoria-api-key-here",
        "MEMORIA_EMBEDDINGS": "your-memoria-embeddings-here",
        "MEMORIA_PUBLIC_URL": "your-memoria-public-url-here",
        "MEMORIA_ENCRYPTION_KEY": "your-memoria-encryption-key-here",
        "MEMORIA_OAUTH_CLIENT_SECRET": "your-memoria-oauth-client-secret-here"
      }
    }
  }
}

Some servers take additional arguments. See the repository for details.

Documentation

View on GitHub

From the project's GitHub README.

Memoria

Persistent, plain-text memory for Claude — as a Markdown repo you own.

memoria website · 30-second demo · install · live demo dashboard (key: memoria-demo)

Memoria is an MCP server that gives Claude Code, claude.ai (Chat / CoWork) and any other MCP client a shared long-term memory. Memories are Markdown files with YAML frontmatter in a directory you control; a derived SQLite + FTS5 index provides hybrid semantic + keyword search; a set of agentic tools (reflect, lint, compact, compile) keeps the store healthy; and an optional collector daemon feeds in events from your own tools. It runs as a stdio server for Claude Code and as an OAuth 2.1 HTTP server for remote clients.

A 30-second demo: Claude records a decision, the memory is shown as a Markdown file, a session on a second machine finds it after a git pull, and the dashboard shows it in the wiki

A scripted illustration; the Memoria output in it is real, from the demo data. With narration: 30 seconds · the full 84 seconds, which adds sync between devices and the dashboard.

Status: early public release. The server has run as the maintainer's daily driver since spring 2026 (hosted on Cloud Run, two adversarial security reviews and a full code review, a test suite CI runs on Ubuntu and Windows). It installs as a Claude Code plugin or from npm as @agrippa87/memoria-mcp — see Roadmap. The sub-memory collector (iMessage / IMAP / Google ingestion) ships but should be treated as experimental; read SECURITY.md before enabling sources.

Why Memoria instead of another memory layer?

  • You own the data. Plain Markdown in a folder — grep it, edit it, commit it, diff it. The SQLite index is derived and fully rebuildable. No hosted database, no proprietary format, no lock-in.
  • Multi-device without a service. Keep the store in a private git repo; daily logs are append-only and merge with git's union driver, so two machines writing the same day never clobber each other (Multi-device sync).
  • Agentic self-maintenance. Write-time dedup, reflection, contradiction lint, decay/promotion, and a deterministic "compile, don't retrieve" loop that rolls the daily firehose into linked entity pages.
  • Spec-complete remote transport. OAuth 2.1 with PKCE, client credentials, dynamic client registration and metadata discovery — works as a claude.ai custom connector out of the box.
  • Honest about search. Three embedding providers (local MiniLM → n-gram fallback, plus OpenAI as an explicit opt-in), three-signal scoring, and every result reports its scan coverage.

Upgrading from an earlier version? See Recent updates and the CHANGELOG.

Architecture

 Claude Code          Claude Chat          CoWork
 (CLI)                (claude.ai)          (claude.ai)
      |                    |                    |
 Direct file           MCP Server          MCP Server
 read/write           (HTTP/OAuth)        (HTTP/OAuth)
      |                    |                    |
      +-------- $MEMORIA_DIR/memories/ ---------+
                   (canonical store)
                         |
              +----------+----------+
              |                     |
        SQLite + FTS5         Sub-Memory
      (search index)          Collector
                              (daemon)
                                 |
                   +------+------+------+
                   |      |      |      |
                iMessage Email Calendar Custom
                   |      |      |      |
                   +------+------+------+
                         |
                 Encrypted Ring Buffer
                         |
                 Ingestion Pipeline
                 (re-score, dedup,
                  rate-limit, fuse)

Key principle: Markdown files are the source of truth. The SQLite index is derived and fully rebuildable from the files.

Features

  • 17 MCP tools for memory management, data collection, lint, knowledge compilation, entity-page compilation, and digest compaction
  • Sub-memory collector with source adapters for iMessage, macOS Calendar, Email (IMAP), Gmail, Google Calendar, Google Drive, and user-defined custom sources
  • Three-signal retrieval: score = 0.8 x relevance + 0.1 x recency + 0.1 x importance — relevance decides, recency and importance break ties (eval)
  • Hybrid search: Vector cosine similarity (0.7) + FTS5 BM25 keyword scoring (0.3). Three embedding providers: local all-MiniLM-L6-v2 via @huggingface/transformers by default (true semantic, fully offline after a one-time ~23MB download), n-gram hashing as the lexical fallback, and OpenAI text-embedding-3-small only when explicitly selected with MEMORIA_EMBEDDINGS=openai (an OPENAI_API_KEY alone never sends content off the device).
  • Cross-source temporal fusion: Detects correlated activities across sources within configurable time windows
  • Write-time dedup: Checks top-3 similar memories before every write, returns duplicates for agent review
  • Encrypted at rest: All collector data encrypted with AES-256-GCM; master key auto-generated, owner-only (0600)
  • User agreement flow: Sources cannot be enabled without explicit user consent
  • Auto-dependency installation: A source's npm packages are installed when it is enabled — into the data directory, never the memory store, with install scripts disabled
  • Content hashing: Skips re-embedding unchanged files during reindex (SHA-256)
  • Importance scoring (1-10) with idempotent decay/boost and health monitoring
  • FTS5 full-text search with automatic sync triggers
  • Bi-temporal metadata: valid_from / valid_until for temporal reasoning
  • Memory linking: Zettelkasten-style related field for graph-like traversal
  • Agentic behaviors: Reflection, consolidation, self-assessment, promotion/demotion
  • OAuth 2.1 authentication: Full MCP-spec auth with authorization_code + PKCE, client_credentials, dynamic client registration, and metadata discovery
  • Security hardening: Rate limiting, body size limits, session caps, path traversal protection, timing-safe comparisons
  • Dual transport: stdio (Claude Code) + Streamable HTTP / SSE (claude.ai and other remote MCP clients)
  • Docker-first deployment: multi-stage image, non-root user, persistent volume; a reference Cloud Run + GCS FUSE template under deploy/gcp/
  • Spec-compliant YAML parser: Uses js-yaml for frontmatter (handles quoted colons, multi-line strings, special chars in tags) — gracefully degrades on malformed YAML
  • Bounded lint operations: Contradiction scan capped at top 30 memories by importance, batched 5-in-parallel to control embedding API cost
  • Buffer capacity reporting: /ingest returns bufferDropped count and bufferUsage so callers know when events are dropped at capacity, and failed for events that could not be written this time (kept for retry)
  • Test suite: covers atomic writes and key-file creation, non-ASCII keyword search, dashboard escaping and CSP, chunker, embeddings, store, optimizer, ingestion, path resolution (incl. symlink-leaf containment), file_watcher allowlisting, privacy-tier classification + sink-side redaction, AES-256-GCM crypto (round-trip/tamper/strict-key), YAML edge cases, access tracking, plus an HTTP integration suite (supertest over the real Express app: the /dashboard/api Bearer auth-gate, the full OAuth authorization_code+PKCE flow end-to-end, client-credential + API-key-decoupling checks, redirect allowlisting) and wiki rendering (code-safe [[wikilink]] resolution, stored-XSS escaping, link-label safety). CI fails on coverage regression via per-file floors, and checks the built Docker image as its runtime user.
  • File watcher: Auto-reindex on change with 1.5s debounce, plus a periodic reindex sweep (default 5 min) as a fallback for mounts where fs.watch is inert (e.g. GCS FUSE on Cloud Run)

Quick Start

Prerequisites

  • Node.js 20+ (better-sqlite3 requires it; CI tests on 22, the Docker image runs 26)
  • npm
  • (Optional) an OpenAI API key for the highest-quality embeddings. Without one, a local all-MiniLM-L6-v2 model provides semantic embeddings fully offline (one-time ~23 MB download).

Option A: install the Claude Code plugin (fastest)

In Claude Code:

/plugin marketplace add Agripp87/memoria_mcp
/plugin install memoria@memoria

That registers the MCP server and — if your store is a git repo — wires up the SessionStart/Stop sync hooks. The first launch installs dependencies and builds from source, which takes a minute; after that it starts immediately.

Nothing else is required: the store defaults to ~/.memoria and is created on the first write. Skip to Tell Claude how to use it — or read on for a manual install.

Option B: build from source

git clone https://github.com/Agripp87/memoria_mcp.git
cd memoria_mcp/mcp-server
npm install
npm run build

From npm (Node 20+):

npm install -g @agrippa87/memoria-mcp
claude mcp add memoria -s user -- memoria-mcp
# or, without a global install:
claude mcp add memoria -s user -- npx -y @agrippa87/memoria-mcp

Try it on fake data (30 seconds)

From a source checkout (Option B):

cd memoria_mcp/mcp-server
npm install        # skip if you already ran it
npm run demo
# → generates a throwaway ./demo-store with ~29 cross-linked memories
# → open http://127.0.0.1:3110/dashboard   (key: demo-key-123)

Register with Claude Code (manual install)

Other MCP clients use the same stdio command and MEMORIA_DIR env var. Cursor, Codex CLI and Gemini CLI have tested setups in docs/clients.md, which also lists what differs outside Claude Code.

claude mcp add memoria -s user -- node /absolute/path/to/memoria_mcp/mcp-server/scripts/mcp-start.mjs

or add to ~/.claude.json / your project's .claude/settings.local.json:

{
  "mcpServers": {
    "memoria": {
      "command": "node",
      "args": ["/absolute/path/to/memoria_mcp/mcp-server/scripts/mcp-start.mjs"],
      "env": { "MEMORIA_DIR": "/path/to/your/memory-store" }
    }
  }
}

The store defaults to ~/.memoria (MEMORIA_DIR overrides it). The first memory_write creates the directory layout. Embeddings stay local by default: OPENAI_API_KEY on its own does not switch providers; OpenAI embeddings also need MEMORIA_EMBEDDINGS=openai in env.

Why scripts/mcp-start.mjs and not dist/index.js: the wrapper runs tsc before serving (compiler output redirected to stderr — stdout is the JSON-RPC transport), so the server you talk to is always built from the checked-out source. If the build fails, it falls back to the previous dist/ with a loud stderr warning rather than starting nothing.

Tell Claude how to use it

Memoria works best with a short standing instruction in your CLAUDE.md — e.g. "At session start, memory_search for context relevant to the task. Record decisions, solved bugs and preferences with memory_daily during the session, memory_write for durable facts. Do not capture transactional work." From 0.3.3 the server also sends a short note of its own on connect (when to search, what is worth recording), which Claude Code, Codex CLI and Gemini CLI pass to the model; it suggests and does not require.

Remote access (claude.ai, other devices) with Docker

cp .env.example .env
# fill in MEMORIA_API_KEY, MEMORIA_OAUTH_CLIENT_SECRET, MEMORIA_ENCRYPTION_KEY
# (generation one-liners are in the file) and MEMORIA_PUBLIC_URL
docker compose up -d
curl http://localhost:3100/health

The compose file publishes the port on loopback only and mounts a named volume at /data for the store. Put it behind your usual TLS ingress (Caddy, Cloudflare Tunnel, ngrok, a reverse proxy) and set MEMORIA_PUBLIC_URL to the external URL.

Then in claude.ai → Settings → Connectors → Add custom connector:

  • URL: https://<your-host>/mcp
  • Advanced → OAuth Client ID: memoria
  • Advanced → OAuth Client Secret: your MEMORIA_OAUTH_CLIENT_SECRET

For a durable cloud deployment see deploy/gcp/README.md (Cloud Run + GCS FUSE + Secret Manager, with CI/CD and auto-rollback). The server itself only needs a directory at MEMORIA_DIR, so any host with a persistent volume works.

Environment Variables

VariableDefaultDescription
MEMORIA_API_KEY(required for HTTP)Bearer token for HTTP transport authentication (/mcp, /ingest, /dashboard/api). Distinct from the OAuth client secret below.
OPENAI_API_KEY(none)API key for OpenAI embeddings. On its own it does not enable remote embeddings (see MEMORIA_EMBEDDINGS); when remote embeddings are enabled, memory content and search queries are sent to OpenAI.
MEMORIA_EMBEDDINGSautoEmbedding provider: auto (local MiniLM if installed, else hash — never remote), openai (explicit opt-in: sends content to OpenAI), minilm (local all-MiniLM-L6-v2, 384-dim, true semantic), or hash (n-gram lexical fallback, 384-dim).
MEMORIA_TRUST_PROXY1Proxy hops in front of the HTTP server, used to find the client IP for rate limiting. 1 suits Cloud Run or one reverse proxy; set 0 when clients reach the server directly (a LAN or VPS deployment), or a client's own X-Forwarded-For picks its rate-limit bucket.
MEMORIA_LOCK_TAKEOVERfalseWhen true, a server takes over a store lock held by a live server on another host instead of waiting for it to stop, then waits one heartbeat (about 17 s) before opening the store. The displaced server notices, stops collecting and writing, and answers 503 until the platform stops it. Only for deployments that overlap instances on one shared store by design, such as a Cloud Run rollout (set in deploy/gcp/cloudbuild.yaml). Upgrading from 0.2.x, whose servers take no lock, drain the old revision first.
MEMORIA_AUTHORIZE_REQUIRE_APPROVALfalseWhen true, /authorize additionally requires the operator: the API key, or a dashboard login in the same browser followed by a click on a consent page. The client_credentials grant is disabled. A leaked OAuth client secret alone cannot obtain a token.
MEMORIA_MODEL_CACHE(package default)Directory for the cached MiniLM model. The Docker image pre-bakes it at /app/mcp-server/.models; the build fails if the download does, unless you pass --build-arg PREFETCH_MODEL=false (for OpenAI or hash embeddings, or offline builds).
MEMORIA_MODEL_OFFLINEfalseSet to true to forbid model downloads (use only the cached/pre-baked model).
MEMORIA_OAUTH_CLIENT_SECRET(required when BIND_ALL=true)OAuth client secret. Keep it distinct from the API key so rotating one doesn't rotate the other. Locally (loopback) it falls back to the API key with a warning.
MEMORIA_ENCRYPTION_KEY(required when BIND_ALL=true)AES-256-GCM master key (64 hex chars) for the collector's encrypted buffer and credential store. Locally, an on-disk key is auto-generated at data/collector.key unless MEMORIA_REQUIRE_ENCRYPTION_KEY=true. Rotating it makes existing ciphertext unreadable.
MEMORIA_REQUIRE_ENCRYPTION_KEYfalseRefuse to start without MEMORIA_ENCRYPTION_KEY (fail-closed; no on-disk key fallback).
MEMORIA_OAUTH_CLIENT_IDmemoriaOAuth client id the token endpoint expects (and /register hands out).
MEMORIA_ALLOWED_REDIRECT_HOSTSclaude.ai,claude.com,anthropic.com,localhost,127.0.0.1Comma-separated hostnames permitted as OAuth redirect_uri targets (subdomains allowed). Must be https; plain http is accepted only for localhost / 127.0.0.1.
MEMORIA_TOKEN_DB_DIRthe data directoryWhere the OAuth token database (tokens.sqlite) lives. Set it to container-local disk when the data directory is a FUSE or network mount, where SQLite locking is unreliable — the Docker image sets /tmp/memoria. Tokens are stored hashed and live 24h, so an ephemeral location only costs a re-auth after restart.
MEMORIA_ALLOW_SHELL_SOURCESfalseSet to true (trusted local instances only) to permit shell_command custom sources, which execute arbitrary commands. Disabled by default.
MEMORIA_FILE_WATCHER_ROOTS(none — watchers disabled)Comma-separated directories that file_watcher collector sources may watch. Unset or empty refuses every watcher; a path inside the collector data directory (key and credentials) is refused regardless.
MEMORIA_REINDEX_INTERVAL_MS300000Interval for the periodic reindex sweep (fallback for inert fs.watch).
MEMORIA_AUTO_OPTIMIZEfalseSet to true to run the idempotent decay/promote/staleness passes on a timer (genuinely autonomous self-management), instead of only when an agent calls memory_optimize.
MEMORIA_OPTIMIZE_INTERVAL_MS86400000Interval for the auto-optimize pass (default 24h; only used when MEMORIA_AUTO_OPTIMIZE=true). Counted across restarts: the time of the last pass is kept in the store, so a pass that is due runs at startup.
MEMORIA_AUTO_COMPILEfalseSet to true to autonomously roll the daily-log firehose up into linked entity pages on a timer (the "compile, don't retrieve" loop), instead of only when an agent calls memory_entities. Drains the ingest-driven compile queue so only sources touched since the last run are rebuilt.
MEMORIA_COMPILE_INTERVAL_MS86400000Interval for the auto-compile pass (default 24h; only used when MEMORIA_AUTO_COMPILE=true). Counted across restarts, like the optimize interval. Interval settings that are not a whole number of milliseconds of at least 10 s (1 s for the reindex sweep) are ignored with a warning.
MEMORIA_RAW_ARCHIVEtrueDurable, immutable provenance archive of every ingested event under data/raw/<source>/<YYYY-MM>.jsonl (privacy-aware: local-only stores a hash only). Batched (one append per source per ingest cycle) and rotated (5MB parts), so it is safe on object-storage FUSE mounts. Set to false to disable.
MEMORIA_RAW_ARCHIVE_BATCH / MEMORIA_RAW_ARCHIVE_FLUSH_MS / MEMORIA_RAW_ARCHIVE_ROTATE_BYTES20 / 60000 / 5242880Raw-archive batching knobs: flush after N buffered records or T ms (also flushed every ingest cycle and on shutdown); rotate to a new -pN.jsonl part past the byte cap.
MEMORIA_INGEST_MAX_ATTEMPTS3Failed ingest attempts before a poison event is dead-lettered (metadata-only record in data/.dead-letter.jsonl; content never written).
MEMORIA_BACKPRESSURE_THRESHOLD0.8Fraction of buffer capacity at which source polling pauses so ingestion can drain the unsynced backlog instead of the buffer evicting unsynced (personal) events.
MEMORIA_PUBLIC_URL(none)Pins the OAuth issuer/endpoint metadata base URL. Without it, the base URL is derived from request headers (Host/X-Forwarded-Host), which reflects attacker-supplied hosts into the discovery document. Set this in any network-exposed deployment.
MEMORIA_INSECURE_ALLOW_FALLBACKSfalseEscape hatch. With BIND_ALL=true the server refuses to start unless MEMORIA_OAUTH_CLIENT_SECRET, MEMORIA_ENCRYPTION_KEY and MEMORIA_PUBLIC_URL are all set, rather than falling back to the API key, an on-disk key, or a base URL taken from request headers. Self-hosted setups that accept those risks can set this to true.
MEMORIA_VECTOR_SCAN_CAP5000Max chunks scanned per query for semantic candidate selection. A daily log is one chunk per entry, so a store with many short entries reaches this sooner; raising it costs search time roughly in proportion (about 65 ms per 5,000 chunks on a development machine).
MEMORIA_DIRAuto-detectedThe root Memoria directory. Defaults to /data/memoria when DOCKER=true (the image sets it), otherwise ~/.memoria.
MEMORIA_REPO_URLhttps://github.com/Agripp87/memoria_mcpLink shown in the dashboard's About card (forks: point it at your repo/docs).
PORT3100HTTP server port
BIND_ALLfalseSet to true to bind to 0.0.0.0 instead of 127.0.0.1 (required for Docker/Cloud Run)
DOCKERfalseDocker defaults: MEMORIA_DIR becomes /data/memoria, and auto-generating an on-disk encryption key logs a warning. The image sets it.

MCP Tools

Core Memory Tools (13)

ToolDescription
memory_searchSemantic + keyword hybrid search with three-signal scoring
memory_readRead a specific memory file (returns empty if missing, not error)
memory_writeCreate/update memory with dedup check (top-3 similar). Use force: true to skip.
memory_listList all memories, filter by type or tag
memory_indexRebuild vector + FTS5 search index and MEMORY_INDEX.md catalog
memory_dailyAppend an entry (up to 50,000 characters) to today's daily log, under a ## HH:MM UTC — note heading. Daily logs are UTC days, and entry times in them are UTC.
memory_optimizeRun decay, promote, detect_stale, or find_duplicates
memory_reflectRead recent daily logs for agent reflection/synthesis, newest first, up to max_chars (default 50,000)
memory_statsHealth metrics: importance distribution, stale count, access patterns, warnings
memory_lintProactive health checks: contradiction scan, orphan detection, stale cross-refs, missing descriptions, gap analysis, index drift (rule VII), entity-alias collisions and low-confidence claims (rule VIII), unknown directories (files outside the documented layout — how the store once silently split into reference/ + references/)
memory_compileCompile analysis results into structured core memories with auto-generated frontmatter and index update
memory_compactRead recent daily logs, deduplicate by source+content, surface high-importance events. Output is designed to be summarized into a reflection memory via memory_compile.
memory_entitiesCompile the daily-log firehose into durable, linked per-source entity pages under entities/ — the "compile, don't retrieve" loop (Karpathy rule IV). Deterministic (no LLM), idempotent, and never overwrites a page a human has taken over. Runs on demand, or autonomously via MEMORIA_AUTO_COMPILE=true.

Sub-Memory Collector Tools (4)

ToolDescription
memory_sourcesList, enable, disable, add custom, remove, or configure data sources. Consent is granted only in the dashboard, and through MCP only a source's schedule can be changed.
memory_ingestManually trigger ingestion of buffered events into core memory
memory_fuseRun cross-source temporal fusion to detect correlated activities
memory_priorityView collector status, adjust importance thresholds, flush buffer

Sub-Memory Collector

The collector is an autonomous sub-agent that gathers data from personal tools and feeds it into core memory through an encrypted pipeline.

Built-in Sources

SourceIDPlatformDescription
iMessageimessagemacOSReads ~/Library/Messages/chat.db. Requires Full Disk Access.
CalendarcalendarmacOSReads ~/Library/Calendars/Calendar Cache. Configurable look-ahead/behind.
Email (IMAP)emailAllConnects to any IMAP server (Gmail, Outlook, iCloud). Auto-installs imapflow.
Gmailgoogle-gmailAllGoogle Gmail via API. Label filtering, importance markers, history-based incremental sync.
Google Calendargoogle-calendarAllGoogle Calendar via API. Multi-calendar, attendees, meeting links, syncToken incremental sync.
Google Drivegoogle-driveAllMonitors selected Drive folders. Extracts text from Docs, Sheets, plain text files.

Google Account Setup

The three Google adapters share a single set of OAuth 2.0 credentials:

1. Create Google Cloud credentials:

# Go to https://console.cloud.google.com
# 1. Create a new project (or use existing)
# 2. Enable these APIs:
#    - Gmail API
#    - Google Calendar API
#    - Google Drive API
# 3. Go to Credentials > Create Credentials > OAuth client ID
#    - Application type: Desktop app
#    - Download the JSON file

2. Get a refresh token:

# Use the OAuth playground or run this one-time script:
# https://developers.google.com/oauthplayground/
#
# Select scopes:
#   - Gmail: https://www.googleapis.com/auth/gmail.readonly
#   - Calendar: https://www.googleapis.com/auth/calendar.readonly
#   - Drive: https://www.googleapis.com/auth/drive.readonly
#
# Exchange authorization code for tokens
# Copy the refresh_token

3. Enable the adapters:

In the Memoria dashboard (Sources tab), click Enable on google-gmail, agree, and paste the client ID, client secret and refresh token into the form that opens. Credentials, hosts and what a source reads can only be set there (or with the API key against /dashboard/api); an MCP client may only change a source's schedule:

memory_sources action="configure" source="google-gmail" config={ "pollIntervalSec": 600 }

The same credentials work for all three Google adapters. Credentials are stored encrypted (AES-256-GCM). Leaving a credential field blank when you configure a source later keeps the stored value. Gmail skips SPAM, TRASH and the Promotions tab (CATEGORY_PROMOTIONS; the tab names PROMOTIONS, SOCIAL, UPDATES and FORUMS are accepted too) unless you change the exclude list.

4. Google Drive folder selection:

In the same form, list the folder IDs to collect (empty for all) and choose whether document content is included.

To find folder IDs, open the folder in Google Drive — the ID is in the URL after /folders/.

Custom Sources

Users can add their own data sources in three modes:

ModeUse CaseExample
file_watcherMonitor a file/directory for changesFitness app JSON exports, chat logs
shell_commandPeriodically run a command and parse outputCustom scripts, API calls via curl
webhookReceive HTTP POST with event data (not yet implemented — push to the authenticated /ingest endpoint instead)Smart home systems, IFTTT triggers

Custom sources support JSON, CSV, and plain text formats with configurable field mappings.

Collector Pipeline

Source Adapters (poll on interval; PAUSED under backpressure)
        |
   Edge Filtering (importance threshold + privacy tier)
        |
   Encrypted Ring Buffer (SQLite, AES-256-GCM, max 10K events)
        |
   Ingestion Pipeline (per-source-fair batches)
   ├── Re-score importance (boost personal, penalize automated)
   ├── Rate limit (20 events/source/minute — over-budget events are
   │   DEFERRED and retried next cycle, never dropped)
   ├── Content-hash dedup (SHA-256; recorded only after a successful write)
   ├── Consolidation (search existing → ADD/UPDATE/SKIP)
   └── Write to daily logs
        |
   Per-event outcomes → only durably-handled events marked synced;
   errored events retry up to MEMORIA_INGEST_MAX_ATTEMPTS, then are
   dead-lettered (metadata-only) to data/.dead-letter.jsonl
        |
   Temporal Fusion (±30 min window)
   └── Cross-source activity detection → fused activity records

No-silent-loss guarantees (2026-07 hardening): the daemon marks only durably-handled events as synced (written / duplicate / below-threshold); rate-limited events stay buffered and retry when the budget refills; a write failure does not consume the event's dedup slot (retries aren't mistaken for duplicates); always-failing (poison) events stop retrying after MEMORIA_INGEST_MAX_ATTEMPTS and leave a metadata-only dead-letter record; ingestion batches are split fairly across sources so one backlogged source can't starve the rest; and polling pauses at MEMORIA_BACKPRESSURE_THRESHOLD of buffer capacity so the ring buffer never has to evict unsynced personal events while ingestion catches up.

Privacy Tiers

All events are classified into privacy tiers before leaving the device:

TierBehaviorExample
sendTransmit content as-isCalendar event titles
summarizeTruncate/redact before sendingLong email content
local-onlyNever leaves the deviceMessages containing passwords, credit cards, SSNs

Encryption

  • Master key: AES-256-GCM. Sourced from MEMORIA_ENCRYPTION_KEY (recommended — pin from a secret manager), else auto-generated on first run at data/collector.key, created owner-only (0600 on Linux and macOS, with a warning when the filesystem ignores the mode; on Windows it inherits the data folder's permissions). Set MEMORIA_REQUIRE_ENCRYPTION_KEY=true to require the env var and refuse the on-disk fallback.
  • Ring buffer: All event content encrypted before SQLite storage
  • Config: Source configurations (including IMAP credentials) encrypted at data/collector-config.enc
  • Access: Only the Memoria agent and the user have access to decrypted data

Enabling a Source

1. memory_sources action="list"                    # See available sources
2. In the Memoria dashboard (Sources tab), click Enable on "imessage"
   # Consent is dashboard-only by design: an MCP caller cannot grant it.
3. memory_priority action="status"                 # Verify it's collecting

Sources, consent and the collector belong to the server that opened the store first. The dashboard only exists in the HTTP server (memoria-mcp-http), so start it before any Claude Code or Claude Desktop session on the same store; a dashboard that started second shows which process holds the store and takes over within 30 seconds of that process exiting.

Adding a Custom Source

memory_sources action="add_custom" custom_definition={
  "id": "fitbit-sleep",
  "name": "Fitbit Sleep Data",
  "description": "Daily sleep quality from Fitbit JSON export",
  "mode": "file_watcher",
  "watchPath": "/path/to/fitbit-export.json",
  "fileFormat": "json",
  "jsonPath": "sleep.data",
  "fieldMap": {
    "content": "summary",
    "timestamp": "dateOfSleep",
    "id": "logId"
  }
}

HTTP Ingestion (external agents & systems)

Any external system can push events to Memoria's authenticated /ingest endpoint — agent frameworks, cron jobs, webhooks, other assistants. Events flow through the same pipeline as collector sources (re-score, rate-limit, dedup, consolidate, write to the daily log, index).

curl -X POST https://<your-host>/ingest \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "events": [{
      "id": "unique-id",
      "source": "my-agent",
      "content": "Agent completed task X",
      "timestamp": "2026-04-03T15:30:00Z",
      "importance": 6,
      "meta": {"agent_id": "research-agent"}
    }]
  }'

Response: { "accepted": 1, "buffered": 1, "written": 1, "deduplicated": 0, "rateLimited": 0, "failed": 0, "bufferDropped": 0, "bufferUsage": { … } }

Python hook. integrations/orchestrator_hook.py is a dependency-light (httpx or requests) client that buffers events and flushes them every 30 s in the background — originally written for a multi-agent orchestrator, but generic: record_agent_result, record_metric, record_conversation, record_training_eval, record_prompt_change and record_discovery. All calls are best-effort and never wait on the network; a Memoria outage never breaks the caller.

from integrations.orchestrator_hook import MemoriaHook
hook = MemoriaHook(memoria_url="https://<your-host>/ingest", api_key=os.environ["MEMORIA_API_KEY"])
hook.record_agent_result("research-agent", task, result, metrics)
hook.flush()  # on shutdown

Close the loop. Ingestion makes Memoria write-heavy; to make it useful, have your agents call memory_search (or GET /dashboard/api/search with the bearer key) before a run and prepend the top results to their context. That is what turned the maintainer's setup from write-only into a memory that compounds.

Dashboard (Web UI)

Memoria includes a built-in web dashboard for managing memory, data sources, and journaling — no CLI required.

The dashboard's wiki view: the "Postgres over Mongo" decision rendered from Markdown, with its details, related memories, and a backlink from the newer "Job queue on Postgres" decision

All four views show the built-in demo data (npm run demo), after the two-machine sync in the demo video.

Access: http://127.0.0.1:3100/dashboard (or your public URL)

On first visit, the dashboard asks for your MEMORIA_API_KEY once and exchanges it for an httpOnly session cookie; the key itself is not stored in the browser.

Demo mode (fake data)

Showcase the dashboard — including the Wiki — with realistic made-up data, without touching your real memories.

Hosted demo: https://memoria-demo-hpb4luig7q-uc.a.run.app/dashboard (key: memoria-demo). The demo runs as a separate Cloud Run service under a zero-privilege service account (no Secret Manager, no real bucket) on ephemeral data regenerated on every cold start — a demo compromise can't reach the real service's secrets or memories. Deployed via deploy/gcp/deploy-demo.sh.

Locally:

cd mcp-server
npm run demo
# → generates a throwaway ./demo-store and launches the dashboard
# → open http://127.0.0.1:3110/dashboard   (key: demo-key-123)

npm run demo builds (if needed), writes ~29 cross-linked fake memories (an "Alex Rivera" indie-dev persona: profile, projects, decisions, reflections, and 16 collector-style daily logs), and serves them on a local-only port. The demo store is git-ignored and your real MEMORIA_DIR is never touched. Use npm run demo:gen -- --out <dir> to just generate the data. Override the port/key with PORT=… / MEMORIA_API_KEY=….

Security note: the dashboard authenticates via an httpOnly, SameSite=Strict session cookie minted at POST /dashboard/login (Phase 3, 2026-07) — the API key is no longer stored in localStorage, so origin XSS cannot exfiltrate it. All memory/source-derived fields remain HTML-escaped against stored XSS; still treat the dashboard as a trusted-network tool.

Sections

TabWhat it does
OverviewMemory stats (file count, chunks, avg importance, stale), collector status, recent journal entries
Data SourcesList all sources with status badges. Enable/disable with one click. Configure credentials via modal forms. Add custom sources (file watcher, shell command).
JournalWrite daily journal entries with optional mood tracking and tags. Entries are saved to the daily log and indexed for search. View recent entries.
MemoriesBrowse all memory files sorted by importance. Full-text search across all memories.
WikiBrowse the whole memory store as a cross-linked wiki: rendered markdown, an index by category + a daily-log calendar, related links + [[wiki links]] + computed backlinks, and append-only "add note" annotations on any memory (provenance preserved).
SettingsRebuild search index, view buffer stats, links.

Journal

The journal provides a way to manually add context that automated collectors can't capture — thoughts, decisions, reflections, plans. Entries support:

  • Mood tracking: Select from 5 mood states per entry
  • Tags: Comma-separated tags for categorization
  • Full indexing: Journal entries are immediately indexed for semantic search

Journal entries are stored in memories/daily/YYYY-MM-DD.md alongside auto-collected events, creating a unified timeline.

Memory File Format

Every memory file uses Markdown with YAML frontmatter:

---
name: Nightjar project status
description: Overview of the offline-first notes app
type: project
importance: 8
created: 2026-03-27
updated: 2026-03-27
tags: [app, react-native]
related: [user/profile.md]
valid_from: 2026-03-27
valid_until:
---

Content in plain markdown...

Types

user | project | decision | feedback | reference | session | reflection | pattern | source-rollup (auto-compiled per-source pages under entities/; renamed from entity in Phase 5 — they are activity rollups keyed by collector source, not extracted entities)

Importance Scale

Documentation truncated — see the full README on GitHub.

Reviews

No reviews yet

Be the first to review this server!