Labsco
MCP SERVER

Filesystem MCP Server

by cyanheads

Read, write and reorganise files from an agent, with a session default path and search-and-replace that does not rewrite whole files.

Local Filesystem Access
Summary
Set the base directory before anything else.

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.

What it is

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.

What you get
  • `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
Requirements

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.

Setup effort

One command — npx -y @cyanheads/filesystem-mcp-server