Skip to main content

MCP: filesystem

A safe, root-scoped filesystem MCP.

Security model

  • The server is started with one or more allowed root directories.
  • Tools require absolute paths.
  • All paths are resolved (including symlinks) and must be under one of the allowed roots.
  • If no roots are provided, the server exits (no implicit default like cwd).

Run (STDIO)

# Console script
better-mcps-filesystem /absolute/allowed/root1 /absolute/allowed/root2

# Module entrypoint
python -m better_mcps_filesystem /absolute/allowed/root1 /absolute/allowed/root2

Claude Desktop example

{
  "mcpServers": {
    "filesystem": {
      "command": "better-mcps-filesystem",
      "args": [
        "/absolute/allowed/root1",
        "/absolute/allowed/root2"
      ]
    }
  }
}

Docker example

When running this MCP in Docker, the server can only access paths inside the container. So you must mount any directories you want this MCP to be able to access (read/list today; edit/write if you add write tools later).

Build

From the filesystem/ directory:

docker build -t better-mcps-filesystem:latest .

Run

Mount the host directories into the container and pass the container paths as allowed roots.

docker run --rm -i \
  -v "/Users/erdelyia/Projects/project:/roots/project:rw" \
  -v "/Users/erdelyia/Projects/project2:/roots/project2:rw" \
  better-mcps-filesystem:latest \
  /roots/project /roots/project2

Notes:

  • -i keeps STDIN open (needed for MCP over stdio).
  • Use :rw if you expect the MCP to modify files; use :ro to force read-only.

VS Code example

VS Code supports variable substitution for the current workspace folder (your workdir). You can use that as the allowed root so the MCP is automatically scoped to the open workspace.

Example (conceptually):

{
  "mcpServers": {
    "filesystem": {
      "command": "better-mcps-filesystem",
      "args": ["${workspaceFolder}"]
    }
  }
}

If you use a multi-root workspace, VS Code can target a specific folder (e.g. ${workspaceFolder:my-folder}).

API

Tools

  • list_dir(params: object) -> str | dict

    • Params object (Pydantic-validated):
      • path (string, required): absolute directory path under an allowed root
      • max (int, default 200, max 2000)
      • format ("text"|"json", default "text")
      • detailed (bool, default false): include mode (permissions) and size
    • Includes hidden files; sorted by name
    • If output is truncated, a hint is included (text mode appends a line; json mode includes truncated/total/shown)
  • read_text_file(params: object) -> str

    • Params object:
      • path (string, required): absolute file path under an allowed root
    • file is read as UTF-8

Resources

  • resource://roots — returns list[str] of allowed root directories

Metadata

Release files for better-mcps-filesystem 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for better-mcps-filesystem 0.3.0
File Size Uploaded Provenance
better_mcps_filesystem-0.3.0.tar.gz 99.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for better-mcps-filesystem 0.3.0
File Interpreter ABI Platform
better_mcps_filesystem-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 104.7 kB

Release files / better_mcps_filesystem-0.3.0.tar.gz

Download URL better_mcps_filesystem-0.3.0.tar.gz
Size 99.1 kB
Tags Source
SHA-256 checksum
How to use checksums
81a56ddbf24183458605d7f023f590a2a394b10511c1f97a56be8cb114ae2e46
BLAKE2b-256 checksum
How to use checksums
8c9e5cc77f7e2bdb010d52fb3fa5670d29f2c66c83ce5d771ff74b732e76ef7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / better_mcps_filesystem-0.3.0-py3-none-any.whl

Download URL better_mcps_filesystem-0.3.0-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
af4cd5b64f98717eb25a28a5aee0ce1f2a8196bf6e07e2bbb6bd663a18c69b69
BLAKE2b-256 checksum
How to use checksums
fc2039ea16ac073342ed894f2696bc343b88f232791e36f12c7c83c8a54b56b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Security for better-mcps-filesystem 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page