plugin_filesystem is a clean-room, zero-dependency pure C99 rewrite of the
tool surface of
`modelcontextprotocol/servers` → `src/filesystem`,
reshaped as a SCORPIOX BOT connector plugin: one binary, four modes, no
shared-library requirements, and a sandbox you can actually read.
It is deliberately not the read-only files browser. files lets a human
look at files; filesystem lets an agent change them — inside a list of
directories you approve, and nowhere else.
| Slug | filesystem |
| Binary | plugin_filesystem (plugin_filesystem.exe on Windows) |
--meta | {"name":"filesystem","desc":"Allowlist FS","kind":"mcp","mcp":true,"daemon":false,"menus":false,"verified":"live"} |
| Category | devtools |
| Kind | MCP connector (--mcp, stdio JSON-RPC 2.0) |
| License | MIT |
| Mode | Trigger | Who calls it |
|---|---|---|
| Discovery | --meta / SX_PLUGIN_META=1 | scorpiox-bot-api /plugins, scorpiox-cli-botplugin, sx-connector-mcp |
| MCP tools | --mcp | sx-connector-mcp (the single MCP router) or any MCP client over stdio |
| Control API | ?action=… / ?format=json | the plugin page (behind require_node_auth()) |
| Setup page | GET | the browser, via the hub or the node directly |
./plugin_filesystem --meta
printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | ./plugin_filesystem --mcp
make && make test && make e2e
| Tool | Parameters | |
|---|---|---|
read_text_file | path, head?, tail? | read |
read_multiple_files | paths[] | read |
write_file | path, content | write (atomic) |
edit_file | path, edits[{oldText,newText}], dryRun? | write |
create_directory | path | write |
list_directory | path | read |
directory_tree | path, maxDepth?, excludePatterns? | read |
move_file | source, destination | write |
search_files | path, pattern, excludePatterns? | read |
get_file_info | path | read |
list_allowed_directories | — | read (never disableable) |
Behaviour worth knowing before you point an agent at it:
<path>.tmp-<pid>, is flushed,then renamed. A crash mid-write leaves the old file or the new one, never a
half-written file. tests/run.sh proves this by SIGKILLing the process
mid-request.
first match of its oldText. An exact match wins; failing that, a run of
whole lines matches when each line is equal ignoring leading and trailing
whitespace. If any edit fails to match, nothing is written and the
reply shows the closest numbered lines so the agent can re-copy oldText.
The file's own LF/CRLF choice is preserved.
operator's file is the one thing an unattended agent must not get. A
cross-device move falls back to copy-then-delete.
what to call instead.
Every path — from a tool call or an HTTP request — goes through the same gate:
.. segment anywhere. %2e%2e and %2f are decoded before this check, so encoding does not help.
realpath() on POSIX; GetFullPathNameA() then GetFinalPathNameByHandleA() on Windows. The check happens after symlink
resolution, which is the only order that means anything.
the path the operator configured and its realpath. That is what makes a
configured /tmp work on macOS, where the real path is /private/tmp
(lesson (cc)/(ah) from the upstream reference).
/proc, /sys, /dev are refused even under an allowed root; operator denied entries are refused on top of that.
symlinked leaf, so a link pointing out of the sandbox cannot be used as a
handle to write through.
# symlink escape is refused on read, write, edit and move
ln -s /etc/passwd ~/data/notes.txt
./plugin_filesystem --mcp <<< '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"write_file","arguments":{"path":"'$HOME'/data/notes.txt","content":"x"}}}'
# → isError: /root/data/notes.txt: path is outside the allowed directories
State lives outside the binary so it survives reinstalls:
~/.scorpiox/connectors/plugin_filesystem/roots.json
/workspace/.scorpiox/connectors/plugin_filesystem/roots.json (BotCloud)
%LOCALAPPDATA%\scorpiox\connectors\plugin_filesystem\roots.json (Windows)
{
"roots": ["/data/reports", "/srv/site"],
"denied": ["/srv/site/.env"],
"permissions": {
"write_file": false,
"move_file": false
}
}
$FS_ALLOWED_ROOTS (colon-separated, ; on Windows) overrides the file —that is how the test suite points the plugin at a fixture tree.
/workspace and $HOME (POSIX) or %USERPROFILE% and D:\codebases (Windows).
disabled tool answers with a refusal that says where to switch it back on, so
the agent gets an explanation instead of a missing tool.
list_allowed_directories cannot be disabled — it is how you debug a refusal.
GET /plugin_filesystem (or /plugins?plugin=plugin_filesystem through the
hub) serves the Allowed Roots & Permissions page: add and remove directories,
see each root's canonical form when it has drifted onto a symlink or a mount,
toggle each tool, and test a path against the sandbox before blaming a tool
for it. Bot theme tokens, ?embed=1, sx-theme handoff, zero CDN, zero
<script src=>, hub-proxy vs direct-route branching.
One router fronts every installed connector, so the agent's tool budget stays
flat however many you install (<connectors_dir>/mcp_plugins.json):
{
"mcpServers": {
"filesystem": {
"command": "~/.scorpiox/plugins/plugin_filesystem",
"args": ["--mcp"],
"slug": "filesystem"
}
}
}
make # native -> ./plugin_filesystem
make musl # static musl x86_64 (universal Linux)
make arm64 # static musl aarch64 (Pi 5 / ARM servers)
make win64 # MinGW-w64 static PE (Windows nodes)
make macos # Apple clang (run on a Mac)
make asan # ASan + UBSan
make fortify # -D_FORTIFY_SOURCE=2
make test # tests/run.sh — offline, no network
make e2e # tests/e2e.py — Playwright 1440 / 1024 / 390, dark + light
The only third-party code is the vendored MIT yyjson parser under
vendor/yyjson/, compiled in. There is no popen, no system, no fork, no
socket in the source — and tests/run.sh fails the build if any of them
appears.
tests/run.sh is offline and self-contained: it builds the binary, generates a
fixture tree under $TMPDIR, and asserts the whole contract — the --meta
shape, all 11 tool schemas, one call per tool, .. traversal (raw and
encoded), symlink escapes on read/write/edit/move, the deny list, permission
gating, 401 on every mutating action, the roots.json round-trip, the page
markup, the source invariants, an ASan/UBSan run of every tool including a
240-frame session, a fortified build, and a full-git-history secret scan.
tests/e2e.py serves the CGI through a loopback shim and drives the page with
Playwright at 1440/1024/390 in both themes, asserting no console errors an