Dense-Mem
Self-hosted MCP memory with exact Evidence, provenance, and governed recall.
Interactive documentation · Setup guide · How it works
Dense-Mem is a standalone HTTP MCP memory server using Streamable HTTP. AI clients choose what to remember; Dense-Mem stores exact Evidence, preserves its sources and lifecycle, and retrieves authorized memory across conversations.
PostgreSQL with pgvector is the durable authority. Redis is coordination only: a single-node deployment can use process memory; a multi-instance deployment requires Redis or equivalent distributed coordination.
Try the demo
Open the hosted demo to create a temporary, isolated team and try disposable memory before self-hosting.
Why Dense-Mem
- Keep the source. Exact Evidence retains occurrences, source revisions, provenance, and an append-only lifecycle.
- Control access. Private and team-shared memory have explicit destinations; shared visibility does not grant permission to change another owner's Evidence.
- Follow the history. Recall returns eligible Evidence; Trace explains its provenance, and corrections or retractions preserve lineage.
- Organize without inventing facts. Derived topics help discovery while Evidence remains canonical memory.
See Using Dense-Mem for the memory workflow and Architecture for the system design.
Quickstart
Install Docker with Compose. This fresh-install example pins the image and configuration files to the same published release:
mkdir dense-mem-local
cd dense-mem-local
export DENSE_MEM_VERSION=v2.8.0
export DENSE_MEM_IMAGE="ghcr.io/markhuangai/dense-mem:${DENSE_MEM_VERSION}"
curl -fsSLo docker-compose.yml \
"https://raw.githubusercontent.com/markhuangai/dense-mem/${DENSE_MEM_VERSION}/examples/docker-compose.base.yml"
curl -fsSLo .env.example \
"https://raw.githubusercontent.com/markhuangai/dense-mem/${DENSE_MEM_VERSION}/examples/.env.example"
cp .env.example .env
${EDITOR:-vi} .env
Set these values in .env:
| Setting | Purpose |
|---|---|
POSTGRES_PASSWORD | Password for the local PostgreSQL instance |
CONTROL_PORTAL_TOKEN | Private control-portal access token |
AI_API_KEY | Model-provider credential |
AI_VERIFIER_MODEL | Chat model used to assess Evidence |
The example supplies OpenAI embedding defaults. For other providers, change the endpoint, model, and dimensions together; see Configuration.
docker compose up -d
docker compose ps
curl -fsS http://127.0.0.1:8080/ready
Startup applies migrations before readiness. Keep the image pin for later starts; consult the Operations Runbook before changing an existing database.
Connect your AI client
- Open the private control portal at
http://127.0.0.1:8090/withCONTROL_PORTAL_TOKEN. Create a team, then create its first credential. - Open the user portal at
http://127.0.0.1:8080/ui. Its Connect page shows the MCP connection details. The local MCP endpoint ishttp://127.0.0.1:8080/mcp. - Configure your host using the
MCP client guide,
then try a Remember, Recall, and Trace workflow. When
MCP_PUBLIC_BASE_URLis set, OAuth-capable hosts such as Claude Desktop can sign in through the browser instead of storing a key; use/mcp/c/<name>for one connection per team.
The control listener stays private. Configured hosted model providers can
receive Evidence and queries; use self-hosted providers when that traffic must
stay within your infrastructure. External memory automation uses /mcp.
Documentation
| Goal | Guide |
|---|---|
| Learn how memory works | Evidence walkthrough · Using Dense-Mem |
| Configure and operate a server | Configuration · Operations |
| Choose deployment examples | Examples · Grafana |
| Integrate a client | Python / ADK / LangChain · stdio MCP proxy |
| Develop and test | Scripts · Evaluation · ADRs |
The documentation site holds interactive walkthroughs and detailed reference.
Directory READMEs cover the files they accompany. For documented behavior
changes, link a companion gh-pages PR or explain why the site needs no update.
Dense-Mem is part of the research preprint Governed Enterprise AI Memory Beyond RAG: From Vector Retrieval to Permissioned Knowledge Graphs.