memoryintelligence-mcp 0.2.4__tar.gz → 0.2.5__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.

Potentially problematic release.


This version of memoryintelligence-mcp might be problematic. Click here for more details.

Files changed (23) hide show
  1. {memoryintelligence_mcp-0.2.4 → memoryintelligence_mcp-0.2.5}/CHANGELOG.md +26 -0
  2. {memoryintelligence_mcp-0.2.4 → memoryintelligence_mcp-0.2.5}/PKG-INFO +2 -2
  3. {memoryintelligence_mcp-0.2.4 → memoryintelligence_mcp-0.2.5}/pyproject.toml +7 -2
  4. {memoryintelligence_mcp-0.2.4 → memoryintelligence_mcp-0.2.5}/src/mi_mcp/__init__.py +1 -1
  5. {memoryintelligence_mcp-0.2.4 → memoryintelligence_mcp-0.2.5}/src/mi_mcp/config.py +45 -0
  6. {memoryintelligence_mcp-0.2.4 → memoryintelligence_mcp-0.2.5}/src/mi_mcp/server.py +27 -13
  7. {memoryintelligence_mcp-0.2.4 → memoryintelligence_mcp-0.2.5}/.gitignore +0 -0
  8. {memoryintelligence_mcp-0.2.4 → memoryintelligence_mcp-0.2.5}/CONTRIBUTING.md +0 -0
  9. {memoryintelligence_mcp-0.2.4 → memoryintelligence_mcp-0.2.5}/LICENSE +0 -0
  10. {memoryintelligence_mcp-0.2.4 → memoryintelligence_mcp-0.2.5}/README.md +0 -0
  11. {memoryintelligence_mcp-0.2.4 → memoryintelligence_mcp-0.2.5}/src/mi_mcp/__main__.py +0 -0
  12. {memoryintelligence_mcp-0.2.4 → memoryintelligence_mcp-0.2.5}/src/mi_mcp/cli.py +0 -0
  13. {memoryintelligence_mcp-0.2.4 → memoryintelligence_mcp-0.2.5}/src/mi_mcp/client.py +0 -0
  14. {memoryintelligence_mcp-0.2.4 → memoryintelligence_mcp-0.2.5}/src/mi_mcp/embedder.py +0 -0
  15. {memoryintelligence_mcp-0.2.4 → memoryintelligence_mcp-0.2.5}/src/mi_mcp/indexer.py +0 -0
  16. {memoryintelligence_mcp-0.2.4 → memoryintelligence_mcp-0.2.5}/src/mi_mcp/keys.py +0 -0
  17. {memoryintelligence_mcp-0.2.4 → memoryintelligence_mcp-0.2.5}/src/mi_mcp/local_index.py +0 -0
  18. {memoryintelligence_mcp-0.2.4 → memoryintelligence_mcp-0.2.5}/src/mi_mcp/localreads.py +0 -0
  19. {memoryintelligence_mcp-0.2.4 → memoryintelligence_mcp-0.2.5}/src/mi_mcp/paths.py +0 -0
  20. {memoryintelligence_mcp-0.2.4 → memoryintelligence_mcp-0.2.5}/src/mi_mcp/recall_guard.py +0 -0
  21. {memoryintelligence_mcp-0.2.4 → memoryintelligence_mcp-0.2.5}/src/mi_mcp/scrub.py +0 -0
  22. {memoryintelligence_mcp-0.2.4 → memoryintelligence_mcp-0.2.5}/src/mi_mcp/umo_format.py +0 -0
  23. {memoryintelligence_mcp-0.2.4 → memoryintelligence_mcp-0.2.5}/src/mi_mcp/vault.py +0 -0
@@ -3,6 +3,32 @@
3
3
  All notable changes to `memoryintelligence-mcp` are documented here.
4
4
  The format follows [Keep a Changelog](https://keepachangelog.com/); this project uses [Semantic Versioning](https://semver.org/).
5
5
 
6
+ ## [0.2.5] — 2026-07-24
7
+
8
+ ### Fixed — capture now works on Claude Desktop / claude.ai connector / Cowork
9
+ Capture (`mi_capture`/`mi_upload`) was silently blocked on GUI and remote
10
+ surfaces. The write-consent gate keys on the server's working directory, but
11
+ those launchers spawn the server at the filesystem root (`/`) with no project
12
+ folder — so the per-folder allowlist could never match, and running `mi-mcp
13
+ setup` in a project folder didn't help (the server isn't running from there).
14
+ Claude Desktop was already accommodated via a wired `MI_MCP_OPT_IN_ALL=1`, but
15
+ the claude.ai connector is configured outside `mi-mcp wire` and so had no way to
16
+ satisfy the gate at all.
17
+
18
+ Now the gate recognizes "no project working directory" (a root cwd) as a
19
+ **surface-level consent** case: capture is allowed and tagged with a
20
+ `claude-connector` provenance source, so it's identifiable. This mirrors the
21
+ existing Desktop behavior but is derived at runtime, so it covers every
22
+ GUI/remote surface automatically. Reads were never gated. Editor surfaces
23
+ (Code/Cursor launched inside a real folder) keep per-folder consent unchanged,
24
+ and `MI_MCP_STRICT_CWD=1` restores strict folder gating on every surface for
25
+ anyone who wants it. The blocked-capture message is now plain-language.
26
+
27
+ ### Changed — pinned the dev linter (`ruff==0.15.22`)
28
+ `[dev]` pulled the latest ruff, whose newer rules flagged pre-existing code and
29
+ reddened the public mirror's CI on every push. Pinned in lockstep with the
30
+ monorepo (#1163); no runtime effect.
31
+
6
32
  ## [0.2.4] — 2026-07-24
7
33
 
8
34
  Proof surface + recall trust + upload honesty. No setup change (no re-`wire` —
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: memoryintelligence-mcp
3
- Version: 0.2.4
3
+ Version: 0.2.5
4
4
  Summary: MCP server for MemoryIntelligence — give Claude a memory you own, set up in one command
5
5
  Project-URL: Homepage, https://memoryintelligence.io
6
6
  Project-URL: Repository, https://github.com/somewhere11/memoryintelligence-mcp
@@ -30,7 +30,7 @@ Requires-Dist: fastembed<1.0,>=0.3.0; extra == 'dev'
30
30
  Requires-Dist: numpy<3,>=1.24; extra == 'dev'
31
31
  Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
32
32
  Requires-Dist: pytest>=8.0; extra == 'dev'
33
- Requires-Dist: ruff>=0.4.0; extra == 'dev'
33
+ Requires-Dist: ruff==0.15.22; extra == 'dev'
34
34
  Provides-Extra: local
35
35
  Requires-Dist: cryptography<46,>=42.0; extra == 'local'
36
36
  Requires-Dist: fastembed<1.0,>=0.3.0; extra == 'local'
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "memoryintelligence-mcp"
7
- version = "0.2.4"
7
+ version = "0.2.5"
8
8
  description = "MCP server for MemoryIntelligence — give Claude a memory you own, set up in one command"
9
9
  readme = "README.md"
10
10
  license = "Apache-2.0"
@@ -50,7 +50,12 @@ local = [
50
50
  dev = [
51
51
  "pytest>=8.0",
52
52
  "pytest-asyncio>=0.24",
53
- "ruff>=0.4.0",
53
+ # Pinned, matching the monorepo (#1163): an unpinned ruff pulls the latest
54
+ # release, and 0.16 turned on rules (e.g. PLW1510) that flag pre-existing
55
+ # code the shipped `ruff check src/` never linted before — reddening the
56
+ # public mirror's CI on every push. Bump deliberately, in lockstep with the
57
+ # monorepo, never implicitly.
58
+ "ruff==0.15.22",
54
59
  "cryptography>=42.0,<46",
55
60
  "numpy>=1.24,<3",
56
61
  "fastembed>=0.3.0,<1.0",
@@ -1,3 +1,3 @@
1
1
  """MI MCP Server — MemoryIntelligence tools for Claude."""
2
2
 
3
- __version__ = "0.2.4"
3
+ __version__ = "0.2.5"
@@ -164,3 +164,48 @@ def is_cwd_opted_in(cwd: str | None = None, patterns: list[str] | None = None) -
164
164
  if cwd_abs == base or cwd_abs.startswith(base + os.sep):
165
165
  return True
166
166
  return False
167
+
168
+
169
+ def cwd_has_project_context(cwd: str | None = None) -> bool:
170
+ """False when the server has no project working directory.
171
+
172
+ GUI / remote launchers — Claude Desktop, the claude.ai connector, Cowork —
173
+ spawn the server at the filesystem ROOT (``/``). There is no project folder,
174
+ so the per-folder consent allowlist has no signal to act on. Editor surfaces
175
+ (Code / Cursor launched inside a folder) DO carry project context.
176
+
177
+ Root is detected cross-platform via ``dirname(p) == p`` (true for ``/`` and a
178
+ Windows drive root); realpath first so a symlinked root still resolves.
179
+ """
180
+ cwd_abs = os.path.realpath(cwd if cwd is not None else os.getcwd())
181
+ return os.path.dirname(cwd_abs) != cwd_abs
182
+
183
+
184
+ def capture_gate(
185
+ cwd: str | None = None, patterns: list[str] | None = None
186
+ ) -> tuple[bool, str | None]:
187
+ """Decide whether a write (capture/upload/batch) may proceed, and tag its origin.
188
+
189
+ Returns ``(allowed, source_hint)``:
190
+
191
+ 1. **Folder consent** — ``MI_MCP_OPT_IN_ALL=1`` or an opted-in cwd → allow
192
+ (``source_hint`` None; the caller's own source/default is used).
193
+ 2. **Strict override** — ``MI_MCP_STRICT_CWD=1`` → never relax: a non-opted-in
194
+ cwd is blocked even with no project context, for users who want strict
195
+ folder gating on every surface.
196
+ 3. **No project context** — a root cwd → allow with a ``claude-connector``
197
+ source hint. This is the surface-level consent that makes capture work on
198
+ GUI / remote clients where the folder model is structurally inapplicable.
199
+ It mirrors the Desktop ``MI_MCP_OPT_IN_ALL`` accommodation, but is derived
200
+ at RUNTIME so it also covers the claude.ai connector — which ``mi-mcp
201
+ wire`` cannot reach, so the connector could never satisfy the gate before.
202
+ 4. **Real project folder, not opted in** → block.
203
+ """
204
+ cwd_abs = os.path.realpath(cwd if cwd is not None else os.getcwd())
205
+ if is_cwd_opted_in(cwd_abs, patterns):
206
+ return True, None
207
+ if os.environ.get("MI_MCP_STRICT_CWD") == "1":
208
+ return False, None
209
+ if not cwd_has_project_context(cwd_abs):
210
+ return True, "claude-connector"
211
+ return False, None
@@ -35,7 +35,7 @@ from mcp.types import (
35
35
 
36
36
  from . import localreads, recall_guard
37
37
  from .client import MIClient, MIAPIError, MIUploadTimeout
38
- from .config import MIConfig, is_cwd_opted_in
38
+ from .config import MIConfig, capture_gate
39
39
 
40
40
  logger = logging.getLogger("mi_mcp")
41
41
 
@@ -770,24 +770,38 @@ def create_server(config: MIConfig | None = None) -> Server:
770
770
  "umo_id": arguments.get("umo_id"),
771
771
  }))]
772
772
 
773
- # Consent gate (Story 8): write tools only fire from an opted-in cwd.
774
- # Reads are never gated. Absent allowlist → all writes skipped.
775
- if name in WRITE_TOOLS and not is_cwd_opted_in():
776
- cwd = os.getcwd()
777
- logger.info(f"[CONSENT] {name} skipped — cwd not opted in: {cwd}")
778
- return [TextContent(type="text", text=_fmt({
779
- "status": "skipped",
780
- "reason": "cwd not opted in — run `mi-mcp setup` here, or add it to ~/.memoryintelligence/mcp/opt-in-paths (or set MI_MCP_OPT_IN_ALL=1)",
781
- "cwd": cwd,
782
- "tool": name,
783
- }))]
773
+ # Consent gate (Story 8): writes require project-folder consent —
774
+ # EXCEPT on GUI/remote surfaces that spawn at "/" (no project cwd),
775
+ # where folder consent is structurally inapplicable and a surface-level
776
+ # consent applies instead (see config.capture_gate). Reads are never
777
+ # gated. `capture_source_hint` tags a connector-origin capture so those
778
+ # writes stay identifiable; None means "use the caller's own source".
779
+ capture_source_hint: str | None = None
780
+ if name in WRITE_TOOLS:
781
+ allowed, capture_source_hint = capture_gate()
782
+ if not allowed:
783
+ cwd = os.getcwd()
784
+ logger.info(f"[CONSENT] {name} skipped — cwd not opted in: {cwd}")
785
+ return [TextContent(type="text", text=_fmt({
786
+ "status": "skipped",
787
+ "reason": (
788
+ "Capture isn't enabled for this folder yet. Run "
789
+ "`mi-mcp setup` in the folder you're working from to "
790
+ "turn it on (or add that folder to "
791
+ "~/.memoryintelligence/mcp/opt-in-paths)."
792
+ ),
793
+ "cwd": cwd,
794
+ "tool": name,
795
+ }))]
784
796
 
785
797
  match name:
786
798
  case "mi_capture":
787
799
  # Claim-granular by default (#446); an agent can opt out per call.
800
+ # source: caller's own value wins; else the connector-origin tag
801
+ # from the gate (a no-project-cwd surface), else the config default.
788
802
  result = await client.capture(
789
803
  content=arguments["content"],
790
- source=arguments.get("source"),
804
+ source=arguments.get("source") or capture_source_hint,
791
805
  scope=arguments.get("scope"),
792
806
  scope_id=arguments.get("scope_id"),
793
807
  retention_policy=arguments.get("retention_policy"),