PostgreSQL-backed virtual filesystem for AI agents with persistent, session-isolated storage.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
We haven't yet run this listing's install command through our automated sandbox check. This isn't a red flag β we're steadily working through the catalog.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
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.
read, write, append, stat, ls, mkdir, rm, mv, glob, grep, stores**/*.ts) or search content by regex, powered by PostgreSQL trigram indexesVFS_AUTO_INIT=trueAgents 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.
pg_trgm extension β included in most distributions)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.
Tool names are short POSIX-style names:
All tools return structured JSON responses.
| Tool | Parameters | Returns | Description |
|---|---|---|---|
read | path | {content, size} | Read file contents |
write | path, content | {path, size, has_parents} | Write file (creates parents automatically) |
append | path, content | {path, appended_bytes} | Append to file (creates if missing) |
stat | path | {exists, type?, size?, children?} | Check existence and get metadata |
ls | path | {entries: [{name, type}]} | List directory (dirs first, then alphabetical) |
mkdir | path | {path, already_existed} | Create directory and parents (mkdir -p) |
rm | path | {path, deleted} | Remove file or directory recursively |
mv | source, destination | {source, destination} | Move/rename file or directory |
glob | pattern | {files, count} | Find files by glob (e.g., **/*.ts, **/*.{js,ts}) |
grep | pattern, path_filter? | {matches, count} | Search file contents by regex |
stores | (none) | {stores, count} | List all persistent store names |
All tools (except stores) accept an optional store parameter for cross-session persistent storage.
Sessions are handled automatically β no session ID in tool parameters.
How it works:
| Transport | Session identity | Behavior |
|---|---|---|
| stdio | Auto-generated UUID per process | Each MCP connection = unique session |
| HTTP/SSE | Transport-provided sessionId | MCP protocol handles it |
| Any | VFS_SESSION_ID env var | Deterministic/resumable sessions |
Priority: transport sessionId > VFS_SESSION_ID env var > auto-generated UUID.
To resume a previous session across process restarts, set a deterministic session ID:
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.
| Variable | Required | Default | Description |
|---|---|---|---|
DATABASE_URL | Yes | β | PostgreSQL connection string |
VFS_AUTO_INIT | No | false | Auto-create tables on startup |
VFS_SESSION_ID | No | random UUID | Deterministic session ID |
VFS_ENABLE_RLS | No | false | Enable Row Level Security |
VFS_STORAGE_BACKEND | No | postgres | Storage backend type |
If you prefer to manage the schema yourself instead of using VFS_AUTO_INIT:
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:
| Command | Description |
|---|---|
npm run build | Compile TypeScript |
npm test | Run all tests (requires Docker) |
npm run test:unit | Run unit tests only |
npm run test:integration | Run integration tests only |
npm run lint | Run ESLint |
npm run lint:fix | Auto-fix lint issues |
npm run dev | Run with tsx (no build step) |
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.
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.
MIT
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/virtual-fs)<a href="https://allmcps.com/mcp/virtual-fs"><img src="https://allmcps.com/api/badge/virtual-fs?style=directory" alt="Virtual Fs on AllMCPs" /></a>