fix: resolve session dir to an absolute writable path#12
Merged
Conversation
The session directory was created at a relative `.mm` path, so it landed
in whatever working directory the MCP client launched the server from.
Clients like Claude Desktop launch with a read-only cwd (e.g. `/`), which
crashes startup before the server can connect:
OSError: [Errno 30] Read-only file system: '.mm'
Resolve the session dir to an absolute path instead: honor a new
MONARCH_SESSION_DIR env var, otherwise default to ~/.monarch-mcp (always
writable regardless of launch cwd). Use parents=True on mkdir and update
the docs that referenced the old `.mm/` location.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
|
THXU |
jamiew
added a commit
that referenced
this pull request
Jun 30, 2026
- transaction splitting tools (#13) and session-dir fix (#12), both from @caseypugh - dependency refresh and fork-pin bump to 1.4.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The server crashes on startup under MCP clients that launch it with a read-only working directory (e.g. Claude Desktop, which launches from
/):The session directory was
Path(".mm")— a relative path — so it was created in whatever cwd the client used. Withuv runfrom the repo cwd is writable and it works, butuvx monarch-mcp-jamiewlaunched by Claude Desktop runs from a read-only cwd and the process exits before it can connect.Fix
Resolve the session directory to an absolute path:
MONARCH_SESSION_DIRenv var if set~/.monarch-mcp(always writable, independent of launch cwd)mkdir(..., parents=True, exist_ok=True)This makes the published
uvx monarch-mcp-jamiewconfig work out of the box in Claude Desktop and any client with a non-writable cwd. Docs that referenced the old.mm/location are updated.Testing
uv run python scripts/ci.py— ruff, ruff format, mypy, and pytest all pass (197 passed, 5 skipped).🤖 Generated with Claude Code