Archivist MCP
A local-first memory layer for coding agents to persist and retrieve project decisions, architecture context, and rules across multiple development sessions. It utilizes a three-tier memory model and hybrid retrieval to provide agents with durable, searchable context and a WebUI for human review.
README
Archivist MCP
Local-first project memory server for agents and developers
Features • Quick Start • MCP Setup • WebUI • Usage • Tools • Configuration • Reliability • Troubleshooting
Archivist MCP is a memory layer for coding agents. You run it alongside your project, connect your MCP client, and the agent can persist/retrieve decisions, incidents, rules, and architecture context across sessions. WebUI is for human review and controlled write actions when you want visibility before changing memory.
Features
- Three-tier memory model: working memory, compact core memory (
core_memory.md/.json), archival graph - Graph + lifecycle safety: typed nodes/edges, state transitions, optimistic concurrency, immutable audit events
- Hybrid retrieval: FTS + local embeddings + graph degree + recency with provenance and confidence
- MCP transports: JSON-RPC over STDIO and HTTP (
/mcp) - Team mode: SSE transport with bearer-token auth, role matrix, and project scoping
- Controlled write workflows: conflict resolution, branch-to-project promotion, stale-memory invalidation
- Security hardening: payload allowlists, size/type validation, sanitization, redaction, retention purge
- Reliability tooling: integrity checks, snapshots, restore, startup recovery, rebuild index+embeddings
Quick Start
Prerequisites
- Python
3.11+ - macOS/Linux/Windows
1) Initialize database
python3 scripts/migrate.py --db .archivist/archivist.db
2) Start STDIO server
python3 -m archivist_mcp.stdio_server --db .archivist/archivist.db
3) Seed a project/user (first-time)
python3 - <<'PY'
from archivist_mcp.db import connect
conn = connect('.archivist/archivist.db')
conn.execute("INSERT OR IGNORE INTO projects(project_id,name) VALUES('proj-1','Project One')")
conn.execute("INSERT OR IGNORE INTO users(user_id,display_name) VALUES('user-1','User One')")
conn.commit()
conn.close()
PY
MCP Setup
Option A: VS Code / Codex Extension (STDIO MCP server)
In MCP settings (Add MCP Server) use:
- Name:
archivist-mcp - Command to launch:
python3 - Arguments:
-m archivist_mcp.mcp_stdio_server --db .archivist/archivist.db - Working directory: your repo root (example:
/path/to/your/repo) - Env vars: optional (
ARCHIVIST_CONFIG_PATH, etc.)
If you need strict team-style user enforcement in stdio mode, add --require-user-id.
Option B: MCP over HTTP bridge
If your MCP client expects stdio process launch but you want the HTTP server, launch a bridge command such as:
npx -y mcp-remote http://127.0.0.1:8766/mcp
WebUI
Start directly:
python3 -m archivist_mcp.mcp_http_server --db .archivist/archivist.db --host 127.0.0.1 --port 8766
python3 -m archivist_mcp.sse_server --db .archivist/archivist.db --host 127.0.0.1 --port 8765
python3 -m archivist_mcp.webui_server --db .archivist/archivist.db --host 127.0.0.1 --port 8090
Open:
http://127.0.0.1:8090
Views:
- Search (with explain-why provenance)
- Graph
- Decision timeline
- Incident timeline
- Conflict inbox
- Controls (rule writes, conflict resolve, scope promotion, memory invalidation)
Usage
What this project is for
Use case:
- You work with an agent on a codebase over many sessions.
- Important context normally gets lost between sessions.
- Archivist stores that context in a local graph and makes it available through MCP tools.
- The agent can then recall prior decisions/conflicts/incidents instead of re-discovering them.
How tool discovery and invocation works
- After MCP connection, the client initializes the server and requests available tools (
tools/list). - The client chooses a tool based on your prompt and invokes it (
tools/call) with arguments. - You usually do not call MCP tools manually; your agent does it for you.
- If your client has a tools panel, you can verify connection by checking the listed Archivist tools.
When to use which tool family
- Capture memory:
create_entity,archive_decision,store_observation,create_edge - Recall context:
search_graph,read_node,get_project_summary,list_recent_incidents - Maintain memory quality:
update_entity,deprecate_node,resolve_conflict,invalidate_stale_memory - Codebase-derived memory:
extract_symbols,rebuild_index_and_embeddings - Ops/compliance:
export_audit_log,purge_observations,get_metrics
Typical day-to-day flow
- Agent reads context with
search_graph. - During work, agent writes new facts/decisions.
- If stale data appears, agent or human resolves/deprecates it.
- You review timelines/conflicts in WebUI when needed.
What gets persisted
- Nodes: decisions, incidents, rules, entities, observations
- Edges: relationships like dependencies, resolution links, deprecations
- Audit/conflict records
- Compact core summary files:
core_memory.mdandcore_memory.json
MCP Tools
Current tool set (subject to feature flags):
healthversionget_capabilitiesget_metricscreate_entityread_nodeupdate_entitycreate_edgesearch_graphstore_observationarchive_decisionget_project_summarylist_recent_incidentsdeprecate_nodecompact_core_memoryextract_symbolsrebuild_embeddingsrebuild_index_and_embeddingsexport_audit_logpurge_observationsresolve_conflictpromote_branch_recordinvalidate_stale_memory
search_graph note:
include_deprecated=falsereturns active records only.include_deprecated=trueallows deprecated/invalidated/superseded records (archived excluded).
Configuration
Config source order:
.archivist/config.toml(orARCHIVIST_CONFIG_PATH)- environment variable overrides
Common env vars:
ARCHIVIST_CONFIG_PATHARCHIVIST_DISABLE_EMBEDDINGS=true|falseARCHIVIST_CORE_MAX_KBARCHIVIST_RATE_LIMIT_PER_MINUTEARCHIVIST_STRUCTURED_LOGGING=falseARCHIVIST_DB_ENCRYPTION_KEYARCHIVIST_ENCRYPTION_REQUIRED=trueARCHIVIST_SSE_TOKENS(JSON token map for team auth)ARCHIVIST_TLS_ENABLED=trueARCHIVIST_TLS_CERT_FILE,ARCHIVIST_TLS_KEY_FILE
Example team token map:
{
"token-a": {
"user_id": "user-1",
"role": "writer",
"projects": ["proj-1"]
},
"token-b": {
"user_id": "maint-1",
"role": "maintainer",
"projects": ["proj-1"]
}
}
Encryption behavior:
- If
ARCHIVIST_DB_ENCRYPTION_KEYis set and SQLCipher is unavailable, startup fails. ARCHIVIST_ENCRYPTION_REQUIRED=truealso enforces fail-closed encryption checks.
Reliability & Ops
Integrity check
python3 scripts/check_integrity.py --db .archivist/archivist.db
Snapshot and restore
python3 scripts/create_snapshot.py --db .archivist/archivist.db --snapshot-dir .archivist/snapshots
python3 scripts/restore_snapshot.py --snapshot .archivist/snapshots/<snapshot>.db --db .archivist/archivist.db
Rebuild derived state
python3 scripts/rebuild_index_and_embeddings.py --db .archivist/archivist.db --project-id proj-1 --root .
Project Structure
archivist_mcp/
mcp_stdio_server.py # MCP JSON-RPC over stdio
mcp_http_server.py # MCP JSON-RPC over HTTP (/mcp)
sse_server.py # Team mode HTTP+SSE
webui_server.py # Browser UI + controlled write APIs
tooling/server.py # Tool router, validation, envelope/errors
storage/repository.py # Graph persistence + lifecycle + audit
retrieval/ # embeddings + hybrid retrieval
indexing/ # symbol extraction + incremental indexer
memory/materializer.py # core_memory.md + core_memory.json
migrations/sql/ # schema migrations
scripts/
migrate.py
create_snapshot.py
restore_snapshot.py
check_integrity.py
rebuild_index_and_embeddings.py
tests/
test suites for integration, retrieval, security, team mode, and WebUI behavior
docs/
quickstart.md
troubleshooting.md
recovery_runbook.md
Troubleshooting
AUTHZ_DENIED
Token role/scope does not permit the tool or project. Check ARCHIVIST_SSE_TOKENS role and projects.
CONFLICT_ERROR
Optimistic version mismatch. Re-read node, use latest version, retry or resolve via conflict workflow.
EMBEDDING_DISABLED
Embeddings are disabled/unavailable. Retrieval falls back to fts_graph mode.
Blank WebUI timelines
The UI reads from the DB passed to webui_server --db. Ensure your seeding and servers all point at the same DB path.
Documentation
- Quickstart: docs/quickstart.md
- Troubleshooting: docs/troubleshooting.md
- Upgrade/Migration: docs/upgrade_migration.md
- Recovery runbook: docs/recovery_runbook.md
- Security threat model: docs/security_threat_model.md
Built for durable project memory across agent sessions, with local-first defaults and auditable writes.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.