Give web AI chats (Gemini Web, Claude.ai, ChatGPT) a safe, scoped pass to your local folders — zero pip dependencies, pure Python 3.9+ standard library.
Local CLI quota exhausted while your browser AI subscription is sitting idle? FolderPass MCP exposes strictly allowlisted directories from your machine over a localhost Streamable HTTP + OAuth 2.1 (PKCE) server, ready to pair with Tailscale Funnel, Cloudflare Tunnel, or ngrok.
Most quick MCP file scripts either break in production (HTTP 400 on Transfer-Encoding: chunked from Gemini's backend) or give a cloud chat full delete/shell access with zero guardrails. FolderPass MCP focuses on real-world wire compatibility and defense-in-depth:
| Capability | Typical DIY MCP Script | FolderPass MCP |
|---|---|---|
| Runtime dependencies | Node.js / FastMCP / pip stack | 0 dependencies (Python 3.9+ stdlib) |
Chunked HTTP (Transfer-Encoding: chunked) |
Often breaks with HTTP 400 | Native RFC 9112 chunked decoder |
| Folder permissions | All-or-nothing read/write | Per-folder ro (read-only) & rw modes |
| Accidental AI edits | Permanent overwrite | Pre-edit shadow snapshots + folderpass undo |
| Secrets in workspace files | Sent verbatim to the cloud | Outbound Secret Shield auto-redaction |
High-risk tools (delete / download / shell) |
Enabled by default | Disabled & hidden by default (--allow-unsafe) |
| Restarting the server | Drops tokens, forces re-login | PIN-bound persistence (rotate PIN = revoke all) |
- Per-Folder
ro/rwAccess Modes
Mount source code as"mode": "ro"so web AI can read and search without ever altering a line, while mounting"notes"or"drafts"as"rw". - Pre-Edit Shadow Snapshots + One-Command Undo
Everywrite_file,replace_in_file,write_binary_file,move_or_rename, ordelete_pathsnapshots the original file first. Runfolderpass undo --latestanytime to revert — even on folders without Git. - Outbound Secret Shield + Native
chunkedSupport
Scans outgoingread_fileandsearch_textresponses for API keys (sk-...,ghp_...,AIza...,AKIA...), JWTs, auth headers, and PEM private keys, masking them as[REDACTED:<kind>]before leaving localhost. Handles RFC 9112 chunked requests natively so Gemini Custom Apps connect on the first try. - Safe-by-Default + Self-Diagnostics (
doctor&audit)
Generates a 16-character cryptographic PIN automatically, hides host filesystem paths on/authorize, blocksjavascript:/data:redirect injection and private-IP SSRF, logs every call to a secret-freeaudit.jsonl, and verifies live health withfolderpass doctor.
Any remote AI client supporting Streamable HTTP MCP + OAuth 2.1 (Dynamic Client Registration + PKCE S256):
- Gemini Web (
gemini.google.com→ Settings → Connected Apps → Custom Apps) - Claude Web (
claude.ai→ Settings → Connectors → Add custom connector) - ChatGPT Web (Developer Mode → Connectors)
git clone https://github.com/bwdeng1/folderpass-mcp.git
cd folderpass-mcp(Optional editable install: pip install --no-deps -e .)
Create workspaces.json (or run ./bin/folderpass init):
{
"notes": {
"path": "/Users/yourname/Documents/notes",
"mode": "rw"
},
"code": {
"path": "/Users/yourname/Documents/projects",
"mode": "ro",
"ignore": ["dist/**", "node_modules/**", "*.local"]
}
}Concise string format ({"notes": "/path/to/notes"}) is also supported and defaults to rw. Hot-reloaded automatically on save.
./bin/folderpass serve --config workspaces.json --port 8787Look for the printed 16-character Auth PIN (or pass --pin / FOLDERPASS_PIN).
Pick one tunnel in a second terminal:
- Tailscale Funnel (recommended — permanent fixed URL):
sudo tailscale funnel --bg 8787 # Optional: pass --public-url https://<machine>.<tailnet>.ts.net to `serve` - Cloudflare Quick Tunnel (zero signup, URL changes on restart):
cloudflared tunnel --url http://127.0.0.1:8787
- ngrok:
ngrok http 8787
- Copy your tunnel HTTPS URL and append
/mcp(e.g.https://your-host.ts.net/mcp). - In Gemini Web: Settings → Connected Apps → Custom Apps → Add → paste URL → Next.
- On the FolderPass authorization screen, review the mounted workspace badges (
RO/RW) and enter your PIN.
- Open a fresh chat, type
@to invoke your app, and test:List the mounted workspaces and summarize the README in
code.
./bin/folderpass doctor --config workspaces.json --port 8787 --public-url https://your-host.ts.net| Category | Tools | Requires rw |
Enabled by Default |
|---|---|---|---|
| Inspect & Search | list_workspaces, list_files, read_file, search_text, list_snapshots |
No (ro & rw) |
Yes |
| Edit | create_directory, write_file, replace_in_file, move_or_rename, write_binary_file |
Yes | Yes |
High-Risk (--allow-unsafe) |
delete_path, download_url_to_file, run_command |
Yes | No (hidden & rejected unless --allow-unsafe) |
- Loopback bind by default: Listens on
127.0.0.1only; remote traffic must enter through your authenticated HTTPS tunnel. - OAuth 2.1 + PKCE S256 + PIN lockout: 5 wrong PIN attempts trigger a 5-minute cooldown; tokens are stored with
0600permissions bound tosha256(pin)so rotating the PIN immediately invalidates every active session. Pass--ephemeral-tokensfor RAM-only sessions. - Strict path sandboxing: Every path is
resolve()-checked viais_relative_to(workspace_root)to defeat../traversal and symlink escapes. Default sensitive files (.env,.env.*,*.pem,*.key,id_rsa*,credentials.json,.ssh/**,.aws/**,.git/config) are blocked across listings, reads, writes, and searches. - SSRF guard: When
--allow-unsafeis enabled,download_url_to_fileresolves DNS targets and blocks private, loopback, link-local (169.254.x), and reserved IP ranges across redirects.
folderpass init [--output workspaces.json] [--workspace alias=/path[:ro|rw]] [--force]
folderpass serve [--config workspaces.json] [--host 127.0.0.1] [--port 8787]
[--pin PIN] [--public-url URL] [--state-dir DIR]
[--ephemeral-tokens] [--allow-unsafe] [--no-redact]
[--no-snapshots] [--show-paths-on-auth]
folderpass doctor [--config workspaces.json] [--host 127.0.0.1] [--port 8787] [--public-url URL]
folderpass undo [--list | --latest | <snapshot_id>] [--config workspaces.json] [--state-dir DIR]
folderpass audit [--tail 20] [--state-dir DIR]
python3 -m unittest discover -s tests -v



