server-memory
A local-first, durable knowledge graph MCP server backed by SQLite+FTS5, providing structured memory for AI agents across sessions. Key capabilities:
Entity & Relation Management
Create, delete (soft/hard), and merge entities with types, observations, tags, and metadata
Create and delete typed, weighted relations between entities (e.g.,
depends_on,implements)
Memory Recall & Search
memory_context— lightweight (~200–500 token) recall snapshot with pinned entities and recent activitymemory_context_full— richer bootstrap context (~500–1500 tokens) for deep recallsearch_nodes— BM25-ranked FTS5 full-text search with prefix, phrase, and boolean operators; filterable by tags, entity types, and time rangeread_graph— browse the full graph (compressed or full JSON), optionally filteredopen_nodes— retrieve specific entities by name with optional BFS neighbor expansion
Observations & Versioning
Add observations with
source,confidence,importance, and typedobs_type(fact, decision, api_endpoint, file_path, config, schema, etc.); protected types survive compressionView full observation version history per entity
Activity Logging & Timeline
log_activity— record events (file changes, bugs fixed, decisions, etc.) with entity links, tags, and session metadataquery_timeline— query history by relative time (e.g.,"2h","7d"), ISO ranges, action types, entity name, or session ID
Tag Management
List, create, delete, apply, remove, and clean up tags; supports ephemeral tags with auto-expiry
Import / Export / Backup
Export graph as JSON or JSONL (compatible with
@modelcontextprotocol/server-memory)Import JSON/JSONL, skipping duplicates and invalid relations
Backup SQLite database to a timestamped file
Statistics
View entity/relation/observation counts, tag distribution, DB size, orphan entities, and deleted item counts
Memory Scoping & Deployment
Operate on
workspace(default) orglobalpreference memory; combine results with source labelsRun as a direct stdio server or as a shared localhost HTTP daemon with stdio proxy for multi-client access
Optional embedding-assisted semantic retrieval
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@server-memoryremember that Alice likes programming in Python"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Overview
server-memory is a local-first Model Context Protocol (MCP) server for durable agent memory: entities, observations, relations, tags, activity, and fast recall backed by SQLite and FTS5.
It is intentionally boring where memory should be boring.
Data stays in local databases unless you export it. The default MCP transport is stdio, and the optional shared HTTP daemon is bound to localhost by default.
At a glance
Capability | Implementation |
Storage | SQLite with WAL mode and FTS5 search |
Memory model | Entities, observations, relations, tags, and activity |
MCP interface | 20 tools; no resources or prompts |
Default transport | stdio |
Shared mode | Localhost HTTP daemon with a stdio proxy |
Memory scopes | Workspace memory and optional global preference memory |
Retrieval | FTS5 search with optional embedding assistance |
Data paths | Platform-native user data and runtime directories through |
Highlights
Local knowledge graph: Stores entities, observations, relations, tags, and activity in SQLite with WAL mode and FTS5 search.
MCP tools: Exposes 20 tools for graph writes, recall, timeline queries, import/export, tagging, backup, and statistics.
Compact context: Provides token-budgeted
memory_contextoutput for routine agent recall.Optional embeddings: Supports embedding-assisted retrieval through the
embeddingsextra.Memory scopes: Keeps workspace memory and global preference memory separate by default.
Shared mode: Provides a localhost HTTP daemon and stdio proxy for clients that need one shared process.
Platform-native paths: Uses
platformdirsfor per-user data and runtime directories.
Related MCP server: tartarus-mcp
Architecture
Default stdio mode
┌────────────┐ stdio ┌─────────────────────┐
│ MCP client │ ────────────────────> │ server-memory │
└────────────┘ │ FastMCP server │
├─────────────────────┤
│ Workspace SQLite DB │
│ │
│ Global preferences │
│ DB, when enabled │
└─────────────────────┘Optional shared mode
┌────────────┐ stdio ┌─────────────────────┐
│ MCP client │ ───────────────> │ server-memory-proxy │
└────────────┘ └──────────┬──────────┘
│
│ HTTP
│ 127.0.0.1:8765/mcp
▼
┌─────────────────────┐
│ server-memory-serve │
│ FastMCP daemon │
└─────────────────────┘Requirements
Python 3.10 or newer
SQLite with FTS5 enabled
macOS, Ubuntu, or Windows for the GitHub Actions support matrix
The CI workflow is configured to test:
Python 3.10 through 3.14 on Ubuntu
Python 3.10 and 3.14 on
ubuntu-latestPython 3.10 and 3.14 on
windows-latestPython 3.10 and 3.14 on
macos-latest
Installation
Core installation
Install directly from this GitHub repository:
python -m pip install "server-memory @ git+https://github.com/MK-986123/server-memory.git"Installation with embeddings
python -m pip install "server-memory[embeddings] @ git+https://github.com/MK-986123/server-memory.git"Development checkout
git clone https://github.com/MK-986123/server-memory.git
cd server-memory
python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"On Windows PowerShell:
.venv\Scripts\Activate.ps1Install development and embedding dependencies together:
python -m pip install -e ".[dev,embeddings]"Quick start
Run the stdio server
server-memoryEquivalent module form:
python -m server_memoryUse a dedicated project database
MEMORY_DB_PATH=<PROJECT_ROOT>/memory.db server-memoryUse the equivalent environment-variable syntax for your shell when running on Windows.
Run the shared localhost daemon
server-memory-serve \
--host 127.0.0.1 \
--port 8765 \
--transport streamable-httpConnect a stdio-only client to the daemon
server-memory-proxy --url http://127.0.0.1:8765/mcpMCP client configuration
Direct stdio server
{
"mcpServers": {
"server-memory": {
"command": "server-memory",
"env": {
"MEMORY_PROJECT": "<PROJECT_NAME>"
}
}
}
}Shared daemon proxy
Start server-memory-serve separately, then configure the MCP client to launch the proxy:
{
"mcpServers": {
"server-memory": {
"command": "server-memory-proxy",
"args": [
"--url",
"http://127.0.0.1:8765/mcp"
]
}
}
}Tool reference
server-memory registers MCP tools only. It does not register resources or prompts.
Scope behavior
Most tools accept one of three scopes:
Scope | Behavior |
| Operates on the current workspace database and remains the default for ordinary project memory |
| Operates on the global preferences database |
| Combines supported workspace and global results with source labels |
Preference-tagged writes still auto-route to the global database when global preference routing is enabled.
Destructive operations require an explicitworkspace or global scope. They reject scope="all" to prevent accidental cross-database deletion, merging, or tag removal.
Tool | Purpose | Main inputs |
| Compact scoped recall for ordinary agent context |
|
| Larger bootstrap context with pinned and recent items |
|
| Add entities and optional initial observations |
|
| Add observations to existing entities |
|
| Connect existing entities |
|
| Read graph data, compressed by default |
|
| FTS5 search with filters |
|
| Open named entities and optional neighbors |
|
| Record a development or session event |
|
| Query activity history |
|
| List, create, delete, apply, remove, or clean tags |
|
| Merge one entity into another |
|
| Export graph as JSON or JSONL |
|
| Import JSON or JSONL graph data |
|
| Return counts and storage statistics |
|
| Copy a SQLite database |
|
| Show observation versions for an entity |
|
| Soft-delete or hard-delete entities |
|
| Delete selected observations |
|
| Delete selected relations |
|
Write tools modify the selected SQLite database. backup_memory writes a database backup. export_graph can print sensitive memory content, so review exports before sharing them.
Configuration
Configuration is environment-driven. Empty path overrides in .env.example use the platform defaults.
Storage and scope
Variable | Default | Meaning |
| Platform user data directory, workspace-namespaced when a project root is detected | Workspace SQLite database |
| Empty | Default project scope |
|
| Enable the global preferences database |
| Platform user data directory | Global preferences SQLite database |
|
| Route preference-tagged writes to global memory |
| Unset | Explicit workspace root for default database placement |
| Unset | Explicit workspace identifier for default database placement |
Retrieval and compression
Variable | Default | Meaning |
|
| Compression level from |
|
| Output token budget |
|
| Optional embedding model |
|
| Enable embedding search and backfill |
|
| Write-path embedding budget |
|
| Semantic deduplication threshold |
Runtime and shared daemon
Variable | Default | Meaning |
| Unset | Import JSONL on startup |
| Unset | Session identifier for activity logging |
|
| Require bearer authentication for the shared HTTP daemon |
| Platform runtime directory | Local HTTP daemon token file |
Development
Install the development dependencies:
python -m pip install -e ".[dev]"Run the local validation sequence:
python -m compileall -q src tests scripts
python -m ruff check .
python -m pytest -q
python -m build
python -m twine check dist/*
python scripts/inspect_wheel.py dist
python -m pip_auditVerify the installed entry points:
python scripts/smoke_stdio.py server-memory
server-memory-serve --help
server-memory-proxy --helpThe stdio smoke test sends an MCP initialize request to the installed entry point and fails if stdout contains non-protocol output.
See CONTRIBUTING.md for contribution guidance.
Security and privacy
Memory databases, exports, backups, and activity logs can contain sensitive user data.
The stdio server writes protocol data to stdout. Diagnostics should go to stderr or logs.
The shared HTTP daemon defaults to
127.0.0.1and local bearer-token authentication.The bearer token is generated locally and stored under a platform-native runtime directory unless
MEMORY_AUTH_TOKEN_PATHis set.No external service credentials are required for the core server.
Optional embeddings may load local or cached model files depending on the environment and installed extras.
Review exported graph content before sharing it.
Do not commit live memory databases, token files, or backups.
Report vulnerabilities through GitHub private vulnerability reporting when available. Do not include secrets or private memory exports in public issues.
See SECURITY.md for the project security policy.
CI and supply chain
GitHub Actions are configured to run:
syntax validation
Ruff linting
pytest across the supported Python and operating-system matrix
wheel and source distribution builds
wheel-content inspection
clean installed-package checks outside the repository checkout
MCP stdio and installed-command smoke tests
pip-auditCodeQL
Dependency Review
Dependabot is configured for Python dependencies and GitHub Actions.
The workflow uses GitHub-hosted ubuntu-latest, windows-latest, and macos-latest labels. These labels refer to GitHub's latest stable runner images and can temporarily lag the newest vendor operating-system release during image migrations.
Troubleshooting
Symptom | Check |
| Use a Python build linked against SQLite with FTS5 enabled. |
MCP client hangs at startup | Run |
Multiple clients lock the database | Run one |
Proxy returns an authentication failure | Restart the daemon and client so both read the same |
Memory is stored in an unexpected location | Set |
License
No open-source license has been selected. Public visibility does not grant permission to copy, modify, redistribute, or reuse the project.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/MK-986123/server-memory'
If you have feedback or need assistance with the MCP directory API, please join our Discord server