Skip to content

fix: use cross-platform cache directory#7

Open
cmdaltctr wants to merge 1 commit into
qwe4559999:mainfrom
cmdaltctr:fix/cache-dir-cross-platform
Open

fix: use cross-platform cache directory#7
cmdaltctr wants to merge 1 commit into
qwe4559999:mainfrom
cmdaltctr:fix/cache-dir-cross-platform

Conversation

@cmdaltctr

Copy link
Copy Markdown

Problem

The default cache_dir='.cache' resolves relative to CWD via Path.resolve(). When launched by MCP clients (Claude Desktop, Cursor, Trae), CWD is '/' which is read-only on macOS, causing:

OSError: [Errno 30] Read-only file system: '/.cache'

Fix

Use proper platform-specific cache directories:

  • macOS/Linux: $XDG_CACHE_HOME/scopus-mcp (falls back to ~/.cache/scopus-mcp)
  • Windows: %LOCALAPPDATA%/scopus-mcp

Backwards compatible: explicit cache_dir arguments still work as before.

The default cache_dir='.cache' resolved relative to CWD via Path.resolve().
When launched by MCP clients (Claude Desktop, Cursor, etc.), CWD is '/'
which is read-only on macOS, causing:
  OSError: [Errno 30] Read-only file system: '/.cache'

Now uses proper platform-specific cache directories:
- macOS/Linux: $XDG_CACHE_HOME/scopus-mcp (default ~/.cache/scopus-mcp)
- Windows: %LOCALAPPDATA%/scopus-mcp

Fixes #OOM on macOS when used with Claude Desktop and other MCP clients.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant