FS Sandbox
Filesystem MCP server for AI agents with folder allow-lists, audit log and undo
FS Sandbox is an open-source MCP server for security. It runs locally on your machine and is started by your AI client.
- Pricing
- Open source
- Platforms
- CLI, macOS, Windows
- Runs
- Locally
- What it can do
- Can change data (2 tools)
- Version
- 0.2.1
Similar MCP servers
Install
Add with the CLI
Run in a terminal
claude mcp add fs-sandbox-mcp --env FS_SANDBOX_RW_DIR='<FS_SANDBOX_RW_DIR>' -- npx -y @cardinelabs/fs-sandbox-mcpAdd --scope user to use it in every project, or --scope project to share it in .mcp.json.
Or share it with your project
Add to .mcp.json
{
"mcpServers": {
"fs-sandbox-mcp": {
"command": "npx",
"args": [
"-y",
"@cardinelabs/fs-sandbox-mcp"
],
"env": {
"FS_SANDBOX_RW_DIR": "<FS_SANDBOX_RW_DIR>"
}
}
}
}Add to claude_desktop_config.json
{
"mcpServers": {
"fs-sandbox-mcp": {
"command": "npx",
"args": [
"-y",
"@cardinelabs/fs-sandbox-mcp"
],
"env": {
"FS_SANDBOX_RW_DIR": "<FS_SANDBOX_RW_DIR>"
}
}
}
}Settings → Developer → Edit Config, then quit and reopen Claude Desktop.
Add to ~/.cursor/mcp.json
{
"mcpServers": {
"fs-sandbox-mcp": {
"command": "npx",
"args": [
"-y",
"@cardinelabs/fs-sandbox-mcp"
],
"env": {
"FS_SANDBOX_RW_DIR": "<FS_SANDBOX_RW_DIR>"
}
}
}
}Use .cursor/mcp.json in a project to share it with the project.
Add to ~/.copilot/mcp-config.json
{
"mcpServers": {
"fs-sandbox-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@cardinelabs/fs-sandbox-mcp"
],
"env": {
"FS_SANDBOX_RW_DIR": "<FS_SANDBOX_RW_DIR>"
}
}
}
}Or put the same entry in .mcp.json at your workspace root to share it.
Add with the CLI
Run in a terminal
codex mcp add fs-sandbox-mcp --env FS_SANDBOX_RW_DIR='<FS_SANDBOX_RW_DIR>' -- npx -y @cardinelabs/fs-sandbox-mcpOr add to config.toml
Add to ~/.codex/config.toml
[mcp_servers.fs-sandbox-mcp]
command = "npx"
args = ["-y", "@cardinelabs/fs-sandbox-mcp"]
env = { FS_SANDBOX_RW_DIR = "<FS_SANDBOX_RW_DIR>" }Add to your client's MCP settings (most use this shape)
{
"mcpServers": {
"fs-sandbox-mcp": {
"command": "npx",
"args": [
"-y",
"@cardinelabs/fs-sandbox-mcp"
],
"env": {
"FS_SANDBOX_RW_DIR": "<FS_SANDBOX_RW_DIR>"
}
}
}
}Gemini CLI and Antigravity
Gemini CLI
Add to ~/.gemini/settings.json
{ "mcpServers": { "fs-sandbox-mcp": { "command": "npx", "args": [ "-y", "@cardinelabs/fs-sandbox-mcp" ], "env": { "FS_SANDBOX_RW_DIR": "<FS_SANDBOX_RW_DIR>" } } } }Or run: gemini mcp add -s user -e FS_SANDBOX_RW_DIR='<FS_SANDBOX_RW_DIR>' fs-sandbox-mcp npx -- -y @cardinelabs/fs-sandbox-mcp
Antigravity
Add to ~/.gemini/config/mcp_config.json
{ "mcpServers": { "fs-sandbox-mcp": { "command": "npx", "args": [ "-y", "@cardinelabs/fs-sandbox-mcp" ], "env": { "FS_SANDBOX_RW_DIR": "<FS_SANDBOX_RW_DIR>" } } } }Use .agents/mcp_config.json to add it to one workspace only.
Devin Desktop (formerly Windsurf)
Add to ~/.config/devin/mcp_config.json
{ "mcpServers": { "fs-sandbox-mcp": { "command": "npx", "args": [ "-y", "@cardinelabs/fs-sandbox-mcp" ], "env": { "FS_SANDBOX_RW_DIR": "<FS_SANDBOX_RW_DIR>" } } } }On Windows the file is %APPDATA%\devin\mcp_config.json. Use .devin/mcp_config.json to share it with a project.
Cline
Add to cline_mcp_settings.json
{ "mcpServers": { "fs-sandbox-mcp": { "command": "npx", "args": [ "-y", "@cardinelabs/fs-sandbox-mcp" ], "env": { "FS_SANDBOX_RW_DIR": "<FS_SANDBOX_RW_DIR>" } } } }Open it from the MCP Servers icon → Configure → Configure MCP Servers.
Zed
Add to Zed settings.json
{ "context_servers": { "fs-sandbox-mcp": { "command": "npx", "args": [ "-y", "@cardinelabs/fs-sandbox-mcp" ], "env": { "FS_SANDBOX_RW_DIR": "<FS_SANDBOX_RW_DIR>" } } } }Open it with zed: open settings file. Merge context_servers into the settings you already have.
JetBrains AI Assistant and Junie
AI Assistant
Add to Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add
{ "mcpServers": { "fs-sandbox-mcp": { "command": "npx", "args": [ "-y", "@cardinelabs/fs-sandbox-mcp" ], "env": { "FS_SANDBOX_RW_DIR": "<FS_SANDBOX_RW_DIR>" } } } }The AI Assistant docs only show command and args. If the env block is ignored, use Junie for this server.
Junie
Add to ~/.junie/mcp/mcp.json
{ "mcpServers": { "fs-sandbox-mcp": { "command": "npx", "args": [ "-y", "@cardinelabs/fs-sandbox-mcp" ], "env": { "FS_SANDBOX_RW_DIR": "<FS_SANDBOX_RW_DIR>" } } } }Use .junie/mcp/mcp.json to share it with a project.
Kiro
Add to ~/.kiro/settings/mcp.json
{ "mcpServers": { "fs-sandbox-mcp": { "command": "npx", "args": [ "-y", "@cardinelabs/fs-sandbox-mcp" ], "env": { "FS_SANDBOX_RW_DIR": "<FS_SANDBOX_RW_DIR>" } } } }Use .kiro/settings/mcp.json to add it to one workspace only.
Using several servers? Build one config file with the MCP config generator.
Configuration
FS_SANDBOX_RW_DIRFolder the agent can read and writeRequiredFS_SANDBOX_RO_DIROptional folder the agent can only readFS_SANDBOX_POLICYOptional JSON policy file (replaces the two folders above)
About FS Sandbox
Gives an AI agent read and write access to a local folder without letting it wander elsewhere. Access is defined by a declarative policy: roots marked read-only or read-write, deny patterns for secrets such as .env files, keys and .git, and an optional maximum file size. Paths are canonicalized with symlinks resolved, so the boundary holds even for files that do not exist yet.
Every read, write, denial and undo is written to a hash-chained JSONL audit log, so later edits or deletions in that log are detectable. Writes can be previewed with dry-run mode, and undo_last_write restores the previous content or removes a newly created file.
It runs entirely on the user's machine over stdio and is installed with npx, as a Claude Desktop extension, or as a Claude Code plugin. It suits developers and teams who want an agent to edit project files under tight, auditable limits.
Tools this server provides (4)
Taken from the project documentation; the running server may differ.
From the tool list in its README, going by the names, 2 of 4 tools change data.
From the server's own tool labels and tool names; not verified by us.
- read_fileName suggests: reads
- Read a file inside the allowed folders.
- list_dirName suggests: reads
- List the contents of a directory inside the allowed folders.
- write_fileName suggests: changes
- Write a file inside a read-write folder, with optional dry-run.
- undo_last_writeName suggests: changes
- Restore or remove the file changed by the most recent write.
What it does
- Declarative folder policy
- Define roots with read-only or read-write mode, deny patterns and a file size cap in one policy file.
- Symlink-safe path checks
- Paths are resolved and compared by components, which blocks prefix tricks and symlink escapes.
- Tamper-evident audit log
- Reads, writes, denials and undos are recorded in a hash-chained JSONL log stored locally.
- Dry-run writes
- Preview a file write before it is applied to the folder.
- Undo last write
- Restore the previous file content or remove a file the agent created.
- Zero-config setup
- Two environment variables are enough to start with one writable and one read-only folder.
Good for
- Letting a coding agent edit a project folder while keeping secrets and git metadata out of reach
- Reviewing an agent's file changes with dry-run previews before they land
- Giving an assistant read-only access to reference documents
- Keeping a verifiable record of every file action an agent takes
- Reverting an agent's most recent file change during a working session
Pricing
Open source
FS Sandbox FAQ
Does FS Sandbox send my files anywhere?
No. The server runs on your machine, collects no telemetry and sends nothing over the network. File contents reach only the AI client you connected.
Where is the audit log stored?
By default it is written to .fs-sandbox/audit.jsonl inside the writable folder.
Which file types are supported?
It handles text files only.
How long does undo history last?
Undo keeps history for the current session only.
Is FS Sandbox free?
Yes. FS Sandbox is open source, so you can use and self-host it for free.
How do I add FS Sandbox to Claude Code?
Run this command in your terminal: claude mcp add fs-sandbox-mcp --env FS_SANDBOX_RW_DIR='<FS_SANDBOX_RW_DIR>' -- npx -y @cardinelabs/fs-sandbox-mcp
What are the best alternatives to FS Sandbox?
The closest alternatives to FS Sandbox are Sanctuary, mcpcut, Headmesh Agent Sandbox, Dmcps and Stashbase.
Where this comes from
- Description: written from the project's README and its MCP Registry entry.
- Install steps: from the official MCP Registry entry.