
Virtual Filesystem
io.github.lu-zhengdaPublished by GitHub account lu-zhengdav0.2.2Updated Oct 24, 2026
PostgreSQL-backed virtual filesystem for agents: session isolation, shared stores, POSIX ops, RLS.
Overview
A PostgreSQL-backed virtual filesystem for AI agents, giving assistants persistent, session-isolated file storage with POSIX-style read, write and search tools.
- What you can do
- Read, write and append files, and check metadata or existence with stat, inside a virtual filesystem stored in PostgreSQL rather than the host disk.Organize storage with ls, mkdir, mv and rm, including recursive directory removal and automatic parent creation.Find files by glob pattern and search file contents by regex, backed by PostgreSQL trigram indexes.List and use named cross-session stores so data can be shared between agents or kept as long-term memory.
- When to use it
- Useful when an assistant needs a persistent workspace that survives process restarts, container recycling or redeployments, or when several agents should share files through named stores. Also fits sandboxed file operations where agents should not touch the host filesystem.
- Requirements
- Runs locally over stdio via the npm package, needing Node.js 20 or later and PostgreSQL 14 or later with the pg_trgm extension. The DATABASE_URL connection string is required; VFS_AUTO_INIT, VFS_SESSION_ID and VFS_ENABLE_RLS are optional. Optional RLS setup requires running SQL scripts and a dedicated database role.
Installation
In SourceWeft
- Open Virtual Filesystem in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
mcp-virtual-fs
[npm version] [CI] [npm downloads] [License: MIT] [Node.js]
An MCP server that provides AI agents with a persistent, PostgreSQL-backed virtual filesystem. Supports session-isolated file operations, cross-session shared stores, glob/grep search, and Row Level Security — all exposed as standard Model Context Protocol tools.
Works with any MCP client: Claude Desktop, Claude Code, Cursor, Windsurf, Cline, and others.
Features
- Persistent file storage — files are stored in PostgreSQL and survive process restarts, container recycling, and redeployments
- Session isolation — each agent session gets its own namespace automatically, no configuration needed
- Cross-session stores — named persistent stores for sharing data between agents or for long-term agent memory
- 11 POSIX-style tools —
read,write,append,stat,ls,mkdir,rm,mv,glob,grep,stores - Glob and grep search — find files by pattern (
**/*.ts) or search content by regex, powered by PostgreSQL trigram indexes - Row Level Security — optional database-enforced isolation between sessions for multi-tenant deployments
- Zero config — auto-creates tables on first run with
VFS_AUTO_INIT=true
Use Cases
- Agent scratchpad — give LLM agents a persistent workspace to read/write files across tool calls
- Long-term agent memory — store notes, context, and knowledge across sessions using named stores
- Multi-agent collaboration — multiple agents share files through cross-session stores
- Sandboxed file operations — agents interact with a virtual filesystem instead of the host OS
- CI/CD artifact storage — persist build outputs, logs, and reports in a queryable filesystem
Why
Agents work well with filesystems for context management, but coupling storage to the agent runtime means data is lost when pods restart or containers are recycled. This MCP server decouples storage from runtime by moving file operations to PostgreSQL — giving agents persistent, isolated, and searchable file storage without touching the host filesystem.
Prerequisites
- Node.js 20 or later
- PostgreSQL 14 or later (with
pg_trgmextension — included in most distributions)
Quick Start
1. Set up PostgreSQL
2. Configure your MCP client
Add to your MCP client config (e.g., Claude Desktop claude_desktop_config.json or Claude Code .mcp.json):
That's it. VFS_AUTO_INIT=true creates the tables on first run.
3. Use the tools
Tool names are short POSIX-style names:
All tools return structured JSON responses.
Tools
All tools (except stores) accept an optional store parameter for cross-session persistent storage.
Session Management
Sessions are handled automatically — no session ID in tool parameters.
How it works:
Priority: transport sessionId > VFS_SESSION_ID env var > auto-generated UUID.
Resumable sessions
To resume a previous session across process restarts, set a deterministic session ID:
Cross-Session Stores
Named stores persist across sessions. Any session can read/write to a store by passing the store parameter:
Stores are auto-created on first use.
Environment Variables
Manual Database Setup
If you prefer to manage the schema yourself instead of using VFS_AUTO_INIT:
Row Level Security (optional)
RLS provides database-enforced session isolation. Even if application code has a bug that omits a WHERE session_id = clause, PostgreSQL itself prevents cross-session access.
Then configure the MCP server to connect as vfs_app:
Development
Requirements
- Node.js 20+
- Docker (for integration tests — runs PostgreSQL via testcontainers)
Commands
Testing
Tests use testcontainers to spin up real PostgreSQL instances in Docker. No mocks — the integration tests exercise actual SQL queries, trigram indexes, and RLS policies.
Session Cleanup
Ephemeral sessions can be cleaned up periodically:
The ON DELETE CASCADE on vfs_nodes handles file cleanup automatically. Persistent stores (created via the store parameter) are never affected.
License
MIT
Source: README.md at commit cfc45ed
Tools
0Version history
1- v0.2.2LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts