It is optional, and leaving it unset means the tools can reach anywhere the process can — the server logs a warning and carries on, which is easy to miss. With it set, plus the session default path, an agent works in relative paths inside one tree, and the targeted replace tool means editing a config file does not require the model to reproduce the whole thing correctly.
A TypeScript MCP server exposing filesystem operations to AI agents, with path sanitization, schema-validated inputs, and a choice of stdio for local use or HTTP with JWT authentication for network use.
- `read_file` and `write_file` for whole-file reads and writes, creating parent directories as needed
- `update_file` — targeted search-and-replace blocks within an existing file, with plain text or regex, and an option to replace every occurrence
- `set_filesystem_default` — a default absolute path for the session, so later calls can use relative paths
- `list_files` with recursive listing, an entry cap, and a formatted tree as output
- `create_directory`, `delete_file`, `delete_directory` with an explicit recursive flag, `move_path` and `copy_path`
- Built-in path sanitization against directory traversal, and Zod validation on every input
Clone, install and build with npm, then point your client at the built entry point. `MCP_TRANSPORT_TYPE` chooses stdio or http; the HTTP path binds `MCP_HTTP_HOST` and `MCP_HTTP_PORT` and requires `MCP_AUTH_SECRET_KEY` of at least 32 characters for JWT authentication. Set `FS_BASE_DIRECTORY` to confine all operations to one directory tree — leave it unset and operations are not restricted, which the project warns against.
One command — npx -y @cyanheads/filesystem-mcp-server
