Why Give AI Access to Your Files?
AI assistants are incredibly useful - until you need them to work with your actual files. You want Claude to summarize a long PDF, analyze a spreadsheet, review a contract, organize your notes, or process a batch of images. But by default, AI assistants live in a chat window with no access to your computer.
This is changing. Through MCP (Model Context Protocol), you can give AI secure, controlled access to specific files and folders on your machine. The AI can read documents, analyze data, search through files, and even create new ones - all while you maintain full control over what it can and cannot access.
This guide is for anyone who wants to connect AI to their files. We cover three methods - from the simplest to the most flexible - with clear setup instructions and honest security tradeoffs. No technical background required.
Safety First: What You Need to Know
Before setting up file access, let us address the most common concerns:
- Can AI delete my files? Only if you explicitly configure it to. The MCP Filesystem server can be set up as read-only. Claude Code asks for permission before any file modification. You are always in control.
- Does AI upload my files to the cloud? The file contents are sent to the AI provider's API as part of the conversation. This is necessary for the AI to read and understand the content. Check your provider's data retention policy - Anthropic does not use API data for training by default.
- Can AI access files I did not share? No. You explicitly specify which directories the AI can access. It cannot reach outside those boundaries. This is enforced at the server level, not just by asking the AI nicely.
- What about passwords and sensitive files? Never give AI access to directories containing passwords, API keys, or financial credentials. Keep sensitive files in separate directories from the ones you share.
Three Methods Compared
| Method | Who It Is For | File Location | Setup Difficulty | Security Control |
|---|---|---|---|---|
| MCP Filesystem | Anyone with Claude Desktop or Cursor | Your computer | Medium (edit config file) | High (directory-level control) |
| Google Drive MCP | Google Workspace users | Google Drive (cloud) | Medium (OAuth setup) | Medium (Google permissions) |
| Claude Code CLI | Developers comfortable with terminal | Your computer | Easy (zero config) | High (permission prompts) |
Method 1: MCP Filesystem Server (Any MCP Client)
The MCP Filesystem server is the most versatile option. It works with Claude Desktop, Cursor, and any other MCP-compatible client. You specify exactly which directories the AI can access.
Who It Is For
Anyone who uses Claude Desktop and wants AI to read files on their computer. This is the standard approach for non-developers and developers alike. It works for documents, code, images, and any other file type.
Setup Steps
Step 1: Make sure Node.js is installed. Open Terminal (macOS/Linux) or Command Prompt (Windows) and run node --version. If you see a version number (v18 or later), you are good. If not, download Node.js from nodejs.org.
Step 2: Open your Claude Desktop configuration file. The location depends on your operating system:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
If the file does not exist, create it.
Step 3: Add the Filesystem server configuration. Replace the directory paths with the folders you want AI to access:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/yourname/Documents",
"/Users/yourname/Projects"
]
}
}
}
You can list multiple directories. The AI will only be able to access files within these directories and their subdirectories. It cannot access anything outside these paths.
Step 4: Save the file and restart Claude Desktop completely (quit and reopen).
Step 5: Test by asking Claude: "List the files in my Documents folder" or "Read the file report.pdf from my Documents."
Security Controls
The Filesystem server enforces directory boundaries at the server level. Even if the AI were to request a file outside the configured directories, the server would deny the request. You can also:
- Grant read-only access by configuring the server without write tools
- Use symlinks to expose specific files without giving access to their parent directories
- Run multiple Filesystem servers with different access levels for different directories
What the AI Can Do
With Filesystem access, the AI can: read text files (documents, code, configs), list directory contents, search for files by name or content, create new files, edit existing files (if write access is enabled), and move or rename files. It works with any file type that can be read as text. Binary files (images, PDFs) can be listed and moved but their content interpretation depends on the AI's capabilities.
Method 2: Google Drive MCP (Cloud Files)
The Google Drive MCP server connects AI to your files stored in Google Drive. This is ideal if your documents, spreadsheets, and presentations live in Google Workspace.
Who It Is For
Teams and individuals who store most of their documents in Google Drive. It is particularly useful for processing Google Docs, Sheets, and Slides that do not exist as local files on your computer.
Setup Steps
Step 1: You need Google Cloud credentials (OAuth 2.0 client ID) to authenticate the MCP server. Go to the Google Cloud Console, create a project, enable the Google Drive API, and create OAuth 2.0 credentials.
Step 2: Add the Google Drive server to your Claude Desktop config:
{
"mcpServers": {
"google-drive": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-google-drive"],
"env": {
"GOOGLE_CLIENT_ID": "your-client-id.apps.googleusercontent.com",
"GOOGLE_CLIENT_SECRET": "your-client-secret"
}
}
}
}
Step 3: Restart Claude Desktop. On first use, you will be prompted to authorize access through a Google sign-in flow. You can choose which Drive folders to share.
For secure handling of credentials, see our MCP Server Environment Variables guide.
Security Controls
Google Drive MCP uses OAuth, so you authenticate with your actual Google account. You can revoke access at any time through your Google Account security settings. The server respects Google Drive's sharing permissions - it can only access files that your Google account can access.
What the AI Can Do
Search files in your Drive, read document contents, list folders, and export Google Docs/Sheets/Slides to various formats. The AI can read Google Docs as text, Google Sheets as structured data, and access any file you have stored in Drive.
Method 3: Claude Code CLI (Built-in File Access)
Claude Code has file access built in - no MCP server needed. It reads files in your current working directory automatically.
Who It Is For
Developers who are comfortable using the command line. Claude Code is designed primarily for coding tasks but works with any text file. It is the fastest way to give AI file access if you already have a terminal open.
Setup Steps
# Install Claude Code globally
npm install -g @anthropic-ai/claude-code
# Navigate to the directory with your files
cd /path/to/your/files
# Start Claude Code
claude
# Ask about your files
"Summarize all the markdown files in this directory"
"Find any files that mention 'budget' or 'Q3 results'"
"Read the file notes.txt and create an action items list"
That is it - no configuration files, no server setup. Claude Code automatically has access to files in the current directory and all subdirectories.
Security Controls
Claude Code asks for explicit permission before reading, editing, or creating files. Every file operation shows you exactly what will happen and waits for your approval. It respects .gitignore patterns, so ignored files are not automatically accessed. You can also create a .claudeignore file to exclude additional files.
What the AI Can Do
Read any text file, search file contents with grep-like functionality, create new files, edit existing files (with your permission), and run terminal commands. It handles code files, documents, configuration files, and any other text-based format. It can also read images for visual analysis.
File Type Support
| File Type | MCP Filesystem | Google Drive MCP | Claude Code CLI |
|---|---|---|---|
| Text files (.txt, .md, .csv) | Full support | Full support | Full support |
| Code files (.py, .ts, .js) | Full support | Full support | Full support |
| JSON / XML / YAML | Full support | Full support | Full support |
| Images (.png, .jpg) | List/move only | Metadata only | Visual analysis |
| PDFs | Binary (limited) | Export as text | Full support |
| Google Docs/Sheets | N/A | Full support | N/A |
Enterprise Considerations
If you are setting up AI file access for a team or organization, there are additional factors to consider:
- Data governance: Establish clear policies about which file types and directories can be shared with AI. Create an allow-list of approved directories rather than blocking specific ones.
- Audit logging: The MCP Filesystem server logs all file operations. Configure your logging infrastructure to capture these for compliance and auditing purposes.
- Access controls: Use your operating system's file permissions to enforce who can access what. The MCP server runs with the same permissions as the user who started it - it cannot bypass OS-level file permissions.
- Network isolation: For sensitive environments, ensure that the AI API calls go through your corporate proxy or VPN. Some organizations require all API traffic to be routed through approved endpoints.
- Data classification: If your organization classifies data (public, internal, confidential, restricted), only allow AI access to public and internal files. Never expose confidential or restricted files to AI assistants.
For a comprehensive security review, see our MCP Server Security Guide.
Sandboxing Explained
Sandboxing means restricting what software can do - limiting it to a safe area where it cannot cause harm to the rest of your system. Here is how each method implements sandboxing:
- MCP Filesystem: The server only serves files from the directories you specify in the configuration. It physically cannot access files outside those paths. This is the most explicit form of sandboxing - you draw the boundary yourself.
- Google Drive MCP: Access is controlled by Google's OAuth permissions. The server can only access files your Google account has permission to see. You can revoke access at any time from Google Account settings.
- Claude Code: Operates within the current working directory. Every file read, write, and command execution requires your explicit approval. You see exactly what the AI wants to do before it happens.
None of these methods give AI unrestricted access to your entire computer. Each one has boundaries that prevent the AI from reaching files or directories you have not approved. Learn more about building secure MCP setups with our first MCP server tutorial.
Next Steps
Ready to set up AI file access? Here is where to go:
- Start with the MCP Filesystem server - the most flexible option for local files.
- If your files live in Google Drive, set up the Google Drive MCP server.
- For developers, try Claude Code CLI - zero setup required.
- Set up additional MCP servers from the full server directory.
- Read the MCP Server Security Guide for comprehensive security best practices.
