Skip to content

About

Zero-dependency Python MCP server to safely connect Gemini, Claude & ChatGPT Web to local folders (ro/rw permissions, auto-snapshots & undo, outbound secret shield, OAuth 2.1 PKCE, native chunked HTTP).

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

FolderPass MCP

Python 3.9+ Zero Dependencies MCP Streamable HTTP License: MIT

English | 简体中文

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.


Why FolderPass MCP?

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)

4 Signature Safeguards

  1. Per-Folder ro / rw Access 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".
  2. Pre-Edit Shadow Snapshots + One-Command Undo
    Every write_file, replace_in_file, write_binary_file, move_or_rename, or delete_path snapshots the original file first. Run folderpass undo --latest anytime to revert — even on folders without Git.
  3. Outbound Secret Shield + Native chunked Support
    Scans outgoing read_file and search_text responses 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.
  4. Safe-by-Default + Self-Diagnostics (doctor & audit)
    Generates a 16-character cryptographic PIN automatically, hides host filesystem paths on /authorize, blocks javascript:/data: redirect injection and private-IP SSRF, logs every call to a secret-free audit.jsonl, and verifies live health with folderpass doctor.

FolderPass Secret Shield, RO guard, JSONL audit log, and snapshot undo


Supported Web Clients

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)

3-Minute Quickstart

1. Clone (no pip install needed)

git clone https://github.com/bwdeng1/folderpass-mcp.git
cd folderpass-mcp

(Optional editable install: pip install --no-deps -e .)

2. Configure mounted workspaces

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.

3. Start the local MCP server

./bin/folderpass serve --config workspaces.json --port 8787

Look for the printed 16-character Auth PIN (or pass --pin / FOLDERPASS_PIN).

FolderPass serve startup and doctor diagnostics

4. Expose a public HTTPS tunnel

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

5. Bind in Gemini / Claude / ChatGPT

  1. Copy your tunnel HTTPS URL and append /mcp (e.g. https://your-host.ts.net/mcp).
  2. In Gemini Web: Settings → Connected Apps → Custom Apps → Add → paste URL → Next.
  3. On the FolderPass authorization screen, review the mounted workspace badges (RO/RW) and enter your PIN.

FolderPass OAuth PIN authorization screen with RO/RW workspace badges

Gemini Web Custom Apps discovery showing 10 safe-mode tools

  1. Open a fresh chat, type @ to invoke your app, and test:

    List the mounted workspaces and summarize the README in code.

Gemini Web invoking FolderPass MCP to inspect workspaces and read local docs

6. Verify health anytime

./bin/folderpass doctor --config workspaces.json --port 8787 --public-url https://your-host.ts.net

Available MCP Tools

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)

Security Model

  • Loopback bind by default: Listens on 127.0.0.1 only; 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 0600 permissions bound to sha256(pin) so rotating the PIN immediately invalidates every active session. Pass --ephemeral-tokens for RAM-only sessions.
  • Strict path sandboxing: Every path is resolve()-checked via is_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-unsafe is enabled, download_url_to_file resolves DNS targets and blocks private, loopback, link-local (169.254.x), and reserved IP ranges across redirects.

CLI Reference

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]

Run Tests

python3 -m unittest discover -s tests -v

License

MIT

About

Zero-dependency Python MCP server to safely connect Gemini, Claude & ChatGPT Web to local folders (ro/rw permissions, auto-snapshots & undo, outbound secret shield, OAuth 2.1 PKCE, native chunked HTTP).

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages