Dense Mem logo

Dense Mem

Self-hosted MCP memory with PostgreSQL, pgvector, evidence provenance, typed relationships, recall, and lifecycle controls.

Install Dense Mem

Run the project’s own setup commands, in order.

Setup steps from the project

dense-mem installs with its own steps rather than a config we can generate, so these are copied as-is. Follow them in order and run the commands in a terminal. Source: github.com

  1. 1. Configure
    mkdir dense-mem-local
    
  2. 2. Configure
    cd dense-mem-local
    
  3. 3. Configure
    curl -fsSLo docker-compose.yml \
      https://raw.githubusercontent.com/markhuangai/dense-mem/main/examples/docker-compose.base.yml
    
  4. 4. Configure
    curl -fsSLo .env.example \
      https://raw.githubusercontent.com/markhuangai/dense-mem/main/examples/.env.example
    
  5. 5. Configure
    cp .env.example .env
    
  6. 6. Configure
    ${EDITOR:-vi} .env
    

Overview

dense-mem MCP server stores durable AI memory as evidence-backed, typed relationships in PostgreSQL with pgvector. It exposes Streamable HTTP MCP tools for ingesting, recalling, tracing, correcting, retracting, exporting, and evaluating memory. Server policy validates provider output, controls lifecycle and ownership, and limits recall to support-eligible information. Reach for it when an agent needs self-hosted memory with provenance, authorization, conflict handling, and auditable changes.

Use cases

  • Store evidence-backed agent memory
  • Recall supported relationships with provenance
  • Trace decisions back to source evidence
  • Correct or retire owner-controlled memory
  • Evaluate ranked recall results

Key features

  • Streamable HTTP MCP endpoint
  • PostgreSQL and pgvector persistence
  • Append-only evidence provenance
  • Typed relationships with support gating
  • Owner-aware lifecycle controls
  • Embedding-backed recall and search

Tools7

What Dense Mem lets your agent do. Expand a tool for its parameters.

Self-reported~127 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

9/9 checks healthy over the last 33d

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars41Stargazers on the source repository.
Last commit1d agoMost recent push to the default branch.
Tools exposed7Callable tools this server registers over MCP.

How Dense Mem works

What dense-mem does

dense-mem provides self-hosted memory for AI agents through MCP over Streamable HTTP. PostgreSQL is the durable authority for evidence, semantic state, lifecycle, provenance, search, authorization, and audit data. pgvector supports embedding-backed memory operations, while Redis is used for coordination in multi-instance deployments.

The system separates durable evidence from derived semantic state. Entities and typed values can participate in Relationships, but a Relationship becomes active only when its supporting evidence satisfies the server's policy. Lifecycle actions change effective state without removing the original evidence or its lineage.

The host model remains responsible for conversation and judgment. dense-mem handles evidence intake, validation, ownership checks, lifecycle events, support eligibility, and bounded recall. Authentication resolves an actor to a team, identity, membership, owner alias, and optional credential; clients cannot select the semantic owner by sending team or identity fields.

How it works

Agents submit evidence through remember, which is also the intake path used for corpus imports. Server-side closed-schema validation and deterministic policy determine what becomes durable state. Provider output is treated as a proposal rather than an authoritative write.

Recall returns active evidence contexts and graph-shaped Relationship handles. Default recall excludes candidates and hypotheses, and only returns evidence whose active Relationship support path is eligible for the requested time. When enabled functionality produces a follow-up, recall_memory can include suggested_actions.

Evidence remains append-only for provenance. retract_evidence retires caller-owned evidence, while correct_relationship replaces an owner-controlled active Relationship and preserves the original support lineage. trace_memory follows a same-team Relationship through its evidence, decisions, and lineage.

Setup and configuration

A local deployment can use the supplied Docker Compose example with PostgreSQL and pgvector. Copy the environment template, set POSTGRES_PASSWORD, CONTROL_PORTAL_TOKEN, and AI_API_KEY, then start the stack with Docker Compose. The MCP endpoint is exposed at /mcp; the example binds it at http://127.0.0.1:8080/mcp.

The private control portal is used to create a team and issue its first API credential. The user portal provides memory search, graph views, and management pages permitted by the authenticated session. Control-plane automation uses the private control API rather than the public MCP automation endpoint.

A single-node deployment may use process-local coordination. Multiple instances sharing a writable primary require Redis or an equivalent distributed coordination implementation. The server applies pending PostgreSQL migrations before serving and remains unready until migration completes.

Tools and capabilities

  • remember accepts production evidence through the governed intake path.
  • retract_evidence retires evidence owned by the caller without deleting provenance.
  • correct_relationship supersedes an active owner-supported Relationship while retaining lineage.
  • recall_memory returns active evidence contexts and Relationship handles, with optional suggested actions.
  • trace_memory follows a same-team Relationship through evidence and decisions.
  • submit_recall_session_feedback records bounded recall-quality feedback when that feature is enabled.
  • export_memory_pack exports selected active Relationships with support provenance.
  • eval_list_knowledge_refs pages stable, team-scoped knowledge references.
  • eval_run_recall_case runs recall logic and returns ranked references for deterministic scoring.

Limitations and notes

Team visibility does not grant mutation authority: authors can change only their own evidence or owned semantic records. Recall is deliberately support-gated, so unsupported candidates and hypotheses are excluded from the default result set.

Redis is not the durable memory store; PostgreSQL remains the source of record. Browser routes are first-party interfaces, not an alternative public automation API. The project is licensed under Apache-2.0 and also provides a hosted demo for testing temporary isolated team data.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Dense Mem

dense-mem is an MCP server that connects AI agents to self-hosted PostgreSQL and pgvector memory, with Redis available for coordination. Its main tools ingest evidence, recall supported memory, trace relationships, retract evidence, correct relationships, export provenance, and run recall evaluations over Streamable HTTP.

Install dense-mem with the provided Docker Compose example, PostgreSQL with pgvector, and the required environment values. Set POSTGRES_PASSWORD, CONTROL_PORTAL_TOKEN, and AI_API_KEY in the environment file, start the stack, then use the MCP endpoint at /mcp.

dense-mem uses PostgreSQL with pgvector as its durable authority; Redis is used only for coordination. Single-node deployments may use process-local coordination, while multi-instance deployments require Redis or an equivalent distributed implementation.

dense-mem preserves provenance by keeping evidence append-only and recording lifecycle changes instead of deleting source records. Retractions retire caller-owned evidence, and relationship corrections supersede prior relationships while retaining their support lineage.

Cursor can connect when configured to use its Streamable HTTP MCP endpoint, because dense-mem exposes MCP at /mcp. The server does not require a client-specific integration; authentication and the team credential still need to be configured.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewDense Mem AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/dense-mem?style=directory)](https://allmcps.com/mcp/dense-mem)
HTML Embed
<a href="https://allmcps.com/mcp/dense-mem"><img src="https://allmcps.com/api/badge/dense-mem?style=directory" alt="Dense Mem on AllMCPs" /></a>