memocat-mcp 0.4.0__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.
- memocat_mcp-0.4.0/.gitignore +21 -0
- memocat_mcp-0.4.0/CHANGELOG.md +32 -0
- memocat_mcp-0.4.0/Dockerfile +17 -0
- memocat_mcp-0.4.0/LICENSE +21 -0
- memocat_mcp-0.4.0/PKG-INFO +374 -0
- memocat_mcp-0.4.0/README.md +338 -0
- memocat_mcp-0.4.0/compose.yaml +37 -0
- memocat_mcp-0.4.0/memocat_mcp/__init__.py +11 -0
- memocat_mcp-0.4.0/memocat_mcp/bootstrap.py +754 -0
- memocat_mcp-0.4.0/memocat_mcp/server.py +1496 -0
- memocat_mcp-0.4.0/memocat_mcp/watch.py +387 -0
- memocat_mcp-0.4.0/pyproject.toml +100 -0
- memocat_mcp-0.4.0/tests/__init__.py +0 -0
- memocat_mcp-0.4.0/tests/conftest.py +70 -0
- memocat_mcp-0.4.0/tests/test_bootstrap_unit.py +485 -0
- memocat_mcp-0.4.0/tests/test_errors_unit.py +294 -0
- memocat_mcp-0.4.0/tests/test_governance_unit.py +241 -0
- memocat_mcp-0.4.0/tests/test_lifecycle_unit.py +335 -0
- memocat_mcp-0.4.0/tests/test_live_governance.py +136 -0
- memocat_mcp-0.4.0/tests/test_live_governance_matrix.py +449 -0
- memocat_mcp-0.4.0/tests/test_live_hybrid.py +162 -0
- memocat_mcp-0.4.0/tests/test_live_protocol.py +112 -0
- memocat_mcp-0.4.0/tests/test_live_vector_parity.py +72 -0
- memocat_mcp-0.4.0/tests/test_live_watch.py +116 -0
- memocat_mcp-0.4.0/tests/test_resource_sessions_unit.py +67 -0
- memocat_mcp-0.4.0/tests/test_stamp_unit.py +66 -0
- memocat_mcp-0.4.0/tests/test_watch_unit.py +305 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to MemoCat MCP are documented here.
|
|
4
|
+
|
|
5
|
+
## 0.4.0 — Unreleased
|
|
6
|
+
|
|
7
|
+
First public release (planned).
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Nineteen MCP tools for semantic memory, exact recall, bulk operations,
|
|
12
|
+
keyspace lifecycle, governance, semantic management, snapshots, and live
|
|
13
|
+
memory-change watches.
|
|
14
|
+
- Hybrid semantic retrieval with metadata and indexed time-range filtering.
|
|
15
|
+
- Automatic `_created_at` timestamps for temporal agent memory.
|
|
16
|
+
- Persistent, in-memory, private-scope, and shared-scope memory routing.
|
|
17
|
+
- MCP resources with live `resources/updated` notifications.
|
|
18
|
+
- Delegated-owner policy view, explanation, history, provisioning, removal,
|
|
19
|
+
semantic management, and snapshot management.
|
|
20
|
+
- Revocation-aware authorization leases that close watches and purge buffered
|
|
21
|
+
data after access loss.
|
|
22
|
+
- Native engine discovery and verified platform-package bootstrap, with Docker
|
|
23
|
+
fallback.
|
|
24
|
+
- Precomputed-vector memory writes and queries, external-vector profile
|
|
25
|
+
enrollment, semantic status inspection, and semantic re-embedding.
|
|
26
|
+
|
|
27
|
+
### Security
|
|
28
|
+
|
|
29
|
+
- Engine-enforced cross-owner isolation and a 24-scenario live governance
|
|
30
|
+
acceptance matrix.
|
|
31
|
+
- Safe keyspace removal that releases subscriptions before engine teardown.
|
|
32
|
+
- Mandatory SHA-256 verification for downloaded engine packages.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# syntax=docker/dockerfile:1
|
|
2
|
+
# MCP is a stdio server, not an HTTP service. Run this image with `-i` (or via
|
|
3
|
+
# `docker compose run -T mcp`) and keep Montycat in the companion service.
|
|
4
|
+
FROM python:3.12-slim
|
|
5
|
+
|
|
6
|
+
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
7
|
+
PYTHONUNBUFFERED=1 \
|
|
8
|
+
MEMOCAT_AUTOSTART=off
|
|
9
|
+
|
|
10
|
+
WORKDIR /app
|
|
11
|
+
|
|
12
|
+
COPY pyproject.toml README.md ./
|
|
13
|
+
COPY memocat_mcp ./memocat_mcp
|
|
14
|
+
|
|
15
|
+
RUN pip install --no-cache-dir .
|
|
16
|
+
|
|
17
|
+
ENTRYPOINT ["memocat-mcp"]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 MontyGovernance
|
|
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,374 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: memocat-mcp
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: MCP server for self-hosted AI agent memory, semantic search, vector RAG, and Montycat.
|
|
5
|
+
Project-URL: Homepage, https://montygovernance.com
|
|
6
|
+
Project-URL: Documentation, https://montygovernance.com/docs
|
|
7
|
+
Project-URL: Repository, https://github.com/MontyGovernance/meow_memory_mcp
|
|
8
|
+
Project-URL: Issues, https://github.com/MontyGovernance/meow_memory_mcp/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/MontyGovernance/meow_memory_mcp/blob/main/CHANGELOG.md
|
|
10
|
+
Author: MontyGovernance
|
|
11
|
+
Maintainer: MontyGovernance
|
|
12
|
+
License-Expression: MIT
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Keywords: agent-memory,ai-agents,ai-memory,chatgpt,claude,claude-desktop,cursor,data-governance,embeddings,fastmcp,llm,long-term-memory,mcp,mcp-server,memory-server,model-context-protocol,montycat,nosql,rag,retrieval-augmented-generation,self-hosted,semantic-search,vector-database,vector-search
|
|
15
|
+
Classifier: Development Status :: 4 - Beta
|
|
16
|
+
Classifier: Environment :: Console
|
|
17
|
+
Classifier: Framework :: AsyncIO
|
|
18
|
+
Classifier: Intended Audience :: Developers
|
|
19
|
+
Classifier: Operating System :: OS Independent
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
26
|
+
Classifier: Topic :: Database
|
|
27
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
28
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
29
|
+
Requires-Python: >=3.10
|
|
30
|
+
Requires-Dist: mcp[cli]<2,>=1.2.0
|
|
31
|
+
Requires-Dist: montycat<2,>=1.2.2
|
|
32
|
+
Provides-Extra: test
|
|
33
|
+
Requires-Dist: pytest-asyncio>=0.24; extra == 'test'
|
|
34
|
+
Requires-Dist: pytest>=8; extra == 'test'
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
|
|
37
|
+
# MemoCat MCP Server — Self-Hosted AI Agent Memory and Vector RAG
|
|
38
|
+
|
|
39
|
+
[](https://pypi.org/project/memocat-mcp/)
|
|
40
|
+
[](https://pypi.org/project/memocat-mcp/)
|
|
41
|
+
[](https://github.com/MontyGovernance/meow_memory_mcp/blob/main/LICENSE)
|
|
42
|
+
|
|
43
|
+
**MemoCat is a self-hosted MCP memory server for Claude Desktop, Cursor,
|
|
44
|
+
ChatGPT integrations, and autonomous AI agents.** It gives MCP clients private,
|
|
45
|
+
persistent, semantically searchable long-term memory. `memocat-mcp` is a
|
|
46
|
+
[Model Context Protocol](https://modelcontextprotocol.io) server for
|
|
47
|
+
[Montycat](https://montygovernance.com), combining AI agent memory, semantic
|
|
48
|
+
search, vector RAG, and NoSQL storage in one self-hosted service.
|
|
49
|
+
|
|
50
|
+
Memories are embedded on-device and recalled by meaning, metadata, timestamp,
|
|
51
|
+
or exact key. No cloud vector database, external embedding API, or per-query
|
|
52
|
+
bill.
|
|
53
|
+
|
|
54
|
+
## Features
|
|
55
|
+
|
|
56
|
+
- Self-hosted long-term memory for MCP-compatible AI agents.
|
|
57
|
+
- Semantic vector search with metadata and time-range filtering for RAG.
|
|
58
|
+
- Persistent memory, in-memory working spaces, bulk writes, updates, and deletion.
|
|
59
|
+
- Real-time memory-change subscriptions without database polling.
|
|
60
|
+
- Multi-agent scopes, shared memory, delegated-owner governance, and policy explanations.
|
|
61
|
+
- Keyspace lifecycle, semantic-model controls, snapshots, and revocation-safe watch buffers.
|
|
62
|
+
- One-command `uvx memocat-mcp` entry point with native/Docker engine bootstrap.
|
|
63
|
+
|
|
64
|
+
## Why
|
|
65
|
+
|
|
66
|
+
LLM agents forget context between runs. MemoCat stores each fact in Montycat,
|
|
67
|
+
embeds and indexes it automatically, and retrieves relevant memories through 22
|
|
68
|
+
agent-readable MCP tools. It is both a retrieval layer for RAG and a durable
|
|
69
|
+
memory layer for autonomous agents.
|
|
70
|
+
|
|
71
|
+
## Quick start
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
uvx memocat-mcp
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
MemoCat reuses a configured Montycat Semantic engine or attempts the supported
|
|
78
|
+
native/Docker bootstrap path. For an existing engine:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
export MONTYCAT_URI="montycat://memory-agent:password@localhost:21210/memories"
|
|
82
|
+
uvx memocat-mcp
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Tools
|
|
86
|
+
|
|
87
|
+
| Tool | What it does |
|
|
88
|
+
|------|--------------|
|
|
89
|
+
| `memocat_semantic_search` | Recall by **meaning** (vector kNN), with text or a supplied query vector. |
|
|
90
|
+
| `memocat_remember` | Store a fact/record; embedded automatically or indexed with a supplied vector. |
|
|
91
|
+
| `memocat_remember_bulk` | Store many memories at once. |
|
|
92
|
+
| `memocat_recall` | Fetch by exact key or by field filter. |
|
|
93
|
+
| `memocat_list_memories` | Browse / list stored memories (optionally most-recent first). |
|
|
94
|
+
| `memocat_update` | Revise a memory in place — memory is mutable. |
|
|
95
|
+
| `memocat_forget` | Delete a stored record. |
|
|
96
|
+
| `memocat_list_keyspaces` | Discover available memory namespaces. |
|
|
97
|
+
| `memocat_create_keyspace` | Provision a new memory namespace. |
|
|
98
|
+
| `memocat_remove_keyspace` | Permanently remove an authorized memory namespace with safe watch cleanup. |
|
|
99
|
+
| `memocat_enable_semantic` | Enable semantic search and backfill one authorized keyspace. |
|
|
100
|
+
| `memocat_enable_external_vectors` | Enroll one keyspace for caller-supplied vectors and a named embedding space. |
|
|
101
|
+
| `memocat_semantic_status` | Inspect semantic configuration and backfill state. |
|
|
102
|
+
| `memocat_reembed_semantic` | Replace an enrolled text embedding model and backfill the keyspace. |
|
|
103
|
+
| `memocat_disable_semantic` | Disable semantic search for one authorized keyspace. |
|
|
104
|
+
| `memocat_start_snapshots` | Start scheduled snapshots for one authorized in-memory keyspace. |
|
|
105
|
+
| `memocat_stop_snapshots` | Stop scheduled snapshots for one authorized in-memory keyspace. |
|
|
106
|
+
| `memocat_clean_snapshots` | Delete snapshot files for one authorized in-memory keyspace. |
|
|
107
|
+
| `memocat_policy_view` | View the configured owner's effective governance policy and constraints. |
|
|
108
|
+
| `memocat_policy_explain` | Explain whether a proposed governed action is allowed and why. |
|
|
109
|
+
| `memocat_policy_history` | View governance history visible to the configured owner. |
|
|
110
|
+
| `memocat_await_memory_change` | **Wait for memory to change** — returns the moment another agent or session writes. Live subscription, not polling. |
|
|
111
|
+
|
|
112
|
+
## Real-time memory watch
|
|
113
|
+
|
|
114
|
+
Other memory servers can only be polled: ask again, and again, in case something
|
|
115
|
+
changed. Montycat has **native live subscriptions**, so this one pushes.
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
agent B: memocat_await_memory_change(scope="shared", timeout_sec=60)
|
|
119
|
+
⏳ sleeps — no polling, no wasted tokens
|
|
120
|
+
agent A: memocat_remember({"text": "the deploy key rotated"}, scope="shared")
|
|
121
|
+
agent B: ← returns in milliseconds with the key, the value, and the event
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Two agents, one shared scope, one notices what the other just learned. Pass the
|
|
125
|
+
returned `next_seq` back as `since_seq` to resume exactly where you left off —
|
|
126
|
+
changes that happen between calls are buffered, not lost.
|
|
127
|
+
|
|
128
|
+
Memory namespaces are also exposed as MCP **resources**
|
|
129
|
+
(`memocat://memory/<keyspace>`) with `resources.subscribe` support, so clients
|
|
130
|
+
that implement resource subscriptions get `notifications/resources/updated`
|
|
131
|
+
pushed to them as well. Both surfaces share one engine subscription.
|
|
132
|
+
|
|
133
|
+
Subscriptions open on demand and close when idle
|
|
134
|
+
(`MONTYCAT_WATCH_IDLE_TIMEOUT`), so users who never watch pay nothing.
|
|
135
|
+
|
|
136
|
+
## Requirements
|
|
137
|
+
|
|
138
|
+
- Python 3.10+ through `uv` / `uvx`.
|
|
139
|
+
- Access to a **Montycat Semantic** engine. `uvx memocat-mcp` first reuses an
|
|
140
|
+
existing engine, then attempts the supported native/platform installation
|
|
141
|
+
path, and finally falls back to Docker. Semantic search is enabled by default
|
|
142
|
+
in the Semantic edition.
|
|
143
|
+
|
|
144
|
+
To start the engine manually with Docker, pick the tag for your CPU—the tag
|
|
145
|
+
carries the architecture:
|
|
146
|
+
|
|
147
|
+
**Apple Silicon (M1/M2/M3/M4) — use `arm64-semantic`:**
|
|
148
|
+
```bash
|
|
149
|
+
docker run -d --name montycat -p 21210:21210 -p 21211:21211 \
|
|
150
|
+
-e MONTYCAT_SUPEROWNER="admin" -e MONTYCAT_PASSWORD="change-me" \
|
|
151
|
+
-v montycat_data:/var/lib/.montycat \
|
|
152
|
+
montygovernance/montycat:arm64-semantic
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Intel / AMD (x86_64) — use `semantic`:**
|
|
156
|
+
```bash
|
|
157
|
+
docker run -d --name montycat -p 21210:21210 -p 21211:21211 \
|
|
158
|
+
-e MONTYCAT_SUPEROWNER="admin" -e MONTYCAT_PASSWORD="change-me" \
|
|
159
|
+
-v montycat_data:/var/lib/.montycat \
|
|
160
|
+
montygovernance/montycat:semantic
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
> On Apple Silicon the plain `semantic` tag is the amd64 image and runs under
|
|
164
|
+
> emulation, where the embedding runtime's warm-up crashes. Use
|
|
165
|
+
> `arm64-semantic` — a native build, not a workaround. Unsure which you have?
|
|
166
|
+
> `uname -m` prints `arm64` on Apple Silicon and `x86_64` on Intel.
|
|
167
|
+
|
|
168
|
+
Port `21211` is the subscription server and is required for
|
|
169
|
+
`memocat_await_memory_change` (real-time watch); without it the other tools
|
|
170
|
+
still work.
|
|
171
|
+
|
|
172
|
+
## Docker Compose deployment
|
|
173
|
+
|
|
174
|
+
Use Compose when you want a reproducible local deployment with a persistent
|
|
175
|
+
Semantic engine and an MCP container on the same private Docker network. Docker
|
|
176
|
+
is optional when you already manage a reachable Montycat server.
|
|
177
|
+
|
|
178
|
+
Create a `.env` file beside `compose.yaml`:
|
|
179
|
+
|
|
180
|
+
```dotenv
|
|
181
|
+
MONTYCAT_USERNAME=admin
|
|
182
|
+
MONTYCAT_PASSWORD=replace-with-a-strong-password
|
|
183
|
+
MONTYCAT_STORE=memories
|
|
184
|
+
# Apple Silicon: arm64-semantic. Intel/AMD64: semantic.
|
|
185
|
+
MONTYCAT_IMAGE_TAG=semantic
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Start the engine and build the MCP image:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
docker compose up -d montycat
|
|
192
|
+
docker compose build mcp
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
The image installs the released `montycat>=1.2.2,<2` Python client declared in
|
|
196
|
+
the package metadata.
|
|
197
|
+
|
|
198
|
+
The engine data is stored in the named `montycat_data` volume. Ports `21210`
|
|
199
|
+
and `21211` are published for debugging and external clients; the MCP container
|
|
200
|
+
uses the private `montycat:21210` network address. Credentials are passed as
|
|
201
|
+
separate environment variables, so passwords with URL-special characters need
|
|
202
|
+
no URL encoding. Port `21211` carries live subscription traffic for
|
|
203
|
+
`memocat_await_memory_change`.
|
|
204
|
+
|
|
205
|
+
MCP uses stdio, so do **not** run it as a web service. Configure a desktop MCP
|
|
206
|
+
client to invoke the Compose service on demand:
|
|
207
|
+
|
|
208
|
+
```json
|
|
209
|
+
{
|
|
210
|
+
"mcpServers": {
|
|
211
|
+
"memocat": {
|
|
212
|
+
"command": "docker",
|
|
213
|
+
"args": [
|
|
214
|
+
"compose",
|
|
215
|
+
"-f", "/absolute/path/to/montycat_mcp/compose.yaml",
|
|
216
|
+
"run", "--rm", "-T", "mcp"
|
|
217
|
+
]
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
For Apple Silicon set `MONTYCAT_IMAGE_TAG=arm64-semantic` in `.env`; the plain
|
|
224
|
+
`semantic` image is AMD64. Stop the stack with `docker compose down`; include
|
|
225
|
+
`-v` only when you intentionally want to erase persisted memories.
|
|
226
|
+
|
|
227
|
+
### Engine auto-start
|
|
228
|
+
|
|
229
|
+
MemoCat first reuses an engine already reachable through `MONTYCAT_URI` or the
|
|
230
|
+
host/port settings. If none is running, it looks for an installed
|
|
231
|
+
`montycat_bin` and then attempts the official platform route:
|
|
232
|
+
|
|
233
|
+
| Platform | Route | If it cannot complete |
|
|
234
|
+
|---|---|---|
|
|
235
|
+
| macOS Apple Silicon | Discover and download the latest verified `montycat-semantic_<version>_arm64.pkg`, open Installer, and wait for installation (may prompt for admin approval) | Docker |
|
|
236
|
+
| macOS Intel | No Semantic package currently published | Docker |
|
|
237
|
+
| Windows x86_64 | Download verified `.msi` and invoke Windows Installer (may prompt for UAC) | Docker |
|
|
238
|
+
| Linux AMD64 | Run the official one-command APT setup for `montycat-semantic` (may prompt for sudo) | Docker |
|
|
239
|
+
| Other platforms | — | Docker |
|
|
240
|
+
|
|
241
|
+
MemoCat asks the shared Montycat release catalog for the current Semantic
|
|
242
|
+
artifact for macOS or Windows. Artifact URLs are treated as opaque, and the
|
|
243
|
+
package's adjacent `.sha256` is required and verified before Installer opens;
|
|
244
|
+
verified packages are cached by filename. If catalog discovery is unavailable,
|
|
245
|
+
automatic native installation falls through to Docker instead of silently
|
|
246
|
+
installing an older package.
|
|
247
|
+
Override the URL with `MEMOCAT_INSTALLER_URL`, pin a release with
|
|
248
|
+
`MEMOCAT_ENGINE_VERSION`, or adjust the Installer completion budget with
|
|
249
|
+
`MEMOCAT_INSTALLER_TIMEOUT`. On Linux, set
|
|
250
|
+
`MEMOCAT_APT_INSTALL_COMMAND` to use an organization-managed mirror or package
|
|
251
|
+
command. ARM64 Linux goes directly to Docker because the official APT repository
|
|
252
|
+
is AMD64-only. Set `MEMOCAT_AUTOSTART=off` to disable all installation/start
|
|
253
|
+
attempts.
|
|
254
|
+
|
|
255
|
+
## Use with Claude Desktop / Cursor
|
|
256
|
+
|
|
257
|
+
Add to your MCP client config (e.g. `claude_desktop_config.json`):
|
|
258
|
+
|
|
259
|
+
```json
|
|
260
|
+
{
|
|
261
|
+
"mcpServers": {
|
|
262
|
+
"memocat": {
|
|
263
|
+
"command": "uvx",
|
|
264
|
+
"args": ["memocat-mcp"],
|
|
265
|
+
"env": {
|
|
266
|
+
"MONTYCAT_URI": "montycat://memory-agent:agent-password@localhost:21210/mystore"
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Use a delegated Montycat owner such as `memory-agent` for the MCP process.
|
|
274
|
+
Grant that owner only the keyspace read/write and provisioning capabilities its
|
|
275
|
+
agent needs. Keep the superowner credential in a separate bootstrap or
|
|
276
|
+
governance-administration workflow.
|
|
277
|
+
|
|
278
|
+
The read-only `memocat_policy_view`, `memocat_policy_explain`, and
|
|
279
|
+
`memocat_policy_history` tools expose policy information for the authenticated
|
|
280
|
+
owner. They do not accept an owner override and cannot grant, revoke, deny, or
|
|
281
|
+
otherwise mutate policy. When automatic keyspace provisioning fails, MemoCat
|
|
282
|
+
also requests a read-only policy explanation and appends it to the original
|
|
283
|
+
engine error when available.
|
|
284
|
+
|
|
285
|
+
`memocat_remove_keyspace` is destructive and remains engine-authorized. A
|
|
286
|
+
delegated owner may remove a keyspace through creator authority or an explicit
|
|
287
|
+
`remove-keyspace` grant unless policy contains an overriding denial. MemoCat
|
|
288
|
+
closes active watches and releases resource subscriptions before requesting
|
|
289
|
+
removal.
|
|
290
|
+
|
|
291
|
+
Semantic management is always keyspace-scoped. The MCP server does not expose
|
|
292
|
+
database-wide semantic controls; Montycat checks `manage-semantic`, creator
|
|
293
|
+
authority, denials, and model allow-lists for every enable or disable request.
|
|
294
|
+
|
|
295
|
+
Snapshot tools are likewise keyspace-scoped and work only with in-memory
|
|
296
|
+
keyspaces. MemoCat does not expose the global snapshot-rate setting. A
|
|
297
|
+
`Snapshot rate is not set` response means scheduling has not been configured
|
|
298
|
+
on the engine; it is distinct from a governance denial.
|
|
299
|
+
|
|
300
|
+
Active watches use short authorization leases because the current engine checks
|
|
301
|
+
read authority when a subscription opens but does not terminate that connection
|
|
302
|
+
after a later revocation. MemoCat revalidates against the engine's filtered
|
|
303
|
+
structure view, closes the subscription on access loss, removes MCP resource
|
|
304
|
+
ownership, wakes pending callers with an error, and permanently purges buffered
|
|
305
|
+
changes so they cannot be replayed after access is restored.
|
|
306
|
+
|
|
307
|
+
## Configuration
|
|
308
|
+
|
|
309
|
+
| Variable | Default | Purpose |
|
|
310
|
+
|----------|---------|---------|
|
|
311
|
+
| `MONTYCAT_URI` | — | `montycat://user:pass@host:port/store` (preferred; overrides the parts below) |
|
|
312
|
+
| `MONTYCAT_HOST` | `127.0.0.1` | Engine host |
|
|
313
|
+
| `MONTYCAT_PORT` | `21210` | Engine port |
|
|
314
|
+
| `MONTYCAT_USERNAME` / `MONTYCAT_PASSWORD` | — | Credentials |
|
|
315
|
+
| `MONTYCAT_STORE` | — | Store name |
|
|
316
|
+
| `MONTYCAT_TLS` | `false` | Connect over TLS |
|
|
317
|
+
| `MONTYCAT_DEFAULT_KEYSPACE` | `memory` | Keyspace used when a tool omits scope/keyspace |
|
|
318
|
+
| `MONTYCAT_PERSISTENT` | `true` | Storage type for **newly created** keyspaces (durable vs in-memory). Existing keyspaces are auto-detected — the server binds the correct type regardless of this setting. |
|
|
319
|
+
| `MONTYCAT_SCOPE` | — | Default owner/scope, applied when a tool omits `scope` |
|
|
320
|
+
| `MONTYCAT_SCOPE_PREFIX` | `mem_` | Prefix for per-owner keyspaces (`mem_<scope>`) |
|
|
321
|
+
| `MONTYCAT_SHARED_KEYSPACE` | `mem_shared` | The common/shared keyspace name |
|
|
322
|
+
| `MONTYCAT_AUTO_PROVISION` | `true` | Auto-create a scope's keyspace on first use. Requires `provision-keyspace` authority for the configured owner and requested storage/model constraints. |
|
|
323
|
+
| `MONTYCAT_AUTO_TIMESTAMP` | `true` | Stamp each memory with an indexed `_created_at`, enabling time-range recall (`since`/`until`). Costs a server-side timestamp parse per write — turn off if memories are never recalled by time. |
|
|
324
|
+
| `MONTYCAT_SUBSCRIPTION_PORT` | main + 1 | Engine subscription server port (21211 by default; enabled by default) |
|
|
325
|
+
| `MONTYCAT_WATCH_BUFFER` | `500` | Changes retained per watched keyspace, so changes between calls aren't lost |
|
|
326
|
+
| `MONTYCAT_WATCH_IDLE_TIMEOUT` | `300` | Seconds before an unused subscription is closed |
|
|
327
|
+
| `MONTYCAT_WATCH_AUTH_LEASE_SEC` | `5` | Seconds between read-authority checks for active watches. Access loss closes the subscription and purges buffered changes. |
|
|
328
|
+
| `MONTYCAT_WATCH_AUTH_TIMEOUT_SEC` | `10` | Maximum seconds allowed for one watch authorization check. A failed check closes the watch safely. |
|
|
329
|
+
|
|
330
|
+
`memocat_create_keyspace` works with delegated-owner credentials when policy
|
|
331
|
+
grants `provision-keyspace` for the requested store, storage type, and semantic
|
|
332
|
+
model. `memocat_forget` deletes one record and requires write authority for its
|
|
333
|
+
keyspace. The engine makes every final authorization decision.
|
|
334
|
+
|
|
335
|
+
## Memory scoping (multi-tenant)
|
|
336
|
+
|
|
337
|
+
Pass `scope` (an owner/user id) to any memory tool to isolate that owner's
|
|
338
|
+
memory. Because Montycat's semantic search runs per keyspace, each scope gets its
|
|
339
|
+
own keyspace `mem_<scope>` — so semantic recall for one owner never sees another
|
|
340
|
+
owner's memories:
|
|
341
|
+
|
|
342
|
+
```
|
|
343
|
+
remember(value={"fact": "..."}, scope="alice") # -> keyspace mem_alice
|
|
344
|
+
semantic_search(query="...", scope="alice") # searches only mem_alice
|
|
345
|
+
remember(value={"fact": "..."}, scope="shared") # -> the shared keyspace
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
- **Per-owner private memory** — `scope="<owner>"` → `mem_<owner>`, auto-created
|
|
349
|
+
on first use when the configured owner has provisioning authority.
|
|
350
|
+
- **Shared/common memory** — `scope="shared"` → the `MONTYCAT_SHARED_KEYSPACE`.
|
|
351
|
+
- **Group memory** — use a group id as the scope (e.g. `scope="team_eng"`).
|
|
352
|
+
- **Single-tenant** — set `MONTYCAT_SCOPE` once and omit `scope` per call.
|
|
353
|
+
|
|
354
|
+
This maps onto Montycat's keyspace governance. In production, run one server
|
|
355
|
+
instance per agent or service with delegated-owner credentials and grant only
|
|
356
|
+
the provisioning and data authority it needs.
|
|
357
|
+
|
|
358
|
+
**Isolation note:** `scope` is routing convenience, not authenticated identity.
|
|
359
|
+
With one server instance sharing one connection, scopes provide logical
|
|
360
|
+
keyspace organization. For credential-enforced isolation, run one server
|
|
361
|
+
instance per owner with that owner's delegated credentials; the engine then
|
|
362
|
+
denies cross-owner access. Reserve superowner credentials for bootstrap and
|
|
363
|
+
governance administration.
|
|
364
|
+
|
|
365
|
+
## Links
|
|
366
|
+
|
|
367
|
+
- Montycat: https://montygovernance.com
|
|
368
|
+
- Docs: https://montygovernance.com/docs
|
|
369
|
+
- Engine on Docker Hub: https://hub.docker.com/r/montygovernance/montycat
|
|
370
|
+
- Python client (PyPI): https://pypi.org/project/montycat/
|
|
371
|
+
|
|
372
|
+
## License
|
|
373
|
+
|
|
374
|
+
MIT.
|