Summary
mm init classifies any cwd with a pyproject.toml (and no packages/ dir) as a project install and writes an .mcp.json assuming memtomem is already a dependency of that project — but the wizard never checks pyproject.toml to verify that, nor does it run uv add memtomem itself. Result: on an empty uv init-style project, the wizard happily writes a workspace-style .mcp.json that only works because the user also has a global uv tool install memtomem providing the memtomem-server bin on PATH (PATH fallback from uv run).
Repro
mkdir -p /tmp/mmtest && cd /tmp/mmtest
uv init # creates pyproject.toml with dependencies = []
mm init # walk through wizard, pick any MCP option
cat .mcp.json # workspace form: "uv run --directory ... memtomem-server"
grep memtomem pyproject.toml # nothing — dep was never added
Connecting this from Claude Code works only if uv tool install memtomem is also present globally — otherwise uv run --directory <empty project> memtomem-server fails with "command not found".
Observed
.mcp.json written by the wizard:
{"mcpServers":{"memtomem":{"command":"uv","args":["run","--directory","/tmp/mmtest","memtomem-server"]}}}
Project state:
[project]
dependencies = []
Where
packages/memtomem/src/memtomem/cli/init_cmd.py:93-107 — _detect_project_install() walks up looking for a pyproject.toml without a sibling packages/ dir, but the dependency check is structural only:
if (check / "pyproject.toml").exists() and not (check / "packages").exists():
return check
The docstring (line 95) says this is meant to detect "uv add memtomem in someone else's project", but that assumption is never validated by parsing the pyproject. Downstream (init_cmd.py:1953-1955) then writes the workspace form unconditionally.
Suggested fix (hypothesis — needs confirmation)
Two axes the wizard could pick between:
- Tighten the detector:
_detect_project_install should also parse pyproject.toml and confirm memtomem is in [project].dependencies (or [tool.uv.sources]). If not, fall through to the "pypi" / tool branch which writes "command": "memtomem-server" — no uv run indirection.
- Offer to add the dep: keep the current detector but, when classified as
project, run uv add memtomem (or prompt first). This keeps the workspace form honest.
Option 1 is lower-risk (no new side effect in the wizard). Related invariant: feedback_install_context_axes.md — CWD-filesystem and runtime-interpreter axes need to reconcile, not be inferred independently.
Out of scope
- The legacy
.server.pid flock leak observed alongside this (a second server kept the lock after Claude Code's handshake failed) — filing separately.
Summary
mm initclassifies any cwd with apyproject.toml(and nopackages/dir) as a project install and writes an.mcp.jsonassumingmemtomemis already a dependency of that project — but the wizard never checkspyproject.tomlto verify that, nor does it runuv add memtomemitself. Result: on an emptyuv init-style project, the wizard happily writes a workspace-style.mcp.jsonthat only works because the user also has a globaluv tool install memtomemproviding thememtomem-serverbin onPATH(PATH fallback fromuv run).Repro
Connecting this from Claude Code works only if
uv tool install memtomemis also present globally — otherwiseuv run --directory <empty project> memtomem-serverfails with "command not found".Observed
.mcp.jsonwritten by the wizard:{"mcpServers":{"memtomem":{"command":"uv","args":["run","--directory","/tmp/mmtest","memtomem-server"]}}}Project state:
Where
packages/memtomem/src/memtomem/cli/init_cmd.py:93-107—_detect_project_install()walks up looking for apyproject.tomlwithout a siblingpackages/dir, but the dependency check is structural only:The docstring (line 95) says this is meant to detect "
uv add memtomemin someone else's project", but that assumption is never validated by parsing the pyproject. Downstream (init_cmd.py:1953-1955) then writes the workspace form unconditionally.Suggested fix (hypothesis — needs confirmation)
Two axes the wizard could pick between:
_detect_project_installshould also parsepyproject.tomland confirmmemtomemis in[project].dependencies(or[tool.uv.sources]). If not, fall through to the"pypi"/ tool branch which writes"command": "memtomem-server"— nouv runindirection.project, runuv add memtomem(or prompt first). This keeps the workspace form honest.Option 1 is lower-risk (no new side effect in the wizard). Related invariant:
feedback_install_context_axes.md— CWD-filesystem and runtime-interpreter axes need to reconcile, not be inferred independently.Out of scope
.server.pidflock leak observed alongside this (a second server kept the lock after Claude Code's handshake failed) — filing separately.