🔌

Filesystem MCP

Read, write, and manage files on the local filesystem

anthropic Repository January 15, 2025
npx @anthropic/mcp-filesystem

The Filesystem MCP server provides Claude with secure access to the local filesystem for reading and writing files.

Features

  • Read Files: Read content from any accessible file
  • Write Files: Create or update files
  • Directory Operations: List, create, and navigate directories
  • File Search: Find files by pattern or content
  • File Info: Get metadata like size, dates, permissions

Installation

npx @anthropic/mcp-filesystem

Configuration

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["@anthropic/mcp-filesystem", "/path/to/allowed/directory"],
      "env": {}
    }
  }
}

Security

The filesystem MCP only allows access to directories explicitly configured. This prevents unauthorized access to sensitive system files.

Recommended Setup

{
  "args": [
    "/home/user/projects",
    "/home/user/documents"
  ]
}

Available Tools

read_file

Read the contents of a file.

{
  "path": "/projects/app/src/index.ts"
}

write_file

Write content to a file.

{
  "path": "/projects/app/src/new-file.ts",
  "content": "export const hello = 'world';"
}

list_directory

List files and directories.

{
  "path": "/projects/app/src",
  "recursive": false
}

search_files

Search for files by pattern.

{
  "path": "/projects/app",
  "pattern": "*.ts",
  "content": "import React"
}

Best Practices

  1. Limit access to necessary directories only
  2. Use absolute paths for clarity
  3. Check file existence before operations
  4. Handle large files with streaming when possible