memory-v2-mcp 2.1.0a2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- memory_v2_mcp-2.1.0a2/LICENSE +21 -0
- memory_v2_mcp-2.1.0a2/NOTICE +5 -0
- memory_v2_mcp-2.1.0a2/PKG-INFO +187 -0
- memory_v2_mcp-2.1.0a2/README.md +346 -0
- memory_v2_mcp-2.1.0a2/mcp/README.md +163 -0
- memory_v2_mcp-2.1.0a2/mcp/client.py +98 -0
- memory_v2_mcp-2.1.0a2/mcp/examples/claude_desktop_config.json +11 -0
- memory_v2_mcp-2.1.0a2/mcp/examples/cursor_mcp.json +11 -0
- memory_v2_mcp-2.1.0a2/mcp/examples/docker_claude_config.json +19 -0
- memory_v2_mcp-2.1.0a2/mcp/requirements.txt +3 -0
- memory_v2_mcp-2.1.0a2/mcp/server.py +135 -0
- memory_v2_mcp-2.1.0a2/mcp/test_server.py +294 -0
- memory_v2_mcp-2.1.0a2/memory_v2_mcp.egg-info/PKG-INFO +187 -0
- memory_v2_mcp-2.1.0a2/memory_v2_mcp.egg-info/SOURCES.txt +19 -0
- memory_v2_mcp-2.1.0a2/memory_v2_mcp.egg-info/dependency_links.txt +1 -0
- memory_v2_mcp-2.1.0a2/memory_v2_mcp.egg-info/entry_points.txt +2 -0
- memory_v2_mcp-2.1.0a2/memory_v2_mcp.egg-info/requires.txt +4 -0
- memory_v2_mcp-2.1.0a2/memory_v2_mcp.egg-info/top_level.txt +1 -0
- memory_v2_mcp-2.1.0a2/pyproject.toml +39 -0
- memory_v2_mcp-2.1.0a2/setup.cfg +4 -0
- memory_v2_mcp-2.1.0a2/tests/test_edit_integrity.py +222 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Memory v2.0 contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: memory-v2-mcp
|
|
3
|
+
Version: 2.1.0a2
|
|
4
|
+
Summary: MCP server for Memory v2: local-first long-term memory for AI agents
|
|
5
|
+
Author: DonParalon85
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/DonParalon85/memory-v.2-alpha
|
|
8
|
+
Project-URL: Repository, https://github.com/DonParalon85/memory-v.2-alpha
|
|
9
|
+
Project-URL: Issues, https://github.com/DonParalon85/memory-v.2-alpha/issues
|
|
10
|
+
Keywords: mcp,model-context-protocol,memory,ai-agents,local-first,sqlite
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
License-File: NOTICE
|
|
20
|
+
Requires-Dist: mcp<3,>=2
|
|
21
|
+
Provides-Extra: test
|
|
22
|
+
Requires-Dist: pytest>=8; extra == "test"
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# MCP server
|
|
26
|
+
|
|
27
|
+
Memory v2 exposes its API to any MCP-speaking agent through a small stdio
|
|
28
|
+
server. Works with Claude Desktop, Claude Code, Cursor and other MCP clients.
|
|
29
|
+
|
|
30
|
+
## Tools
|
|
31
|
+
|
|
32
|
+
| Tool | Purpose |
|
|
33
|
+
|---|---|
|
|
34
|
+
| `memory_health` | Check API availability |
|
|
35
|
+
| `memory_list_projects` | List projects |
|
|
36
|
+
| `memory_project_context` | Restore a project and its branches |
|
|
37
|
+
| `memory_search` | Search memories and messages |
|
|
38
|
+
| `memory_archive_conversation` | Archive a branch idempotently |
|
|
39
|
+
| `memory_upsert` | Store a fact, decision, constraint or preference |
|
|
40
|
+
| `memory_deprecate` | Retire an old memory, optionally with a replacement |
|
|
41
|
+
|
|
42
|
+
## Install
|
|
43
|
+
|
|
44
|
+
The project targets MCP SDK v2 (`MCPServer`, formerly `FastMCP`). The
|
|
45
|
+
requirement is `mcp>=2,<3`; `server.py` keeps a v1 fallback for older
|
|
46
|
+
environments.
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
python3 -m venv .venv-mcp
|
|
50
|
+
. .venv-mcp/bin/activate
|
|
51
|
+
pip install -r mcp/requirements.txt
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Windows PowerShell:
|
|
55
|
+
|
|
56
|
+
```powershell
|
|
57
|
+
python -m venv .venv-mcp
|
|
58
|
+
.venv-mcp\Scripts\Activate.ps1
|
|
59
|
+
pip install -r mcp\requirements.txt
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Environment:
|
|
63
|
+
|
|
64
|
+
| Variable | Default |
|
|
65
|
+
|---|---|
|
|
66
|
+
| `MEMORY_API` | `http://127.0.0.1:8002` |
|
|
67
|
+
| `MEMORY_API_TOKEN` | empty (local-only) |
|
|
68
|
+
|
|
69
|
+
## Claude Desktop
|
|
70
|
+
|
|
71
|
+
Config file:
|
|
72
|
+
|
|
73
|
+
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
74
|
+
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
75
|
+
- Linux: `~/.config/Claude/claude_desktop_config.json`
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"mcpServers": {
|
|
80
|
+
"memory-v2": {
|
|
81
|
+
"command": "C:\\path\\to\\memory_v2.0\\.venv-mcp\\Scripts\\python.exe",
|
|
82
|
+
"args": ["C:\\path\\to\\memory_v2.0\\mcp\\server.py"],
|
|
83
|
+
"env": {
|
|
84
|
+
"MEMORY_API": "http://127.0.0.1:8002"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Restart Claude Desktop after editing the file. A `memory-v2` tool group should
|
|
92
|
+
appear.
|
|
93
|
+
|
|
94
|
+
## Claude Code
|
|
95
|
+
|
|
96
|
+
```sh
|
|
97
|
+
claude mcp add memory-v2 -- python /path/to/memory_v2.0/mcp/server.py
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Cursor
|
|
101
|
+
|
|
102
|
+
Put this in `~/.cursor/mcp.json` (or `.cursor/mcp.json` inside a project):
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"mcpServers": {
|
|
107
|
+
"memory-v2": {
|
|
108
|
+
"command": "python",
|
|
109
|
+
"args": ["/path/to/memory_v2.0/mcp/server.py"],
|
|
110
|
+
"env": {
|
|
111
|
+
"MEMORY_API": "http://127.0.0.1:8002"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Docker-only option (no local Python)
|
|
119
|
+
|
|
120
|
+
If the Memory stack is running under Docker, the same image can host the MCP
|
|
121
|
+
server:
|
|
122
|
+
|
|
123
|
+
```sh
|
|
124
|
+
docker run -i --rm --network memory-v2_default \
|
|
125
|
+
-e MEMORY_API=http://memory:8002 \
|
|
126
|
+
memory-v2:latest python /app/mcp/server.py
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
On Linux, `--network host` with `MEMORY_API=http://127.0.0.1:8002` also works.
|
|
130
|
+
On Docker Desktop for Windows, host networking differs; running the MCP server
|
|
131
|
+
natively in a Python venv is usually simpler.
|
|
132
|
+
|
|
133
|
+
## Testing
|
|
134
|
+
|
|
135
|
+
Run the stdio smoke test against a **dev/test** Memory API:
|
|
136
|
+
|
|
137
|
+
```sh
|
|
138
|
+
MEMORY_API=http://127.0.0.1:8103 python mcp/test_server.py
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Or inside the Docker image (no local Python):
|
|
142
|
+
|
|
143
|
+
```sh
|
|
144
|
+
docker run --rm --network host \
|
|
145
|
+
-e MEMORY_API=http://127.0.0.1:8103 \
|
|
146
|
+
-v "$PWD/mcp:/app/mcp:ro" \
|
|
147
|
+
--entrypoint python memory-v2:latest /app/mcp/test_server.py
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
The test refuses to run against a non-loopback API, so a dev run cannot touch a
|
|
151
|
+
shared database. It checks `initialize`, `tools/list`, every tool, archive
|
|
152
|
+
idempotency, and error responses, then removes the test conversation and test
|
|
153
|
+
memory it created.
|
|
154
|
+
|
|
155
|
+
Point it at any project you don't mind writing to:
|
|
156
|
+
|
|
157
|
+
```sh
|
|
158
|
+
MEMORY_API=http://127.0.0.1:8002 MEMORY_PROJECT_ID=2 python mcp/test_server.py
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
`MEMORY_PROJECT_ID` defaults to `1`. The server itself has no model or client
|
|
162
|
+
dependency: any MCP-capable app works. See `docs/integrations.md` for Claude
|
|
163
|
+
Desktop, Cursor, Cline, Continue, Windsurf, Zed and plain REST/OpenAI/Anthropic
|
|
164
|
+
tool schemas.
|
|
165
|
+
|
|
166
|
+
Run the server as a script (`python mcp/server.py`), not as
|
|
167
|
+
`python -m mcp.server` from the repository root: the project's `mcp/`
|
|
168
|
+
directory can otherwise shadow the installed SDK.
|
|
169
|
+
|
|
170
|
+
## Example prompts
|
|
171
|
+
|
|
172
|
+
- “Search my Memory for `AsyncSession` and show the source branch.”
|
|
173
|
+
- “Restore project 1 and summarize its open decisions.”
|
|
174
|
+
- “Archive this dialog as a branch in project 1 with external id
|
|
175
|
+
`demo:fastapi:async-session:003`.”
|
|
176
|
+
- “Save a decision: schema changes go through Alembic.”
|
|
177
|
+
|
|
178
|
+
## Security
|
|
179
|
+
|
|
180
|
+
- The MCP server only talks to the Memory API; it does not open the database.
|
|
181
|
+
- Point `MEMORY_API` at a dev/test instance while developing. Never point the
|
|
182
|
+
MCP server at a shared or production address by accident.
|
|
183
|
+
- Keep the API bound to `127.0.0.1` for local use.
|
|
184
|
+
- If you expose the API to a LAN, set `MEMORY_API_TOKEN` and pass it to the
|
|
185
|
+
MCP server through the environment.
|
|
186
|
+
- Tool results may contain conversation text. Do not paste secrets into
|
|
187
|
+
prompts.
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
# Memory v2.1
|
|
2
|
+
|
|
3
|
+
[](https://github.com/DonParalon85/memory-v.2-alpha/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/DonParalon85/memory-v.2-alpha/releases)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://www.python.org/)
|
|
7
|
+
|
|
8
|
+
**Local-first long-term memory for AI agents and long-running projects.**
|
|
9
|
+
|
|
10
|
+
Memory v2.1 stores projects, conversation branches, messages and durable facts in
|
|
11
|
+
a single SQLite database. It is built for people who want their agent memory to
|
|
12
|
+
stay on their own machine: no cloud account, no vendor lock-in, no telemetry.
|
|
13
|
+
|
|
14
|
+
> **Status:** `2.1.0-alpha.2`. The core API, MCP server, web UI and offline
|
|
15
|
+
> installers are working and tested. Expect rough edges; back up your database.
|
|
16
|
+
|
|
17
|
+
## Why
|
|
18
|
+
|
|
19
|
+
Long agent sessions get lost when a workspace is recreated, a model is switched,
|
|
20
|
+
or a chat is closed. Memory v2.1 keeps the whole branch, not just a summary:
|
|
21
|
+
|
|
22
|
+
- one project can contain dozens of branches;
|
|
23
|
+
- a branch can be restored with one request;
|
|
24
|
+
- durable facts survive across sessions;
|
|
25
|
+
- full-text search covers both facts and messages;
|
|
26
|
+
- the database is a plain SQLite file you can copy and inspect.
|
|
27
|
+
|
|
28
|
+
## Features
|
|
29
|
+
|
|
30
|
+
- **Projects → branches → messages.** One project, many conversations, shared
|
|
31
|
+
logic and search.
|
|
32
|
+
- **Durable memories.** Facts, decisions, constraints and preferences with
|
|
33
|
+
importance, confidence, status and supersede links.
|
|
34
|
+
- **Message provenance.** Every message keeps its original source fingerprint;
|
|
35
|
+
edits create revisions instead of silently changing the archive. Soft-deleted
|
|
36
|
+
messages stay recoverable and are excluded from search.
|
|
37
|
+
- **Large branches.** Paginated message loading, load-earlier, in-branch search
|
|
38
|
+
and jump-to-message; role editing and edit history are built in.
|
|
39
|
+
- **Full-text search.** SQLite FTS5 plus Russian morphology (`pymorphy3`);
|
|
40
|
+
search memories and messages, optionally inside one project.
|
|
41
|
+
- **Idempotent archive.** Re-sending the same branch appends only new messages;
|
|
42
|
+
duplicates are skipped.
|
|
43
|
+
- **Web UI.** Projects, branches, messages, memory cards, search, triggers,
|
|
44
|
+
settings and first-run onboarding. No Node.js build step.
|
|
45
|
+
- **MCP server.** Seven tools for Claude Desktop, Claude Code, Cursor, Cline,
|
|
46
|
+
Continue, Windsurf, Zed and other MCP clients.
|
|
47
|
+
- **Browser extension.** Save selected text or the current page from
|
|
48
|
+
Chrome/Edge/Chromium and Firefox (experimental): context menu, `mem` + Tab, or
|
|
49
|
+
the toolbar popup.
|
|
50
|
+
- **Offline installers.** Windows and Linux packages with Python 3.12 and all
|
|
51
|
+
wheels included. A visible status window/stage progress shows what is
|
|
52
|
+
happening; no internet is needed during installation.
|
|
53
|
+
- **Local-first.** SQLite file, loopback-only by default, no cloud services.
|
|
54
|
+
- **Backups and diagnostics.** One-click SQLite backup API, JSON project export,
|
|
55
|
+
log rotation and `/diagnostics`.
|
|
56
|
+
|
|
57
|
+
## How it compares
|
|
58
|
+
|
|
59
|
+
Memory v2 is not a vector store and not an agent framework. It is a small,
|
|
60
|
+
inspectable archive that an agent can query over MCP.
|
|
61
|
+
|
|
62
|
+
| | Memory v2 | Hosted memory services (mem0, Zep Cloud) | Agent frameworks (Letta) | Markdown notes (basic-memory) | Plain files |
|
|
63
|
+
|---|---|---|---|---|---|
|
|
64
|
+
| Data location | one SQLite file on your disk | vendor cloud | your server | Markdown files | anywhere |
|
|
65
|
+
| Account required | no | yes | no | no | no |
|
|
66
|
+
| MCP server | built in (7 tools) | usually separate | yes | yes | no |
|
|
67
|
+
| Editable history | revisions + soft delete | limited | limited | git | manual |
|
|
68
|
+
| Search | FTS5 + morphology | embeddings | embeddings | Markdown/grep | none |
|
|
69
|
+
| Works offline | yes, installers included | no | partial | no | yes |
|
|
70
|
+
| License | MIT | mixed | Apache-2.0 | MIT | — |
|
|
71
|
+
|
|
72
|
+
Details for the other projects change quickly — check their docs. The point here
|
|
73
|
+
is the trade-off: hosted services give you convenience and sync, Memory v2 gives
|
|
74
|
+
you a file you own, no account, and no network dependency.
|
|
75
|
+
|
|
76
|
+
## Install
|
|
77
|
+
|
|
78
|
+
### Windows (recommended: offline installer)
|
|
79
|
+
|
|
80
|
+
1. Download `MemoryV2-v2.1.0-alpha.2-Windows-x64.zip` from **Releases**.
|
|
81
|
+
2. Extract it to any folder.
|
|
82
|
+
3. Run `windows\install-memory.bat`.
|
|
83
|
+
4. The app installs per user to `%LOCALAPPDATA%\MemoryV2`, starts at logon and
|
|
84
|
+
opens `http://127.0.0.1:8002/ui/`.
|
|
85
|
+
|
|
86
|
+
No administrator rights and no internet connection are required. Windows may
|
|
87
|
+
show a SmartScreen warning because the installer is not code-signed yet.
|
|
88
|
+
Details: [`docs/installers.md`](docs/installers.md).
|
|
89
|
+
|
|
90
|
+
### Linux (recommended: offline installer)
|
|
91
|
+
|
|
92
|
+
1. Download `MemoryV2-v2.1.0-alpha.2-Linux-x64.zip` from **Releases**.
|
|
93
|
+
2. Extract it.
|
|
94
|
+
3. Run:
|
|
95
|
+
|
|
96
|
+
```sh
|
|
97
|
+
bash linux/install.sh
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The installer puts the app in `~/.local/share/memoryv2`, creates a user systemd
|
|
101
|
+
service (or a nohup fallback), and starts it on
|
|
102
|
+
`http://127.0.0.1:8002/ui/`.
|
|
103
|
+
|
|
104
|
+
Python 3.12 is required. The installer can install it via the system package
|
|
105
|
+
manager if it is missing; the Python packages themselves are bundled offline
|
|
106
|
+
(`cp312`, x86_64).
|
|
107
|
+
|
|
108
|
+
### Docker (from source)
|
|
109
|
+
|
|
110
|
+
```sh
|
|
111
|
+
cp .env.example .env
|
|
112
|
+
mkdir -p data
|
|
113
|
+
docker compose up -d --build
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Open `http://127.0.0.1:8002/ui/`.
|
|
117
|
+
|
|
118
|
+
### Manual native install (development)
|
|
119
|
+
|
|
120
|
+
```sh
|
|
121
|
+
python3.12 -m venv .venv
|
|
122
|
+
. .venv/bin/activate
|
|
123
|
+
pip install -r api/requirements.txt
|
|
124
|
+
pip install -r mcp/requirements.txt
|
|
125
|
+
cp .env.example .env
|
|
126
|
+
python api/init_db.py
|
|
127
|
+
python start_memory.py
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
See [`README-WINDOWS.md`](README-WINDOWS.md) for the Windows native path.
|
|
131
|
+
|
|
132
|
+
## First run
|
|
133
|
+
|
|
134
|
+
- The API listens on `127.0.0.1:8002` by default.
|
|
135
|
+
- If `MEMORY_API_TOKEN` is empty, only loopback clients are accepted.
|
|
136
|
+
- The onboarding wizard offers language (RU/EN), an optional AI agent, and
|
|
137
|
+
browser-extension installation.
|
|
138
|
+
- The demo seed is optional and fictional:
|
|
139
|
+
|
|
140
|
+
```sh
|
|
141
|
+
MEMORY_API=http://127.0.0.1:8002 python3 examples/seed_demo.py
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Browser extension
|
|
145
|
+
|
|
146
|
+
The extension is included in both offline installers and in the app's first-run
|
|
147
|
+
wizard. Standalone packages are attached to each release:
|
|
148
|
+
|
|
149
|
+
```text
|
|
150
|
+
MemoryV2-v2.1.0-alpha.2-browser-extension.zip # Chrome/Edge/Chromium
|
|
151
|
+
MemoryV2-v2.1.0-alpha.2-firefox-extension.zip # Firefox
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Chrome/Edge/Chromium:
|
|
155
|
+
|
|
156
|
+
1. Open `chrome://extensions` (Edge: `edge://extensions`).
|
|
157
|
+
2. Enable **Developer mode**.
|
|
158
|
+
3. Choose **Load unpacked** and select the `memory-v2-extension` folder.
|
|
159
|
+
4. Pin the icon and check the API URL in the extension settings.
|
|
160
|
+
|
|
161
|
+
Firefox (experimental):
|
|
162
|
+
|
|
163
|
+
1. Unpack the Firefox ZIP.
|
|
164
|
+
2. Open `about:debugging#/runtime/this-firefox`.
|
|
165
|
+
3. Choose **Load Temporary Add-on** and select `manifest.json`.
|
|
166
|
+
4. For a permanent install, submit the ZIP to `addons.mozilla.org` (AMO);
|
|
167
|
+
Firefox does not install unsigned XPI permanently.
|
|
168
|
+
5. If Firefox asks for access to `127.0.0.1:8002`, allow it.
|
|
169
|
+
|
|
170
|
+
Usage:
|
|
171
|
+
|
|
172
|
+
- select text → right click → **Memory v2.1** → project;
|
|
173
|
+
- type `mem`, press Tab, then `проект Home: text` or
|
|
174
|
+
`save this page to project Home`;
|
|
175
|
+
- click the toolbar icon for a popup with selection/page capture.
|
|
176
|
+
|
|
177
|
+
> A search query typed into Google/Yandex goes to the search engine, not to
|
|
178
|
+
> Memory. Use the context menu, `mem` + Tab, or the popup instead.
|
|
179
|
+
> Firefox is experimental: use the separate Firefox ZIP; permanent install requires AMO signing.
|
|
180
|
+
|
|
181
|
+
See [`extension/README.md`](extension/README.md).
|
|
182
|
+
|
|
183
|
+
## MCP
|
|
184
|
+
|
|
185
|
+
The MCP server lives in `mcp/`. It speaks stdio and uses the Memory HTTP API; it
|
|
186
|
+
never opens the SQLite file directly.
|
|
187
|
+
|
|
188
|
+
```sh
|
|
189
|
+
python3.12 -m venv .venv-mcp
|
|
190
|
+
. .venv-mcp/bin/activate
|
|
191
|
+
pip install -r mcp/requirements.txt
|
|
192
|
+
python mcp/server.py
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Tools:
|
|
196
|
+
|
|
197
|
+
| Tool | Purpose |
|
|
198
|
+
|---|---|
|
|
199
|
+
| `memory_health` | Check API availability |
|
|
200
|
+
| `memory_list_projects` | List projects |
|
|
201
|
+
| `memory_project_context` | Restore a project and its branches |
|
|
202
|
+
| `memory_search` | Search memories and messages |
|
|
203
|
+
| `memory_archive_conversation` | Archive a branch idempotently |
|
|
204
|
+
| `memory_upsert` | Store a fact, decision, constraint or preference |
|
|
205
|
+
| `memory_deprecate` | Retire an old memory, optionally with a replacement |
|
|
206
|
+
|
|
207
|
+
Client configs (Claude Desktop, Claude Code, Cursor, Docker-only) are in
|
|
208
|
+
[`mcp/README.md`](mcp/README.md) and `mcp/examples/`.
|
|
209
|
+
|
|
210
|
+
## API at a glance
|
|
211
|
+
|
|
212
|
+
```http
|
|
213
|
+
GET /health
|
|
214
|
+
GET /projects
|
|
215
|
+
POST /projects
|
|
216
|
+
GET /projects/{id}/context
|
|
217
|
+
POST /conversations/archive
|
|
218
|
+
GET /memories/search?q=...&include_messages=true
|
|
219
|
+
POST /memories/upsert
|
|
220
|
+
POST /memories/{id}/deprecate
|
|
221
|
+
POST /capture
|
|
222
|
+
GET /settings
|
|
223
|
+
PUT /settings
|
|
224
|
+
POST /triggers/preview
|
|
225
|
+
POST /triggers/apply
|
|
226
|
+
GET /diagnostics
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Interactive API reference: `http://127.0.0.1:8002/docs`.
|
|
230
|
+
|
|
231
|
+
Archive requests are idempotent; use a stable `external_id`:
|
|
232
|
+
|
|
233
|
+
```json
|
|
234
|
+
{
|
|
235
|
+
"project_id": 1,
|
|
236
|
+
"title": "Demo / FastAPI async session debugging",
|
|
237
|
+
"source": "demo",
|
|
238
|
+
"external_id": "demo:fastapi:async-session:001",
|
|
239
|
+
"messages": [
|
|
240
|
+
{"role": "user", "content": "..."},
|
|
241
|
+
{"role": "assistant", "content": "..."}
|
|
242
|
+
]
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Data model
|
|
247
|
+
|
|
248
|
+
| Table | Purpose |
|
|
249
|
+
|---|---|
|
|
250
|
+
| `projects` | Shared project container |
|
|
251
|
+
| `conversations` | A dialog branch |
|
|
252
|
+
| `messages` | User/assistant messages |
|
|
253
|
+
| `memories` | Durable facts, decisions, constraints, preferences |
|
|
254
|
+
| `events` | Reserved for future timeline events |
|
|
255
|
+
| `settings` | Language, AI agent, onboarding, triggers, extension status |
|
|
256
|
+
|
|
257
|
+
SQLite FTS5 indexes (`memories_fts_norm`, `messages_fts`) are kept in sync by
|
|
258
|
+
triggers. The schema is in [`migrations/schema.sql`](migrations/schema.sql).
|
|
259
|
+
|
|
260
|
+
## Configuration
|
|
261
|
+
|
|
262
|
+
| Variable | Default | Meaning |
|
|
263
|
+
|---|---|---|
|
|
264
|
+
| `MEMORY_DB` | `data/memory_v2.db` | SQLite database path |
|
|
265
|
+
| `MEMORY_SCHEMA` | `migrations/schema.sql` | Schema for first init |
|
|
266
|
+
| `MEMORY_HOST` | `127.0.0.1` | Listen address |
|
|
267
|
+
| `MEMORY_PORT` | `8002` | Listen port |
|
|
268
|
+
| `MEMORY_API_TOKEN` | empty | Bearer token; empty means loopback-only |
|
|
269
|
+
| `MEMORY_TRUST_BRIDGE` | empty | Set to `1` only for a loopback-published Docker port |
|
|
270
|
+
| `MEMORY_LANGUAGE` | `ru` | Initial UI language (`ru`/`en`) |
|
|
271
|
+
| `MEMORY_LOG_DIR` | `logs` | Log directory |
|
|
272
|
+
|
|
273
|
+
If you expose the API to a LAN, set `MEMORY_API_TOKEN` and use a reverse proxy
|
|
274
|
+
with HTTPS. Never expose an unauthenticated instance to the internet.
|
|
275
|
+
|
|
276
|
+
## Development
|
|
277
|
+
|
|
278
|
+
```sh
|
|
279
|
+
python3.12 -m venv .venv
|
|
280
|
+
. .venv/bin/activate
|
|
281
|
+
pip install -r api/requirements.txt
|
|
282
|
+
pip install -r mcp/requirements.txt
|
|
283
|
+
sh scripts/ci_integration.sh
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
The integration script creates a clean database, starts the API on
|
|
287
|
+
`127.0.0.1:8002`, seeds the fictional demo project and runs the 13-check MCP
|
|
288
|
+
stdio test. The GitHub Actions workflow runs the same script on Python 3.12.
|
|
289
|
+
|
|
290
|
+
Repository layout:
|
|
291
|
+
|
|
292
|
+
```text
|
|
293
|
+
api/ FastAPI application, auth, search, archive, capture, settings
|
|
294
|
+
mcp/ MCP stdio server, HTTP client, 13-check smoke test
|
|
295
|
+
web/ Static UI (HTML/CSS/JS, no build step)
|
|
296
|
+
extension/ Chrome/Edge MV3 extension
|
|
297
|
+
connectors/ OpenCode sync (Windows/Linux) and generic import
|
|
298
|
+
migrations/ SQLite schema and notes
|
|
299
|
+
install/ Docker/venv developer installers
|
|
300
|
+
scripts/ CI, backup, search and health helpers
|
|
301
|
+
docs/ Architecture, testing, integrations, installers
|
|
302
|
+
examples/ Fictional demo seed
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
## Backup
|
|
306
|
+
|
|
307
|
+
The database is the source of truth. Use the SQLite backup API while the API is
|
|
308
|
+
running, or copy the file while it is stopped.
|
|
309
|
+
|
|
310
|
+
```sh
|
|
311
|
+
python3 - <<'PY'
|
|
312
|
+
import sqlite3
|
|
313
|
+
src = sqlite3.connect("data/memory_v2.db")
|
|
314
|
+
dst = sqlite3.connect("data/backup.db")
|
|
315
|
+
src.backup(dst)
|
|
316
|
+
dst.close()
|
|
317
|
+
src.close()
|
|
318
|
+
PY
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
## Security
|
|
322
|
+
|
|
323
|
+
- Loopback-only by default; empty token means non-local clients get `401`.
|
|
324
|
+
- Optional bearer token for LAN/reverse-proxy deployments.
|
|
325
|
+
- Connectors redact common token patterns before archiving, but this is not a
|
|
326
|
+
guarantee. Do not put secrets into prompts or conversation text.
|
|
327
|
+
- Keep backups and restrict file permissions.
|
|
328
|
+
|
|
329
|
+
## Roadmap
|
|
330
|
+
|
|
331
|
+
- [x] Projects, branches, messages, durable memories.
|
|
332
|
+
- [x] FTS5 + Russian morphology.
|
|
333
|
+
- [x] Idempotent archive.
|
|
334
|
+
- [x] Web UI with manual CRUD, triggers, settings and onboarding.
|
|
335
|
+
- [x] MCP server for agent integrations.
|
|
336
|
+
- [x] Chrome/Edge extension.
|
|
337
|
+
- [x] Offline Windows and Linux installers.
|
|
338
|
+
- [x] Firefox extension (experimental; temporary load or AMO signing).
|
|
339
|
+
- [ ] Importers for ChatGPT/Claude/Markdown exports.
|
|
340
|
+
- [ ] Alembic migrations and schema version history.
|
|
341
|
+
- [ ] Code-signed native Windows `.exe` (the current installer is unsigned).
|
|
342
|
+
|
|
343
|
+
## License
|
|
344
|
+
|
|
345
|
+
MIT. See [`LICENSE`](LICENSE). The license can be switched to Apache-2.0 before
|
|
346
|
+
a stable release.
|