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.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。