The Filesystem MCP Server provides a Node.js implementation of the Model Context Protocol for filesystem operations, allowing you to perform various actions like reading, writing, and manipulating files and directories through a standardized interface.
Add the MCP server configuration to your claude_desktop_config.json
file using one of the following methods:
{
"mcpServers": {
"filesystem": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"--mount", "type=bind,src=/Users/username/Desktop,dst=/projects/Desktop",
"--mount", "type=bind,src=/path/to/other/allowed/dir,dst=/projects/other/allowed/dir,ro",
"--mount", "type=bind,src=/path/to/file.txt,dst=/projects/path/to/file.txt",
"mcp/filesystem",
"/projects"
]
}
}
}
Note: All directories must be mounted to /projects
by default. You can provide sandboxed directories by mounting them with specific paths, and add the ro
flag to make a directory read-only.
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/username/Desktop",
"/path/to/other/allowed/dir"
]
}
}
}
For manual installation in VS Code, add the following to your User Settings (JSON) file:
{
"mcp": {
"servers": {
"filesystem": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"--mount", "type=bind,src=${workspaceFolder},dst=/projects/workspace",
"mcp/filesystem",
"/projects"
]
}
}
}
}
{
"mcp": {
"servers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"${workspaceFolder}"
]
}
}
}
}
Alternatively, you can add these configurations to .vscode/mcp.json
in your workspace (without the mcp
key).
To read the contents of a file:
read_file
path
(string)To read multiple files at once:
read_multiple_files
paths
(string[])To create a new file or overwrite an existing one:
write_file
path
(string): File locationcontent
(string): File contentTo make selective edits to a file:
edit_file
path
(string): File to editedits
(array): List of edit operations
oldText
(string): Text to search fornewText
(string): Text to replace withdryRun
(boolean): Preview changes without applying (default: false)To create a new directory:
create_directory
path
(string)To list directory contents:
list_directory
path
(string)To move or rename files and directories:
move_file
source
(string)destination
(string)To search for files and directories:
search_files
path
(string): Starting directorypattern
(string): Search patternexcludePatterns
(string[]): Patterns to excludeTo get file or directory metadata:
get_file_info
path
(string)To list allowed directories:
list_allowed_directories
The server will only allow operations within directories explicitly specified via the args
parameter in your configuration. Always use the dryRun
option first when using the edit_file
tool to preview changes before applying them.
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 > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.