Skip to main content
Glama

fsgate-mcp

A filesystem MCP server you can actually switch off piece by piece. Read, search, create, edit, move, delete and (optionally) run commands in the folders you choose, with every tool and every folder individually controllable. Built so that chat UIs such as gemini.google.com can work on your local files, on Windows and Linux, with nothing hardcoded to your machine.

You (browser) ──► gemini.google.com ──► Google's cloud ──► https://<you>.ts.net/mcp ──► fsgate ──► your folders
                                                        (Tailscale Funnel, TLS)    (OAuth + passcode)

Why this exists

Gemini's web app supports custom MCP servers ("custom apps"), which gives you Google's newest models on your own files. But the connector is called from Google's servers, so localhost does not work: you need a public HTTPS URL, OAuth 2.1, and a server you can trust on the open internet. Existing filesystem servers are stdio-only, have no authentication, and are all-or-nothing. fsgate is the missing piece:

  • Modular control: 16 tools in five categories, switchable globally, per folder, and per connection (per OAuth grant). Presets for quick setup.

  • Built for the internet: OAuth 2.1 (PKCE, dynamic client registration), a consent page protected by a passcode, a strict redirect allowlist, Host and Origin checks, hashed token storage.

  • Safe defaults: no delete and no command execution until you turn them on, secrets (.env, keys, .git, .ssh...) denied everywhere, deletes go to a trash folder, writes are atomic, edits keep CRLF/BOM/encoding.

  • Portable: Node.js only, no native dependencies, config in standard per-OS locations, paths never hardcoded.

  • Also works as a plain stdio server for Claude Desktop, Cursor, VS Code and other local MCP clients.

Status: tested on Windows 11 and Ubuntu (WSL) with the official MCP SDK client, including full OAuth flows, and used live from the Gemini web app. Claude, ChatGPT, Perplexity and Mistral Le Chat custom connectors speak the same protocol and their redirect URIs are allowed by default, but they have not been tried against the real services; see docs/other-chat-apps.md. Gemini's availability depends on Google's eligibility rules; see docs/gemini-setup.md.

Related MCP server: AKIMCP

Quick start (Gemini)

Requirements: Node.js 20.12+, a personal Google account that has custom apps enabled in the Gemini web app (Google's requirements), and Tailscale with Funnel enabled (free).

git clone https://github.com/<your-user>/fsgate-mcp.git
cd fsgate-mcp
npm install          # also builds
npm link             # puts the `fsgate` command on your PATH (or use: node bin/fsgate.js ...)
  1. Create a config (it prints a passcode once; write it down):

    fsgate init --mode gemini --public-url https://<machine>.<tailnet>.ts.net --root ~/code/my-project

    Omit the flags to be asked interactively. --root can be repeated.

  2. Start the server:

    fsgate serve
  3. Publish it with Tailscale Funnel (second terminal):

    tailscale funnel --bg 8787
  4. Connect Gemini: gemini.google.com → Settings → Connected Apps → Add a custom app → paste https://<machine>.<tailnet>.ts.net/mcp → Next → approve on the fsgate consent page with your passcode.

  5. In a chat, type @ and pick the app, then ask: "List the files in my project and summarise the README."

Check anything that does not work with fsgate doctor (add --online to test the public URL). Full walkthrough: docs/gemini-setup.md, tunnel details: docs/tailscale-funnel.md.

Quick start (local clients, no network)

fsgate serve --transport stdio --root ~/code/my-project

For an MCP client that launches servers itself (Claude Desktop, Cursor, VS Code...):

{
  "mcpServers": {
    "fsgate": {
      "command": "fsgate",
      "args": ["serve", "--transport", "stdio", "--root", "/absolute/path/to/project"]
    }
  }
}

Use --read-only, --tools read_file,grep,glob or --preset readonly to narrow it. On Windows use forward slashes or doubled backslashes in JSON.

The tools

Category

Tool

What it does

read

list_roots

Shows exposed folders, which tools are on for each, and the path conventions

read

read_file

Read a file with line numbers; paging with offset/limit; returns a sha256 for safe edits

read

read_many_files

Read up to 20 files in one call

read

list_directory

Tree listing with depth, hidden files and sizes optional

read

stat_path

Type, size, mtime, mode, line endings, sha256

read

glob

Find files by pattern (**/*.ts), newest first

read

grep

Regex or literal search with context lines, three output modes, ReDoS-safe

create

create_file

New file; refuses to overwrite

create

create_directory

Create folders (recursive)

create

copy_path

Copy a file or folder (never follows symlinks)

modify

write_file

Overwrite or append; optional if_match hash against stale writes

modify

edit_file

Exact string replacement, CRLF-aware, single-match rule, diff in the result

modify

multi_edit

Several edits in one file, all-or-nothing

modify

move_path

Move or rename

delete

delete_path

Delete to a recoverable trash folder (or permanently, if configured)

exec

run_command

Run an allowlisted program. Off by default; see the warning below

All paths are written as @root/relative/path (or an absolute path inside a root). Tool results use the @root/... form, with one exception: list_roots prints each root's absolute path so you can see what is exposed.

Controlling what the model can do

Four independent layers, all cumulative:

  1. Preset (readonly, standard, full): standard = read + create + modify (the default). full adds delete. exec is never part of a preset.

  2. Global tool switches: fsgate tools disable grep, fsgate tools enable delete_path.

  3. Per-folder rules: mark a folder readOnly, or switch individual tools per root: fsgate tools disable edit_file --root docs. A tool is visible if at least one folder allows it and is re-checked against the folder it touches on every call.

  4. Per-connection grants (Gemini): on the consent page you tick which categories this connection may use. A connection you granted only read access to cannot see or call write tools, even if the server allows them.

Secrets stay out of reach regardless of the above: deny patterns (.env*, *.pem, *.key, id_rsa*, .ssh, .git, .aws, .npmrc by default) block every tool, and fsgate protects its own config file and data directory.

fsgate tools                    # table of every tool, globally and per folder
fsgate tools disable delete_path
fsgate tools enable run_command --root scripts   # --root takes a configured root name, not a path
fsgate tools preset readonly
fsgate tools roots add ~/notes --read-only
fsgate tools roots list

Config files and the full option reference: docs/configuration.md · docs/tools.md · docs/local-clients.md.

Where things live

Windows

Linux

Config

%APPDATA%\fsgate\config.json

~/.config/fsgate/config.json

Data (tokens, audit log, trash)

%LOCALAPPDATA%\fsgate

~/.local/state/fsgate

Override with --config, FSGATE_CONFIG, FSGATE_DATA_DIR. ./fsgate.config.json in the working directory is also picked up. Paths in the config accept ~, ${VAR} and %VAR%.

Security in one minute

  • The public endpoint is protected by OAuth 2.1 with PKCE. Nobody gets a token without typing your passcode on the consent page; five wrong attempts lock it for 15 minutes.

  • Only the fixed callbacks of the supported chat apps (and anything you add to auth.allowedRedirectUris) can receive authorisation codes.

  • Tokens are stored hashed. fsgate auth revoke-all kills every grant; fsgate passcode rotates the passcode and revokes everything.

  • Stop the Funnel (tailscale funnel reset) when you are not using it.

  • run_command is arbitrary code execution as you. An allowlist of git is fine; an allowlist containing python, node, powershell or bash lets the model run anything. It is off by default and per-folder opt-in.

  • Everything the model reads is sent to Google. Do not expose folders whose contents you would not paste into a chat.

Read docs/security.md before exposing anything sensitive.

Known limitations

  • Only Gemini has been tried live. The OAuth flows are tested with the official MCP SDK client on Windows 11 and Ubuntu, and with a real Gemini account. Claude, ChatGPT, Perplexity and Mistral Le Chat are allowed by default but untested; each has its own eligibility rules, and the Perplexity and Mistral redirect URIs come from vendor guides rather than their own docs. If one behaves differently, please open an issue.

  • The passcode lockout is global. Five wrong passcodes lock the consent page for 15 minutes for everyone, including you; anyone who finds your URL can trigger it. Restarting the server clears it. It protects the passcode, at the cost of availability.

  • run_command cannot reliably kill grandchildren on Windows if a started program spawns something that outlives it. Prefer not to enable it there, or allow only simple programs.

  • Search skips dot-files (use include_hidden), does not descend into symlinked folders, and ignores paths matched by .gitignore unless include_ignored is set. Paths deeper than 128 segments or 4096 characters are refused.

  • Large trees are slow, not unbounded. Every entry is path-checked, so a directory walk costs roughly a millisecond per file on Windows; scans stop at limits.maxFilesScanned.

  • Overlapping roots are rejected (one root inside another) so that the per-folder rules stay unambiguous.

  • Edits are serialised inside one server process only. If another program writes the same file at the same moment, fsgate's if_match hash and atomic-rename checks catch most conflicts but cannot rule out every race.

Troubleshooting

Symptom

Fix

Gemini cannot connect / times out

fsgate doctor --online; is fsgate serve running, is tailscale funnel status showing the port, does publicUrl match exactly?

Consent page says redirect URI not allowed

Copy the URI from the server log into auth.allowedRedirectUris

Passcode rejected

It is case-sensitive; after 5 failures wait 15 minutes or restart; reset with fsgate passcode

"Custom apps" missing in Gemini

Google restricts the feature (personal account, history on, region); see Google's help page

Tool says disabled

fsgate tools shows the effective state per folder

More in docs/troubleshooting.md.

Development

npm install
npm run typecheck
npm test            # unit, adversarial and end-to-end suites
npm run build

CI runs on Windows and Ubuntu with Node 20 and 22. See DESIGN.md for the architecture and the security contract every module is written against.

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      A
      maintenance
      Exposes a governed suite of 38 OAuth-gated MCP tools that let web-based AI chats and other clients read and edit files, run whitelisted shell commands, search, use Git, SQLite, browser automation, DevTools, background tasks, localhost services, clipboard, notifications, and ports on a user's own machine. It runs locally with folder scoping and a strict command whitelist, so remote clients gain a large operating surface without unrestricted shell access.
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Exposes an OAuth-gated MCP endpoint with a governed suite of 38 tools that let web-based AI chat clients work directly on your local machine — reading and editing files, running whitelisted shell commands, searching, using Git and SQLite, automating browsers, driving DevTools, managing background tasks and ports, and reaching localhost services, clipboard, and notifications. A strict command whitelist and folder-scoped access keep that remote operating surface safe by default.
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Exposes 38 OAuth-gated tools over one MCP endpoint so web-based AI clients like Claude, ChatGPT, and Grok can read and edit local files, run whitelisted shell commands, search content, use Git, SQLite, browser automation, DevTools, clipboard, notifications, ports, and background jobs on your own machine. A strict command whitelist and folder restrictions keep the local operating surface governable and safe by default.
      -
    • A
      license
      Not graded
      quality
      A
      maintenance
      Exposes a governed suite of 38 tools over a single OAuth-gated MCP endpoint, letting web-based AI chat clients read and edit local files, run whitelisted shell commands, search, use Git, inspect SQLite databases, and drive browser, DevTools, clipboard, and background-task workflows. It requires no system-wide install or admin rights and restricts access to folders and commands approved from a local control panel.
      MIT