This template is for self-hosted n8n instances only.
This n8n demonstrates how to build a simple FileSystem MCP server. Connecting to this server allows MCP clients and agents to list, read and create directories and files on the local machine or remote server.
A MCP server trigger is used and connected to 5 tools: 3 Execute Command tools and 2 custom workflow tools.
The 3 Execute Command tools allow for listing, searching and creating directories.
The 2 custom workflow tools are for reading and writing files to disk.
Special care has been to not allow the MCP agent to execute arbitrary linux commands on the target server. This is achieved by only allowing the agent to provide parameters such as filenames and paths rather than raw commands.
How to use
This Filesystem MCP server will write to the server which hosts the n8n instance - this can be your local machine or a remove server. If your target filesystem is on neither, then modify the commands to connect to the desired server.