Skip to main content

Filesystem MCP server guide

Overview​

The Filesystem MCP server provides access to the local filesystem, allowing AI agents to read and write files as part of their workflows. Use it to try ToolHive volume mounts with a local directory.

Run the server from its npm package, @modelcontextprotocol/server-filesystem. It is not included in the built-in ToolHive registry, so add it as a custom server. ToolHive builds a container from the package and runs it with your volume mounts and permissions.

note

Since most AI agent host applications like IDEs already have access to your working directory, this MCP server is primarily useful for access to files outside your working directory, headless environments where the host application does not provide filesystem access, or for demonstrating MCP capabilities.

Usage​

Add a custom local server with these settings:

  • Protocol: npx
  • Package name: @modelcontextprotocol/server-filesystem@2.0.1
  • Name: filesystem
  • Transport protocol: stdio
  • Command arguments: /projects

In the Storage volumes section, add a local directory with /projects as its container path. Choose read-only or read-write access for the mount. If you choose a different container path, use that path in the command arguments too.

Security tip

Since the server does not require any network access, enable network isolation and do not add any hosts or ports to completely restrict its outbound network access.

Click Install server to build the container and start the server.

Sample prompts​

Here are some sample prompts you can use to interact with the Filesystem MCP server:

  • "List all files in the /projects directory"
  • "Read the contents of the file /projects/example.txt"
  • "Write 'Hello, World!' to the file /projects/hello.txt"
  • Mount only the directories or files required for your AI agent's tasks to minimize resource usage and improve performance.
  • Use read-only mounts for directories or files that do not need to be modified by the AI agent to prevent accidental changes.
  • Enable network isolation in the UI or use --permission-profile none in the CLI to block outbound network access.

Next steps​