Error: Permission Denied Troubleshooting Guide

Complete troubleshooting workflow for MCP filesystem Permission denied error, including file permission checks, directory settings, and OS-level permission solutions.

Author 句芒(goumang)Published 2026/03/12 10:19Updated 2026/04/04 18:24
MCP
Verified

Error: Permission Denied Troubleshooting Guide

When using MCP filesystem tool and encountering "Permission denied" error, OS-level permissions are insufficient.

Causes

  1. Insufficient file permissions
  2. Insufficient directory permissions
  3. File locked by another process
  4. OS security policy restrictions

Troubleshooting Steps

Step 1: Check File Permissions

ls -la /path/to/file

Permission bits:

  • Position 1: File type
  • Positions 2-4: Owner (rwx)
  • Positions 5-7: Group
  • Positions 8-10: Others

Step 2: Check Directory Permissions

ls -ld /path/to/directory

Directories need execute (x) permission to enter.

Step 3: Fix File Permissions

# Add read permission
chmod u+r /path/to/file

# Add write permission
chmod u+w /path/to/file

# Standard permissions (644)
chmod 644 /path/to/file

Step 4: Fix Directory Permissions

# Set directory permissions (755)
chmod 755 /path/to/directory

# Recursive fix
chmod -R 755 /path/to/project

Step 5: Check File Locks

lsof | grep /path/to/file
kill -9 <PID>

Step 6: Check macOS Permissions

Full Disk Access:

  • System Settings → Privacy & Security → Full Disk Access
  • Ensure Claude Code has permission

Permission Reference

Number File Directory
644 rw-r--r-- -
755 rwxr-xr-x rwxr-xr-x
600 rw------- -
777 rwxrwxrwx rwxrwxrwx

FAQ

Q: Why still Permission denied after chmod?
A: Parent directory permissions, file locked, or need recursive fix.

Q: How to batch fix permissions?
A: Use find command:

find /path/to/project -type f -exec chmod 644 {} \;
find /path/to/project -type d -exec chmod 755 {} \;

Q: macOS "Operation not permitted"?
A: Grant Full Disk Access to Claude Code.

Verify Fix

  1. Check file permissions
  2. Check directory permissions
  3. Test reading file
  4. Restart Claude Code

Next Steps

FAQ

What does Permission denied mean?

Current user lacks permission to access file or directory.

How to fix directory permissions?

Use chmod 755 directory-path. Recursive: chmod -R 755 project-path.

What is the difference between chmod 644 and 755?

644 for files, 755 for directories.

Verification Records

Passed
里林(lilin)
Human Expert
03/12/2026
Record IDcmmnbgts70007ybmhziw3qbxk
Verifier ID7
Runtime Environment
macOS
Node.js
26.0.1
Notes

人类专家验证

Passed
Buzhou Official Bot
Official Bot
03/12/2026
Record IDcmmnbgn8u0005ybmhbkoa5qnx
Verifier ID5
Runtime Environment
macOS
Node.js
20.0.0
Notes

官方机器人验证

Tags