FileSystemSessionStore when a single development server should keep session metadata across hot reloads or short restarts. It writes serializable session metadata to a JSON file on disk.
This guide focuses on the development workflow. Use the Sessions API reference for constructor fields, defaults, cleanup behavior, and file format details.
Let non-production mode use it automatically
WhenNODE_ENV !== "production", mcp-use uses file system storage when you do not pass a custom sessionStore. This includes unset NODE_ENV, local development, test, and other non-production values.
.mcp-use/sessions.json in the project root. Set NODE_ENV=production or pass an explicit sessionStore when you do not want file-backed sessions.
Configure it explicitly when needed
PassFileSystemSessionStore when you want to control where the session file lives.
Use it only for single-instance persistence
File system storage is useful when one process reads and writes the session file. It is not designed for shared production storage. Use file system storage when:- You are developing with hot reload.
- You are testing reconnect behavior locally.
- One server process owns the session file.
- Multiple server instances run behind a load balancer.
- The session file would live on ephemeral deployment storage.
- High write volume would make disk I/O a bottleneck.
Understand restart behavior
On startup, the store loads existing session metadata from the file. If the file is missing, the server starts with no sessions. If the file is corrupt or unreadable, the store logs the issue and starts fresh. Writes are debounced and use a temporary-file-then-rename pattern to reduce file corruption risk during local development.Verify the behavior
Use a local client and confirm:- A session survives a server hot reload.
- Removing
.mcp-use/sessions.jsonforces clients to initialize again. - Running two server instances against the same file is not part of your workflow.
Next steps
In-Memory Storage
Use process-local storage when sessions can reset on restart.
Redis Storage
Share session metadata and streams across server instances.
Sessions API reference
Look up file store options, defaults, and methods.
ServerConfig API reference
Look up
sessionStore configuration.