The Filesystem MCP Server is a Node.js implementation of the Model Context Protocol that provides secure file system access for AI agents like Claude. It allows AI assistants to read, write, and manipulate files within a defined project directory while maintaining security and optimizing token usage.
The simplest installation method is through your MCP host configuration file (like Roo/Cline's mcp_settings.json):
For npx:
{
"mcpServers": {
"filesystem-mcp": {
"command": "npx",
"args": ["@sylphlab/filesystem-mcp"],
"name": "Filesystem (npx)"
}
}
}
For bunx:
{
"mcpServers": {
"filesystem-mcp": {
"command": "bunx",
"args": ["@sylphlab/filesystem-mcp"],
"name": "Filesystem (bunx)"
}
}
}
Note: The server uses its Current Working Directory as the project root. Ensure your MCP Host launches the command with the cwd set to your project's root directory.
For containerized environments, use the official Docker image:
{
"mcpServers": {
"filesystem-mcp": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-v",
"/path/to/your/project:/app",
"sylphlab/filesystem-mcp:latest"
],
"name": "Filesystem (Docker)"
}
}
}
Remember to replace /path/to/your/project with your actual project path.
The Filesystem MCP Server provides a comprehensive set of file manipulation tools for AI agents:
Example agent interaction:
<use_mcp_tool>
<server_name>filesystem-mcp</server_name>
<tool_name>list_files</tool_name>
<arguments>{"path": "src", "recursive": true}</arguments>
</use_mcp_tool>
Example for reading:
<use_mcp_tool>
<server_name>filesystem-mcp</server_name>
<tool_name>read_content</tool_name>
<arguments>{"paths": ["src/index.ts", "package.json"]}</arguments>
</use_mcp_tool>
Example for writing:
<use_mcp_tool>
<server_name>filesystem-mcp</server_name>
<tool_name>write_content</tool_name>
<arguments>{
"operations": [
{"path": "src/new-file.js", "content": "console.log('Hello world');"}
]
}</arguments>
</use_mcp_tool>
Example for searching:
<use_mcp_tool>
<server_name>filesystem-mcp</server_name>
<tool_name>search_files</tool_name>
<arguments>{
"pattern": "function\\s+main",
"paths": ["src/**/*.ts"],
"context_lines": 2
}</arguments>
</use_mcp_tool>
Example for creating directories:
<use_mcp_tool>
<server_name>filesystem-mcp</server_name>
<tool_name>create_directories</tool_name>
<arguments>{"paths": ["new-dir/nested", "another-dir"]}</arguments>
</use_mcp_tool>
The server is optimized for AI agent interactions through:
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "filesystem-mcp" '{"command":"npx","args":["@sylphlab/filesystem-mcp"],"name":"Filesystem (npx)"}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:
{
"mcpServers": {
"filesystem-mcp": {
"command": "npx",
"args": [
"@sylphlab/filesystem-mcp"
],
"name": "Filesystem (npx)"
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.json2. Add this to your configuration file:
{
"mcpServers": {
"filesystem-mcp": {
"command": "npx",
"args": [
"@sylphlab/filesystem-mcp"
],
"name": "Filesystem (npx)"
}
}
}
3. Restart Claude Desktop for the changes to take effect