memoryintelligence-mcp 0.2.2__tar.gz → 0.2.3__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.
Files changed (22) hide show
  1. {memoryintelligence_mcp-0.2.2 → memoryintelligence_mcp-0.2.3}/CHANGELOG.md +44 -10
  2. {memoryintelligence_mcp-0.2.2 → memoryintelligence_mcp-0.2.3}/PKG-INFO +9 -7
  3. {memoryintelligence_mcp-0.2.2 → memoryintelligence_mcp-0.2.3}/README.md +7 -5
  4. {memoryintelligence_mcp-0.2.2 → memoryintelligence_mcp-0.2.3}/pyproject.toml +2 -9
  5. {memoryintelligence_mcp-0.2.2 → memoryintelligence_mcp-0.2.3}/src/mi_mcp/__init__.py +1 -1
  6. {memoryintelligence_mcp-0.2.2 → memoryintelligence_mcp-0.2.3}/src/mi_mcp/__main__.py +5 -0
  7. {memoryintelligence_mcp-0.2.2 → memoryintelligence_mcp-0.2.3}/src/mi_mcp/cli.py +66 -8
  8. {memoryintelligence_mcp-0.2.2 → memoryintelligence_mcp-0.2.3}/src/mi_mcp/client.py +2 -7
  9. {memoryintelligence_mcp-0.2.2 → memoryintelligence_mcp-0.2.3}/src/mi_mcp/config.py +33 -4
  10. {memoryintelligence_mcp-0.2.2 → memoryintelligence_mcp-0.2.3}/src/mi_mcp/keys.py +1 -1
  11. {memoryintelligence_mcp-0.2.2 → memoryintelligence_mcp-0.2.3}/src/mi_mcp/paths.py +1 -1
  12. {memoryintelligence_mcp-0.2.2 → memoryintelligence_mcp-0.2.3}/src/mi_mcp/server.py +25 -7
  13. {memoryintelligence_mcp-0.2.2 → memoryintelligence_mcp-0.2.3}/.gitignore +0 -0
  14. {memoryintelligence_mcp-0.2.2 → memoryintelligence_mcp-0.2.3}/CONTRIBUTING.md +0 -0
  15. {memoryintelligence_mcp-0.2.2 → memoryintelligence_mcp-0.2.3}/LICENSE +0 -0
  16. {memoryintelligence_mcp-0.2.2 → memoryintelligence_mcp-0.2.3}/src/mi_mcp/embedder.py +0 -0
  17. {memoryintelligence_mcp-0.2.2 → memoryintelligence_mcp-0.2.3}/src/mi_mcp/indexer.py +0 -0
  18. {memoryintelligence_mcp-0.2.2 → memoryintelligence_mcp-0.2.3}/src/mi_mcp/local_index.py +0 -0
  19. {memoryintelligence_mcp-0.2.2 → memoryintelligence_mcp-0.2.3}/src/mi_mcp/localreads.py +0 -0
  20. {memoryintelligence_mcp-0.2.2 → memoryintelligence_mcp-0.2.3}/src/mi_mcp/scrub.py +0 -0
  21. {memoryintelligence_mcp-0.2.2 → memoryintelligence_mcp-0.2.3}/src/mi_mcp/umo_format.py +0 -0
  22. {memoryintelligence_mcp-0.2.2 → memoryintelligence_mcp-0.2.3}/src/mi_mcp/vault.py +0 -0
@@ -3,16 +3,50 @@
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.2] — 2026-07-18
7
-
8
- ### Fixed
9
- - `mi_account` now works. It called the JWT-only `/v1/accounts/me` and always
10
- returned 401 under the API-key auth the MCP server uses; repointed to the
11
- API-key endpoint `GET /v1/account`.
12
- - Set `asyncio_mode = auto` so the bare-`async` tests run (CI was red).
13
-
14
- ### Changed
15
- - Relicensed MIT **Apache-2.0**.
6
+ ## [0.2.3] — 2026-07-22
7
+
8
+ ### Fixed — Claude Desktop actually launches: the sandbox P0 finally ships (#1135)
9
+ The Desktop direct-interpreter wire (merged 2026-07-07) never reached PyPI the
10
+ published 0.2.2 was built from an earlier commit under the same version number,
11
+ so `mi-mcp wire`/`setup` on the released package kept writing a Desktop entry
12
+ pointing at `run-mi-mcp.sh`, which Claude Desktop's macOS sandbox refuses to
13
+ exec. Result: the server never completes the MCP handshake, Desktop kills it at
14
+ its 60s timeout ("Server disconnected"), and no tools register — while `doctor`
15
+ reported green. This release cuts current `main`, which carries:
16
+
17
+ - **`wire` emits `{command: <python>, args: ["-m", "mi_mcp"]}` for Desktop** —
18
+ a real Mach-O binary the sandbox allows; the key still never touches the
19
+ config (resolved in-process from the Keychain, time-boxed at 5s).
20
+ - **`doctor` now FAILS when the Desktop entry points at a shell script**, with
21
+ the exact remediation printed — the escalated user's hours of debugging
22
+ become one red line.
23
+ - **The launcher's Keychain read is time-boxed** (perl alarm, 5s) for the
24
+ surfaces that keep the wrapper (Code/Cursor): a Keychain ACL authorization
25
+ prompt (e.g. after a venv/binary change) can no longer hang the launch
26
+ until the host's timeout.
27
+ - Config backup before overwrite (P1) + startup marker line (P2) from the
28
+ onboarding-report arc, also previously unreleased.
29
+ - **License clarified: Apache-2.0.** Every published release (0.2.0–0.2.2) has
30
+ shipped under Apache-2.0; an in-repo MIT text was drift, never a decision.
31
+ This release restores the LICENSE file and metadata to Apache-2.0 so the
32
+ paperwork matches what has always been published — including its explicit
33
+ patent grant (LICENSE §3), which applies to this package as the licensed
34
+ Work. See the LICENSE for its exact scope and terms.
35
+
36
+ **To pick this up:** `pip install -U memoryintelligence-mcp` (or `uv tool
37
+ upgrade`), then **re-run `mi-mcp wire`**, then fully quit + reopen Claude
38
+ Desktop. `mi-mcp doctor` must show `[✓] desktop entry sandbox-launchable`.
39
+
40
+ ## [0.2.2] — 2026-07-07
41
+
42
+ ### Fixed — `explain` now surfaces the score breakdown through `mi_ask` (MI#482)
43
+ `mi_ask`'s `explain` argument was silently dropped: the MCP output shaper projected
44
+ every hit down to `{umo_id, summary, source, score}` and discarded the per-signal
45
+ `scores` breakdown unconditionally, so passing `explain: "human"` (or any level) had
46
+ no observable effect and ranking couldn't be diagnosed (e.g. the entity-channel
47
+ contribution). The shaper now **keeps the `scores` block** (semantic/keyword/entity/
48
+ recency) on each hit whenever `explain` is anything other than `none`; the default
49
+ lean shape is unchanged, so token cost is unaffected unless you ask for the breakdown.
16
50
 
17
51
  ## [0.2.1] — 2026-07-05
18
52
 
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: memoryintelligence-mcp
3
- Version: 0.2.2
3
+ Version: 0.2.3
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
7
7
  Project-URL: Issues, https://github.com/somewhere11/memoryintelligence-mcp/issues
8
8
  Project-URL: Changelog, https://github.com/somewhere11/memoryintelligence-mcp/blob/main/CHANGELOG.md
9
9
  Project-URL: Documentation, https://memoryintelligence.io/docs/api-reference
10
- Author-email: MemoryIntelligence <sdk@memoryintelligence.io>
10
+ Author-email: Somewhere <connect@somewheremedia.com>
11
11
  License-Expression: Apache-2.0
12
12
  License-File: LICENSE
13
13
  Keywords: ai,claude,llm,mcp,memory,memory-intelligence,model-context-protocol
@@ -115,8 +115,10 @@ and never leaves your machine except to authenticate.
115
115
  <details>
116
116
  <summary><b>Security</b> — key handling, capture consent, PII redaction, no open port</summary>
117
117
 
118
- - **No key in configs.** `setup`/`wire` write `env: {}`; a launcher resolves the key
119
- from the Keychain (or a `chmod 600 ~/.memoryintelligence/.env` keyfile) **at launch**.
118
+ - **No key in configs.** The key is resolved from the Keychain (or a `chmod 600
119
+ ~/.memoryintelligence/.env` keyfile) **at launch** — in-process for Claude Desktop
120
+ (direct `python -m mi_mcp` entry; its sandbox blocks shell scripts), via the
121
+ launcher script for Code/Cursor.
120
122
  A leaked or committed config exposes nothing.
121
123
  > **Never** put your key in a client config as `"env": {"MI_API_KEY": "mi_sk_…"}` —
122
124
  > those files get synced, backed up, and committed. Let `setup` handle it.
@@ -146,7 +148,7 @@ Found a vulnerability? [SECURITY.md](SECURITY.md) — report privately to connec
146
148
  | `MI_API_KEY` | — | Resolved by the launcher from Keychain / keyfile — don't set inline in configs |
147
149
  | `MI_BASE_URL` | `https://api.memoryintelligence.io` | API base URL |
148
150
  | `MI_MCP_FULL` | _(off)_ | `1` exposes all 10 tools; otherwise the 3 core |
149
- | `MI_VAULT` | `~/MemoryIntelligence` | Local `.umo` vault location |
151
+ | `MI_VAULT` | `~/Somewhere` (set by `wire`) | Local `.umo` vault `wire`/`setup` point it at `~/Somewhere` so it's shared with the MemorySpace Desktop app. Unwired fallback is `~/MemoryIntelligence`; an explicit value here always wins. |
150
152
  | `MI_DEFAULT_SCOPE` · `MI_DEFAULT_RETENTION` · `MI_DEFAULT_PII_HANDLING` | `user` · `meaning_only` · `extract_and_redact` | Governance defaults |
151
153
 
152
154
  **Names you'll see** — they collapse to one long form and one short form:
@@ -163,8 +165,8 @@ Found a vulnerability? [SECURITY.md](SECURITY.md) — report privately to connec
163
165
 
164
166
  | Path | What |
165
167
  |---|---|
166
- | `~/MemoryIntelligence/` | your `.umo` vault (override with `MI_VAULT`) |
167
- | `~/.memoryintelligence/mcp/run-mi-mcp.sh` | the launcher each host spawns |
168
+ | `~/Somewhere/` | your `.umo` vault — shared with the MemorySpace Desktop app (`wire` sets `MI_VAULT` here; override with `MI_VAULT`) |
169
+ | `~/.memoryintelligence/mcp/run-mi-mcp.sh` | the launcher Code/Cursor spawn (Claude Desktop runs `python -m mi_mcp` directly — its sandbox blocks scripts) |
168
170
  | `~/.memoryintelligence/mcp/opt-in-paths` | per-directory capture allowlist |
169
171
  | `~/.memoryintelligence/.env` | `chmod 600` keyfile (Keychain fallback) |
170
172
  </details>
@@ -76,8 +76,10 @@ and never leaves your machine except to authenticate.
76
76
  <details>
77
77
  <summary><b>Security</b> — key handling, capture consent, PII redaction, no open port</summary>
78
78
 
79
- - **No key in configs.** `setup`/`wire` write `env: {}`; a launcher resolves the key
80
- from the Keychain (or a `chmod 600 ~/.memoryintelligence/.env` keyfile) **at launch**.
79
+ - **No key in configs.** The key is resolved from the Keychain (or a `chmod 600
80
+ ~/.memoryintelligence/.env` keyfile) **at launch** — in-process for Claude Desktop
81
+ (direct `python -m mi_mcp` entry; its sandbox blocks shell scripts), via the
82
+ launcher script for Code/Cursor.
81
83
  A leaked or committed config exposes nothing.
82
84
  > **Never** put your key in a client config as `"env": {"MI_API_KEY": "mi_sk_…"}` —
83
85
  > those files get synced, backed up, and committed. Let `setup` handle it.
@@ -107,7 +109,7 @@ Found a vulnerability? [SECURITY.md](SECURITY.md) — report privately to connec
107
109
  | `MI_API_KEY` | — | Resolved by the launcher from Keychain / keyfile — don't set inline in configs |
108
110
  | `MI_BASE_URL` | `https://api.memoryintelligence.io` | API base URL |
109
111
  | `MI_MCP_FULL` | _(off)_ | `1` exposes all 10 tools; otherwise the 3 core |
110
- | `MI_VAULT` | `~/MemoryIntelligence` | Local `.umo` vault location |
112
+ | `MI_VAULT` | `~/Somewhere` (set by `wire`) | Local `.umo` vault `wire`/`setup` point it at `~/Somewhere` so it's shared with the MemorySpace Desktop app. Unwired fallback is `~/MemoryIntelligence`; an explicit value here always wins. |
111
113
  | `MI_DEFAULT_SCOPE` · `MI_DEFAULT_RETENTION` · `MI_DEFAULT_PII_HANDLING` | `user` · `meaning_only` · `extract_and_redact` | Governance defaults |
112
114
 
113
115
  **Names you'll see** — they collapse to one long form and one short form:
@@ -124,8 +126,8 @@ Found a vulnerability? [SECURITY.md](SECURITY.md) — report privately to connec
124
126
 
125
127
  | Path | What |
126
128
  |---|---|
127
- | `~/MemoryIntelligence/` | your `.umo` vault (override with `MI_VAULT`) |
128
- | `~/.memoryintelligence/mcp/run-mi-mcp.sh` | the launcher each host spawns |
129
+ | `~/Somewhere/` | your `.umo` vault — shared with the MemorySpace Desktop app (`wire` sets `MI_VAULT` here; override with `MI_VAULT`) |
130
+ | `~/.memoryintelligence/mcp/run-mi-mcp.sh` | the launcher Code/Cursor spawn (Claude Desktop runs `python -m mi_mcp` directly — its sandbox blocks scripts) |
129
131
  | `~/.memoryintelligence/mcp/opt-in-paths` | per-directory capture allowlist |
130
132
  | `~/.memoryintelligence/.env` | `chmod 600` keyfile (Keychain fallback) |
131
133
  </details>
@@ -4,12 +4,12 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "memoryintelligence-mcp"
7
- version = "0.2.2"
7
+ version = "0.2.3"
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"
11
11
  requires-python = ">=3.10"
12
- authors = [{ name = "MemoryIntelligence", email = "sdk@memoryintelligence.io" }]
12
+ authors = [{ name = "Somewhere", email = "connect@somewheremedia.com" }]
13
13
  keywords = ["mcp", "model-context-protocol", "memory-intelligence", "claude", "llm", "memory", "ai"]
14
14
  classifiers = [
15
15
  "Development Status :: 4 - Beta",
@@ -70,10 +70,3 @@ include = ["src/mi_mcp", "README.md", "LICENSE", "CHANGELOG.md", "CONTRIBUTING.m
70
70
  [tool.ruff]
71
71
  target-version = "py310"
72
72
  line-length = 100
73
-
74
- [tool.pytest.ini_options]
75
- # Bare `async def test_*` functions (e.g. tests/test_localreads.py) are collected
76
- # as asyncio tests without needing a per-test @pytest.mark.asyncio marker. Without
77
- # this, pytest-asyncio's default (strict) mode skips/errors them with
78
- # "async def functions are not natively supported". Explicit markers still work.
79
- asyncio_mode = "auto"
@@ -1,3 +1,3 @@
1
1
  """MI MCP Server — MemoryIntelligence tools for Claude."""
2
2
 
3
- __version__ = "0.2.1"
3
+ __version__ = "0.2.3"
@@ -89,6 +89,11 @@ def main():
89
89
  stream=sys.stderr,
90
90
  )
91
91
 
92
+ # Startup marker (Adrian's onboarding report, P2): emit ONE line the instant we reach
93
+ # main(), so the host log shows the process actually started. Without it, a hang in
94
+ # config/import reads as a silent "connected → 60s timeout" with no failure point.
95
+ logger.info("mi-mcp %s starting…", __version__)
96
+
92
97
  # Load config from env (CLI args override env vars)
93
98
  from .config import MIConfig
94
99
 
@@ -59,8 +59,14 @@ WRAPPER_TEMPLATE = r"""#!/usr/bin/env bash
59
59
  set -euo pipefail
60
60
 
61
61
  # 1. inherited env → 2. macOS Keychain → 3. keyfile (new then legacy) → fail
62
+ # The Keychain read is TIME-BOXED (perl alarm — present on stock macOS; the
63
+ # Python side already bounds its own read at 5s): if the item's ACL no longer
64
+ # trusts the caller (e.g. after a binary/venv change), `security` blocks on an
65
+ # authorization dialog a headless MCP host can never answer, and an unbounded
66
+ # read here hangs the launch until the host's 60s timeout kills it (#1135).
67
+ # On timeout we fall through to the keyfile instead of hanging.
62
68
  if [[ -z "${MI_API_KEY:-}" ]]; then
63
- MI_API_KEY="$(security find-generic-password -a "${MI_KEYCHAIN_ACCOUNT:-$USER}" -s "MI_API_KEY" -w 2>/dev/null || true)"
69
+ MI_API_KEY="$(perl -e 'alarm shift; exec @ARGV' 5 security find-generic-password -a "${MI_KEYCHAIN_ACCOUNT:-$USER}" -s "MI_API_KEY" -w 2>/dev/null || true)"
64
70
  fi
65
71
  for __mi_envf in "$HOME/.memoryintelligence/.env" "$HOME/.mi-env"; do
66
72
  if [[ -z "${MI_API_KEY:-}" && -f "$__mi_envf" ]]; then
@@ -302,21 +308,35 @@ def do_wire(home: Path, surfaces: list[str], dry_run: bool,
302
308
  migrated = [k for k in LEGACY_SERVER_KEYS if servers.pop(k, None) is not None]
303
309
  if migrated:
304
310
  print(f" {s:8} migrated id {', '.join(migrated)} → {SERVER_KEY}")
305
- # Build this surface's entry. env carries at most the one non-secret
306
- # opt-in flag, desktop-only. capture_anywhere is tri-state: True enables,
311
+ # Build this surface's entry. capture_anywhere is tri-state: True enables,
307
312
  # False disables, None preserves the current setting (so a plain re-wire
308
313
  # never silently flips a capture choice the user made).
309
314
  env: dict[str, str] = {}
310
315
  if s == "desktop":
311
316
  prior = servers.get(SERVER_KEY)
312
317
  prior_env = prior.get("env") if isinstance(prior, dict) else None
318
+ # D7: point the local .umo vault at the MemorySpace Desktop vault (~/Somewhere) so
319
+ # both surfaces resolve ONE vault. The shell wrapper used to set this at launch;
320
+ # the direct-interpreter entry carries it here. A deliberate prior override wins.
321
+ prior_vault = prior_env.get("MI_VAULT") if isinstance(prior_env, dict) else None
322
+ env["MI_VAULT"] = prior_vault or str(home / "Somewhere")
313
323
  already_on = isinstance(prior_env, dict) and prior_env.get("MI_MCP_OPT_IN_ALL") == "1"
314
324
  enabled = already_on if capture_anywhere is None else capture_anywhere
315
325
  if enabled:
316
326
  # Tag Desktop captures with a distinct provenance source so they're
317
327
  # identifiable/reviewable apart from project (folder-scoped) captures.
318
- env = {"MI_MCP_OPT_IN_ALL": "1", "MI_DEFAULT_SOURCE": "claude-desktop"}
319
- entry = {"command": str(wrapper), "args": [], "env": env}
328
+ env["MI_MCP_OPT_IN_ALL"] = "1"
329
+ env["MI_DEFAULT_SOURCE"] = "claude-desktop"
330
+ # P0 FIX (Adrian's onboarding report): Claude Desktop's macOS sandbox throws
331
+ # "Operation not permitted" on any shell script it didn't ship — so pointing the
332
+ # config at run-mi-mcp.sh breaks EVERY Mac Desktop user. Spawn the Python interpreter
333
+ # directly (a real Mach-O binary the sandbox allows). config.resolve_api_key() finds
334
+ # the key in the Keychain at startup, so it still never lives in this file. Other
335
+ # surfaces (Code/Cursor) aren't sandboxed the same way and keep the self-healing wrapper.
336
+ if s == "desktop":
337
+ entry = {"command": sys.executable, "args": ["-m", "mi_mcp"], "env": env}
338
+ else:
339
+ entry = {"command": str(wrapper), "args": [], "env": env}
320
340
  # VS Code / Copilot require an explicit transport type on each entry;
321
341
  # Claude surfaces don't use one.
322
342
  surface_entry = {"type": "stdio", **entry} if s == "vscode" else entry
@@ -324,16 +344,23 @@ def do_wire(home: Path, surfaces: list[str], dry_run: bool,
324
344
  action = "update" if SERVER_KEY in servers else "add"
325
345
  nochange = servers.get(SERVER_KEY) == surface_entry
326
346
  servers[SERVER_KEY] = surface_entry
327
- note = (" · capture-anywhere ON" if env else " · capture-anywhere off") if s == "desktop" else ""
347
+ opt_in_on = env.get("MI_MCP_OPT_IN_ALL") == "1"
348
+ note = (" · capture-anywhere ON" if opt_in_on else " · capture-anywhere off") if s == "desktop" else ""
328
349
  print(f" {s:8} {cfg_path} [{action}{' / no-change' if nochange else ''}]{note}")
329
- if env and s == "desktop":
350
+ if opt_in_on and s == "desktop":
330
351
  print(" ⚠ ANY Claude Desktop chat under this macOS login can now write to your")
331
352
  print(" MI account (captures are PII-redacted + tagged source=claude-desktop).")
332
353
  print(" Don't enable on a shared login. Turn off: --no-capture-anywhere")
333
354
  if not dry_run:
355
+ # P1 (Adrian's report): an upgrade silently overwrote a working config. Before
356
+ # any changing write, snapshot the prior file so a bad wire is always recoverable.
357
+ if not nochange and cfg_path.exists():
358
+ backup = cfg_path.with_name(cfg_path.name + ".mi-bak")
359
+ _atomic_write(backup, cfg_path.read_text())
360
+ print(f" backed up prior config → {backup.name}")
334
361
  _atomic_write(cfg_path, json.dumps(cfg, indent=2) + "\n")
335
362
 
336
- print("\n ✓ no API key written to any config — the wrapper resolves it at launch")
363
+ print("\n ✓ no API key written to any config — resolved from the Keychain at launch")
337
364
 
338
365
 
339
366
  def cmd_wire(argv: list[str]) -> int:
@@ -444,6 +471,37 @@ def cmd_doctor(argv: list[str]) -> int:
444
471
  detail = f"legacy id {', '.join(legacy)} present — run `mi-mcp wire` to migrate"
445
472
  check(f"{s} wired", wired, detail, critical=False)
446
473
 
474
+ # #1135 — the escalated-user failure this check exists to catch in ONE
475
+ # line: Claude Desktop's macOS sandbox refuses to exec shell scripts it
476
+ # didn't ship ("Operation not permitted"), so a Desktop entry pointing
477
+ # at run-mi-mcp.sh (written by wire <= the published 0.2.2) starts,
478
+ # never completes the MCP handshake, and Desktop kills it at its 60s
479
+ # timeout — "Server disconnected", no tools registered, doctor green.
480
+ # CRITICAL: a wired-but-unlaunchable Desktop is worse than unwired.
481
+ if s == "desktop" and wired:
482
+ entry = servers.get(SERVER_KEY) or {}
483
+ cmd = str(entry.get("command", ""))
484
+ # An absent/empty command is just as unlaunchable as a blocked
485
+ # script — "" must not slip through as green.
486
+ launchable = bool(cmd) and not cmd.endswith(".sh")
487
+ # The manual-edit remediation must carry the env block: wire sets
488
+ # MI_VAULT on the Desktop entry (#653 vault unification), and a
489
+ # hand-edit that drops it launches fine but reads the wrong vault —
490
+ # which THIS doctor's vault check would not catch, since that check
491
+ # inspects the wrapper's baked default, not the Desktop entry env.
492
+ check(
493
+ "desktop entry sandbox-launchable", launchable,
494
+ "" if launchable else (
495
+ (f"points at {cmd} — the Desktop sandbox blocks shell scripts "
496
+ if cmd else "entry has no command — the server cannot launch ")
497
+ + f"(60s timeout / 'Server disconnected'). Fix: re-run `mi-mcp wire` "
498
+ f"on >=0.2.3 (recommended — preserves env). Manual edit must keep "
499
+ f"the env block: {{\"command\": \"{sys.executable}\", "
500
+ f"\"args\": [\"-m\", \"mi_mcp\"], "
501
+ f"\"env\": {{\"MI_VAULT\": \"{home / 'Somewhere'}\"}}}}"
502
+ ),
503
+ )
504
+
447
505
  print(f"\n {'healthy ✓' if ok else 'issues found ✗'}")
448
506
  return 0 if ok else 1
449
507
 
@@ -342,10 +342,5 @@ class MIClient:
342
342
  return resp.json()
343
343
 
344
344
  async def account_info(self) -> dict[str, Any]:
345
- """GET /v1/accountAPI key status, owner, and plan limits.
346
-
347
- Authenticated with the API key itself. (The older /v1/accounts/me
348
- requires a portal JWT, which an MCP client never holds — it only has
349
- an API key — so calling it always 401'd.)
350
- """
351
- return await self._request("GET", "/v1/account", idempotent=True)
345
+ """GET /v1/accounts/meget current account info and key status."""
346
+ return await self._request("GET", "/v1/accounts/me", idempotent=True)
@@ -7,12 +7,41 @@ from __future__ import annotations
7
7
 
8
8
  import fnmatch
9
9
  import os
10
+ import subprocess
10
11
  from dataclasses import dataclass
11
12
  from pathlib import Path
12
13
 
13
14
  from . import paths
14
15
 
15
16
 
17
+ def resolve_api_key() -> str:
18
+ """Resolve MI_API_KEY the same chain the launcher wrapper used to: inherited env →
19
+ macOS Keychain (service ``MI_API_KEY``) → keyfile (~/.memoryintelligence/.env, then
20
+ legacy ~/.mi-env). Resolving IN-PROCESS lets ``wire`` emit a direct ``python -m mi_mcp``
21
+ command (which macOS Claude Desktop's sandbox allows) instead of a shell script (which it
22
+ blocks) — with the key still never living in any MCP config file."""
23
+ key = os.environ.get("MI_API_KEY", "").strip()
24
+ if key:
25
+ return key
26
+ account = os.environ.get("MI_KEYCHAIN_ACCOUNT") or os.environ.get("USER") or ""
27
+ try:
28
+ r = subprocess.run(
29
+ ["security", "find-generic-password", "-a", account, "-s", "MI_API_KEY", "-w"],
30
+ capture_output=True, text=True, timeout=5,
31
+ )
32
+ if r.returncode == 0 and r.stdout.strip():
33
+ return r.stdout.strip()
34
+ except (OSError, subprocess.SubprocessError):
35
+ pass # `security` unavailable (non-macOS) or failed — fall through to the keyfile
36
+ envf = paths.resolve_keyfile()
37
+ if envf is not None:
38
+ for line in envf.read_text().splitlines():
39
+ line = line.strip()
40
+ if line.startswith("MI_API_KEY="):
41
+ return line.split("=", 1)[1].strip().strip('"').strip("'")
42
+ return ""
43
+
44
+
16
45
  @dataclass(frozen=True)
17
46
  class MIConfig:
18
47
  """Immutable configuration resolved from environment."""
@@ -59,13 +88,13 @@ class MIConfig:
59
88
  MI_MCP_LOCAL — "1" routes mi_ask/mi_list to the local vault index when
60
89
  one is built (network-free); falls back to cloud on error
61
90
  """
62
- api_key = os.environ.get("MI_API_KEY", "")
91
+ api_key = resolve_api_key()
63
92
  if not api_key:
64
93
  raise ValueError(
65
94
  "MI_API_KEY is required.\n"
66
- "Recommended: run `mi-mcp wire` — it resolves the key from your macOS Keychain\n"
67
- "at launch, so the key never lives in any config file. Or export MI_API_KEY in\n"
68
- "your shell. Never paste the key into an MCP client config file.\n"
95
+ "Recommended: run `mi-mcp setup` — it stores the key in your macOS Keychain, which\n"
96
+ "the server resolves at launch, so the key never lives in any config file. Or export\n"
97
+ "MI_API_KEY in your shell. Never paste the key into an MCP client config file.\n"
69
98
  "Get your key at https://memoryintelligence.io/portal"
70
99
  )
71
100
 
@@ -1,6 +1,6 @@
1
1
  """Owner key handling for the local vault — key model **A1** (locked 2026-06-05).
2
2
 
3
- The owner holds an **X25519 private key**; MemoryIntelligence only ever sees the
3
+ The owner holds an **X25519 private key**; Memory Intelligence only ever sees the
4
4
  **public key** (sent on capture). MI wraps each per-UMO content key for that
5
5
  public key, so **MI cannot decrypt the owner's ``.umo`` files**.
6
6
 
@@ -1,4 +1,4 @@
1
- """Filesystem layout for MemoryIntelligence — one on-brand namespace.
1
+ """Filesystem layout for Memory Intelligence — one on-brand namespace.
2
2
 
3
3
  Single visible/hidden split, no lookalike names:
4
4
 
@@ -112,25 +112,39 @@ def _error_text(e: MIAPIError) -> list[TextContent]:
112
112
  # UNCHANGED when it isn't the expected success shape, so errors/odd payloads
113
113
  # still surface.
114
114
 
115
- def _shape_ask(result: Any) -> Any:
116
- """Project a /v1/memories/query response to ``[{umo_id, summary, source, score}]``."""
115
+ def _shape_ask(result: Any, explain: Any = "none") -> Any:
116
+ """Project a /v1/memories/query response to a compact per-hit shape.
117
+
118
+ Default shape is ``{umo_id, summary, source, score}``. When the caller asked
119
+ for ``explain`` (any level other than "none"), each hit ALSO carries the
120
+ per-signal ``scores`` breakdown (semantic/keyword/entity/recency) the API
121
+ returns — #482: this shaper used to drop ``scores`` unconditionally, so the
122
+ ``explain`` argument had no observable effect through the MCP tool and
123
+ ranking couldn't be diagnosed (e.g. the entity-channel contribution).
124
+ """
117
125
  if not isinstance(result, dict):
118
126
  return result
119
127
  data = result.get("data")
120
128
  if not isinstance(data, dict) or "results" not in data:
121
129
  return result
130
+ want_scores = str(explain).strip().lower() not in ("", "none", "false", "0")
122
131
  shaped = []
123
132
  for r in data.get("results") or []:
124
133
  if not isinstance(r, dict):
125
134
  continue
126
- shaped.append({
135
+ hit = {
127
136
  "umo_id": r.get("umo_id"),
128
137
  # content_text duplicates summary; fall back to it only if summary is empty.
129
138
  "summary": r.get("summary") or r.get("content_text"),
130
139
  # #538: the API omits source when it's the default — absent means "api".
131
140
  "source": r.get("source") or "api",
132
141
  "score": r.get("score"),
133
- })
142
+ }
143
+ # #482: preserve the score decomposition when explain was requested and
144
+ # the API actually returned it (it omits `scores` when explain=none).
145
+ if want_scores and r.get("scores") is not None:
146
+ hit["scores"] = r.get("scores")
147
+ shaped.append(hit)
134
148
  return shaped
135
149
 
136
150
 
@@ -279,8 +293,11 @@ def create_server(config: MIConfig | None = None) -> Server:
279
293
  description=(
280
294
  "Capture content into MemoryIntelligence. Transforms raw text into "
281
295
  "a Unified Memory Object (UMO) — extracting entities, topics, sentiment, "
282
- "and generating embeddings. The raw content is discarded by default "
283
- "(meaning-only retention). Returns the created UMO with its ID."
296
+ "and generating embeddings. Long captures are chunked into per-claim "
297
+ "child UMOs that persist each claim's verbatim text; short captures "
298
+ "persist their normalized text with a generated summary. The default "
299
+ "meaning_only retention discards the raw pre-normalization buffer, "
300
+ "not the readable content. Returns the created UMO with its ID."
284
301
  ),
285
302
  inputSchema={
286
303
  "type": "object",
@@ -712,7 +729,8 @@ def create_server(config: MIConfig | None = None) -> Server:
712
729
 
713
730
  case "mi_ask":
714
731
  result = await _route_ask(config, client, arguments)
715
- return [TextContent(type="text", text=_fmt_untrusted(_shape_ask(result)))]
732
+ return [TextContent(type="text", text=_fmt_untrusted(
733
+ _shape_ask(result, explain=arguments.get("explain", "none"))))]
716
734
 
717
735
  case "mi_list":
718
736
  result = await _route_list(config, client, arguments)