FileSystemSessionStore persists session metadata to a JSON file on disk. This is the default storage provider in development mode (NODE_ENV !== 'production'), enabling sessions to survive server hot reloads.
Usage
Default (Development Mode)
In development mode,FileSystemSessionStore is automatically selected:
Explicit Configuration
You can also explicitly configure it:Custom Configuration
Configuration Options
Configuration Details
-
path: File path where sessions are stored. Defaults to.mcp-use/sessions.jsonin the project root. The directory is created automatically if it doesn’t exist. -
debounceMs: Debounce delay for write operations. Reduces disk I/O by batching rapid consecutive writes. Default: 100ms. -
maxAgeMs: Maximum session age before automatic cleanup. Expired sessions are removed when the file is loaded. Default: 24 hours (86400000ms).
When to Upgrade
Upgrade to Redis Storage when you need:- Production deployments
- Multiple server instances behind a load balancer
- Distributed notifications/sampling across servers
- High-throughput scenarios
How It Works
The file system store:- Loads sessions on startup - Reads existing sessions from the JSON file synchronously
- Cleans up expired sessions - Removes sessions older than
maxAgeMsduring load - Debounces writes - Batches rapid consecutive writes to reduce disk I/O
- Uses atomic writes - Writes to a temporary file then renames for reliability