ai-filesystem-access

module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2026 License: MIT

README

ai-filesystem-access

ci Go Reference

Policy-controlled local filesystem access for AI assistants, over the Model Context Protocol (MCP). One filesystem engine, one authorization model, many AI clients — Claude Desktop, Claude Code, Kiro IDE/CLI, Codex and any other MCP client.

It is not a thin wrapper around filesystem calls. Every request goes through a central, default-deny authorization engine with per-client, per-directory, per-operation rules, physical path resolution (no string-prefix checks), symlink/hard-link/TOCTOU protection, sensitive-file protection, out-of-band human approvals for destructive operations, and a structured audit log. It never executes code.

Quick start

Install with Go 1.27+ (puts ai-filesystem-access in $(go env GOPATH)/bin):

go install github.com/mborchuk/ai-filesystem-access/cmd/ai-filesystem-access@latest

Or build from source:

git clone https://github.com/mborchuk/ai-filesystem-access.git && cd ai-filesystem-access
make build && sudo install -m 0755 bin/ai-filesystem-access /usr/local/bin/

Then:

ai-filesystem-access init
ai-filesystem-access clients add claude-desktop
ai-filesystem-access permissions grant --client claude-desktop --path ~/Work --access read_write
ai-filesystem-access setup claude-desktop --apply      # backup + preview + confirm; then restart Claude Desktop

Then ask the assistant to "call get_permissions" to see what it may do.

Install in your AI client

Every client follows the same three steps:

  1. Create a ai-filesystem-access client identity: ai-filesystem-access clients add <id>
  2. Grant it directories: ai-filesystem-access permissions grant --client <id> --path <dir> --access <profile>
  3. Register the server in the AI client so it runs ai-filesystem-access serve --client <id>

ai-filesystem-access setup <platform> prints the exact command or config entry for your machine, using the absolute path of the installed binary. The examples below assume /usr/local/bin/ai-filesystem-access. Use a different <id> per client if you want different permissions for each.

Claude Desktop (macOS, Windows)
ai-filesystem-access clients add claude-desktop
ai-filesystem-access permissions grant --client claude-desktop --path ~/Work --access read_write
ai-filesystem-access setup claude-desktop --apply    # backs up, previews, asks before writing

Or add it by hand (Settings → Developer → Edit Config). The file is ~/Library/Application Support/Claude/claude_desktop_config.json on macOS and %APPDATA%\Claude\claude_desktop_config.json on Windows:

{
  "mcpServers": {
    "files": {
      "command": "/usr/local/bin/ai-filesystem-access",
      "args": ["serve", "--client", "claude-desktop"]
    }
  }
}

Fully quit and restart Claude Desktop. Undo with ai-filesystem-access setup claude-desktop --rollback.

Claude Code (CLI)
ai-filesystem-access clients add claude-code
ai-filesystem-access permissions grant --client claude-code --path ~/Work --access read_write
claude mcp add --scope user files -- /usr/local/bin/ai-filesystem-access serve --client claude-code
claude mcp get files                      # check it's registered

Use --scope project to write a .mcp.json into the current project instead. Remove with claude mcp remove files --scope user.

Kiro IDE
ai-filesystem-access clients add kiro
ai-filesystem-access permissions grant --client kiro --path ~/Work/project-a --access read_write_no_delete
ai-filesystem-access setup kiro --apply              # edits ~/.kiro/settings/mcp.json with a backup

Or edit ~/.kiro/settings/mcp.json (all workspaces) or <workspace>/.kiro/settings/mcp.json (one workspace), from the command palette with "Kiro: Open user MCP config (JSON)":

{
  "mcpServers": {
    "files": {
      "command": "/usr/local/bin/ai-filesystem-access",
      "args": ["serve", "--client", "kiro"],
      "disabled": false,
      "autoApprove": []
    }
  }
}

Leave autoApprove empty unless you are happy for write and delete tools to run without Kiro asking you first.

Kiro CLI
ai-filesystem-access clients add kiro-cli
ai-filesystem-access permissions grant --client kiro-cli --path ~/Work/project-a --access read_only
kiro-cli mcp add --name files --scope global --command /usr/local/bin/ai-filesystem-access \
  --args serve --args --client --args kiro-cli

--scope global writes ~/.kiro/settings/mcp.json, which Kiro IDE also reads. To give the CLI its own permissions, use --scope workspace or --agent <name> instead. For non-interactive runs, trust only this server's tools: kiro-cli chat --no-interactive --trust-tools=@files "…".

OpenAI Codex (CLI and IDE extension)
ai-filesystem-access clients add codex
ai-filesystem-access permissions grant --client codex --path ~/Work/project-a --access read_only
codex mcp add files -- /usr/local/bin/ai-filesystem-access serve --client codex
codex mcp get files                       # check it's registered

This writes the following to ~/.codex/config.toml, which the CLI and the IDE extension share:

[mcp_servers.files]
command = "/usr/local/bin/ai-filesystem-access"
args = ["serve", "--client", "codex"]
Other MCP clients (stdio)

Most clients accept the same JSON shape as Claude Desktop. Point command at the binary and set args to ["serve", "--client", "<id>"]. Run ai-filesystem-access setup generic to print it.

Clients that only support HTTP
ai-filesystem-access clients add my-tool
ai-filesystem-access permissions grant --client my-tool --path ~/Work/shared --access read_only
ai-filesystem-access clients token-create my-tool    # prints the token once
ai-filesystem-access serve --transport http --listen 127.0.0.1:8765

Configure the client with URL http://127.0.0.1:8765/ and the header Authorization: Bearer <token>. It only listens on the local machine.

ChatGPT (web/desktop connectors): not supported

ChatGPT connectors need a public HTTPS server with OAuth and cannot start a local server. ai-filesystem-access deliberately offers neither. Use Codex instead.

Notes for every client
  • If the config file isn't in the default location, add "--config", "/path/to/config.yaml" to args, or set AI_FILESYSTEM_ACCESS_CONFIG in the server's environment.
  • CLIENT_UNKNOWN on every call means the --client id has no entry: run ai-filesystem-access clients add <id>.
  • Run ai-filesystem-access doctor to check the setup, and ai-filesystem-access audit list to see what each client did.
  • Tested status per platform is in PLATFORMS.md.

Permission profiles

read_only · read_write_no_delete · read_write · custom (operation list) · full_access (explicit, never default) · deny. Deny rules always win; otherwise the most specific rule applies; no rule means deny. Details: PERMISSIONS.md.

clients:
  claude-desktop:
    enabled: true
    directories:
      - {path: "~/Work", access: read_write}
      - {path: "~/Work/secrets", access: deny}
      - {path: "~/Documents", access: read_only}
  kiro:
    enabled: true
    directories:
      - {path: "~/Work/project-a", access: read_write_no_delete}

Tools

Read: list_directory, read_file, read_multiple_files, search_files, search_content, get_file_info, get_file_hash, get_permissions, check_access. Write: create_file, write_file, edit_file, create_directory, copy_file, move_file, rename_file, delete_file. Self-service: request_permission, get_audit_summary. Reference: MCP_TOOLS.md.

Documentation

INSTALLATION.md Install, configure clients, troubleshoot
PLATFORMS.md Compatibility matrix with test evidence
PERMISSIONS.md Profiles, operations, precedence, approvals
CONFIGURATION.md Full configuration reference, backups
SECURITY.md Threat model, controls, known limitations
ARCHITECTURE.md Components and request lifecycle
MCP_TOOLS.md Tools, schemas, error codes
DEVELOPMENT.md · CONTRIBUTING.md · CODE_OF_CONDUCT.md · CHANGELOG.md
docs/adr/ Architecture decision records

Important limitation

ai-filesystem-access governs access through MCP only. Agents that also have their own shell or file tools (Claude Code, Codex, Kiro) can bypass it as the same OS user; restrict those tools in the agent's own settings. See SECURITY.md.

Contributing and security

Contributions are welcome — see CONTRIBUTING.md. Report vulnerabilities privately via GitHub security advisories, not as public issues.

Status

Version 0.2.0. The test suite runs in CI on Linux, macOS and Windows. Not yet recommended as the sole control for production use; see SECURITY.md and CHANGELOG.md.

Directories

Path Synopsis
cmd
ai-filesystem-access command
Command ai-filesystem-access is a policy-controlled filesystem MCP server and its administration CLI.
Command ai-filesystem-access is a policy-controlled filesystem MCP server and its administration CLI.
internal
approval
Package approval implements the local, administrator-controlled approval workflow for destructive operations and permission requests.
Package approval implements the local, administrator-controlled approval workflow for destructive operations and permission requests.
audit
Package audit writes structured, append-only JSON Lines audit events.
Package audit writes structured, append-only JSON Lines audit events.
cli
Package cli implements the ai-filesystem-access command-line interface: the MCP server entry point and the trusted administration commands.
Package cli implements the ai-filesystem-access command-line interface: the MCP server entry point and the trusted administration commands.
config
Package config defines the ai-filesystem-access configuration schema, loading, validation and safe persistence.
Package config defines the ai-filesystem-access configuration schema, loading, validation and safe persistence.
fsops
Package fsops is the filesystem engine.
Package fsops is the filesystem engine.
glob
Package glob implements slash-separated glob matching with "**".
Package glob implements slash-separated glob matching with "**".
mcpserver
Package mcpserver exposes the filesystem engine as MCP tools over stdio and (loopback-only, token-authenticated) Streamable HTTP.
Package mcpserver exposes the filesystem engine as MCP tools over stdio and (loopback-only, token-authenticated) Streamable HTTP.
pathsec
Package pathsec performs secure, physical path resolution.
Package pathsec performs secure, physical path resolution.
platform
Package platform knows how each supported AI client is configured to launch an MCP server.
Package platform knows how each supported AI client is configured to launch an MCP server.
policy
Package policy is the central authorization engine.
Package policy is the central authorization engine.
testenv
Package testenv builds isolated, synthetic filesystem environments for tests.
Package testenv builds isolated, synthetic filesystem environments for tests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL