Cette page est affichée en anglais. Une traduction française est en cours.
MCP ConfigsMar 29, 2026·2 min de lecture

Filesystem MCP Server — File Operations for AI

Official MCP server for safe filesystem operations. Read, write, search, and manage files and directories with configurable access controls. Essential for any AI coding workflow.

MCP Hub
MCP Hub · Community
Prêt pour agents

Staging sûr pour cet actif

Cet actif est d'abord staged. Le prompt copié demande à l'agent d'inspecter les fichiers staged avant d'activer scripts, config MCP ou config globale.

Stage only · 17/100Policy : staging
Surface agent
Tout agent MCP/CLI
Type
Mcp Config
Installation
Stage only
Confiance
Confiance : Established
Point d'entrée
Filesystem MCP Server — File Operations for AI
Commande de staging sûr
npx -y tokrepo@latest install 3e033d18-7057-487a-a2a7-5d7a228ffb06 --target codex

Stage les fichiers d'abord; l'activation exige la revue du README et du plan staged.

TL;DR
Filesystem MCP gives AI agents controlled read/write access to files and directories through the Model Context Protocol.
§01

What it is

Filesystem MCP Server is the official Model Context Protocol server for file system operations. It gives AI agents the ability to read, write, search, and manage files and directories. Access is controlled by specifying allowed directories in the configuration, preventing the agent from accessing files outside designated paths.

This server is essential for any AI coding workflow where the agent needs to interact with project files. It provides a structured, safe interface for file operations rather than unrestricted shell access.

§02

How it saves time or tokens

Without the Filesystem MCP server, agents rely on shell commands for file operations, which lack access controls and structured error handling. This server provides typed tool calls for reading, writing, searching, and listing files, with built-in path validation. The workflow gives you the MCP configuration JSON ready to paste.

§03

How to use

  1. Add the Filesystem MCP server to your .mcp.json:
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/path/to/allowed/dir"
      ]
    }
  }
}
  1. Restart your MCP-compatible client.
  1. The agent can now perform file operations within the allowed directory:
'Read the contents of src/index.ts'
'Create a new file at src/utils/helpers.ts'
'Search for all files containing TODO'
'List the directory structure of src/'
§04

Example

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/dev/projects/my-app",
        "/Users/dev/projects/shared-libs"
      ]
    }
  }
}

Multiple directories can be specified as separate arguments. The agent can access files in any of the listed directories but nowhere else.

§05

Related on TokRepo

§06

Common pitfalls

  • Forgetting to include a directory in the args list means the agent cannot access it, even if it is a subdirectory of an allowed path. List all needed directories explicitly.
  • The server validates paths on every operation. Symlinks that point outside allowed directories are blocked.
  • File write operations overwrite existing content by default. The agent should read a file before writing to avoid data loss.

Questions fréquentes

What operations does the Filesystem MCP server support?+

It supports reading files, writing files, creating directories, listing directory contents, moving/renaming files, searching file contents by pattern, and getting file metadata (size, modification time, permissions).

How does access control work?+

You specify allowed directories as command-line arguments when configuring the server. The server validates every file path against these directories and rejects operations that target files outside the allowed paths.

Can I give the agent read-only access?+

The server does not have a built-in read-only mode. To restrict write access, you can use operating system file permissions on the allowed directories. The server respects OS-level permissions.

Does this work with any AI agent?+

It works with any MCP-compatible client including Claude Code, Cursor, and other tools that implement the Model Context Protocol standard.

Can I allow access to my entire home directory?+

Technically yes, but it is not recommended. Restricting access to specific project directories limits the blast radius of any unintended file operations. Grant access only to directories the agent needs.

Sources citées (3)
🙏

Source et remerciements

Created by Anthropic. Licensed under MIT. modelcontextprotocol/servers — Official MCP reference servers.

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires