# FS Sandbox

> FS Sandbox is an open-source MCP server for security. Filesystem MCP server for AI agents with folder allow-lists, audit log and undo. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, macOS, Windows, Linux, Self-hosted
- **Repository:** https://github.com/cardinelabs/fs-sandbox-mcp
- **MCP Registry name:** io.github.cardinelabs/fs-sandbox-mcp
- **Categories:** [security](https://ai-powered.com/categories/security)
- **Listing updated:** 2026-11-27

## About

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.

## Features

- **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

## Install

### Claude Code: Add with the CLI (Terminal)

```sh
claude mcp add fs-sandbox-mcp --env FS_SANDBOX_RW_DIR='<FS_SANDBOX_RW_DIR>' -- npx -y @cardinelabs/fs-sandbox-mcp
```

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

### Claude Code: Or share it with your project (.mcp.json)

```json
{
  "mcpServers": {
    "fs-sandbox-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@cardinelabs/fs-sandbox-mcp"
      ],
      "env": {
        "FS_SANDBOX_RW_DIR": "<FS_SANDBOX_RW_DIR>"
      }
    }
  }
}
```

### Claude Desktop (claude_desktop_config.json)

```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.

### Cursor (~/.cursor/mcp.json)

```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.

### VS Code (~/.copilot/mcp-config.json)

```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.

### Codex: Add with the CLI (Terminal)

```sh
codex mcp add fs-sandbox-mcp --env FS_SANDBOX_RW_DIR='<FS_SANDBOX_RW_DIR>' -- npx -y @cardinelabs/fs-sandbox-mcp
```

### Codex: Or add to config.toml (~/.codex/config.toml)

```toml
[mcp_servers.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 (~/.gemini/settings.json)

```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

### Gemini CLI and Antigravity: Antigravity (~/.gemini/config/mcp_config.json)

```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 (~/.config/devin/mcp_config.json)

```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 (cline_mcp_settings.json)

```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 (Zed settings.json)

```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 (Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add)

```json
{
  "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.

### JetBrains AI Assistant and Junie: Junie (~/.junie/mcp/mcp.json)

```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 (~/.kiro/settings/mcp.json)

```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.

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "fs-sandbox-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@cardinelabs/fs-sandbox-mcp"
      ],
      "env": {
        "FS_SANDBOX_RW_DIR": "<FS_SANDBOX_RW_DIR>"
      }
    }
  }
}
```

## Tools

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_file` (name suggests: reads): Read a file inside the allowed folders.
- `list_dir` (name suggests: reads): List the contents of a directory inside the allowed folders.
- `write_file` (name suggests: changes): Write a file inside a read-write folder, with optional dry-run.
- `undo_last_write` (name suggests: changes): Restore or remove the file changed by the most recent write.

## 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.

## Alternatives

- [Sanctuary](https://ai-powered.com/mcp/sanctuary): Sanctuary is an open-source MCP server for security.
- [mcpcut](https://ai-powered.com/mcp/mcpcut): mcpcut is an open-source MCP server for security.
- [Headmesh Agent Sandbox](https://ai-powered.com/mcp/headmesh-agent-sandbox): Headmesh Agent Sandbox is an open-source MCP server for developer tools.
- [Dmcps](https://ai-powered.com/mcp/dmcps): Dmcps is an open-source MCP server for security.
- [Stashbase](https://ai-powered.com/mcp/stashbase): Stashbase is a freemium MCP server for security.
- [FreeRDC](https://ai-powered.com/mcp/freerdc): FreeRDC is an open-source MCP server for files and documents.
- [AtlaSent MCP Server](https://ai-powered.com/mcp/atlasent-mcp-server): AtlaSent MCP Server is a freemium MCP server for security.
- [NoData](https://ai-powered.com/mcp/nodata): NoData is an MCP server for security.

---
Source: https://ai-powered.com/mcp/fs-sandbox
