Overview
Model Context Protocol (MCP) lets local AI clients call tools. The official filesystem server is the fastest way to give an assistant real read/write access to a repo, without exposing the rest of your machine. This guide covers installation, safe scoping, and a review-first workflow.
How it works
- Install the MCP filesystem server via npm or a prebuilt binary.
- Configure your MCP client with a list of allowed directories.
- The client (Claude Desktop, Cursor, etc.) sees new tools: read_file, write_file, list_directory, search_files.
- You approve tool calls per session or per call, depending on client policy.
Benefits
- No more paste-the-file-then-paste-the-diff dance.
- Scoped by directory — the model can only touch what you allow.
- Works across any MCP-compatible client, not just one vendor.
Use cases
- Refactoring a module with an assistant that can actually see it.
- Generating tests from source files without copy-paste.
- Automated code review of a diff before you commit.
Step-by-step guide
Step 1: Install the server
Run: npx -y @modelcontextprotocol/server-filesystem <allowed-dir>. Verify it starts and prints tool schemas.
Step 2: Configure Claude Desktop
Edit claude_desktop_config.json and add the server under mcpServers with the args array pointing at your project.
Step 3: Scope tightly
Never point the server at your home directory. Use one project root, ideally a git worktree so you can diff its output.
Step 4: Set an approval policy
Start with per-call approval. Once you trust the workflow, move to per-session for read tools only; keep write tools per-call.
Step 5: Add a review gate
After any write batch, ask the assistant to summarize changes and run git diff before you commit.