You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Improve Permission Handling in Filesystem MCP Server #239
Improve Permission Handling in Filesystem MCP Server
Issue
When using the Filesystem MCP server with Claude desktop app on macOS, there's a suboptimal user experience around system-level file permissions. Currently, permission prompts are triggered only after a failed file access attempt, leading to a jarring experience where:
User requests to read a file using read_file tool
Operation fails due to lack of permissions
Claude app prompts for system permissions
User has to retry the operation
Impact
This creates a poor user experience where:
Operations fail before permissions are established
Users see error messages before permission prompts
Multiple permission prompts might appear for different files
Operations need to be manually retried after granting permissions
Proposed Solution
Add a new check_permissions tool to the Filesystem MCP server that would:
Allow proactive permission checking before file operations
Trigger any needed system permission prompts upfront
Return clear status about which paths are accessible
Enable better error handling and user guidance
Implementation Details
New tool: check_permissions
Input: Array of paths to validate
Output: Mapping of paths to their permission status
Validates both MCP server allowed directories and system-level permissions
Triggers OS permission prompts in a controlled manner
Benefits
More predictable permission flow
Better user experience
Clearer feedback about access status
Reduced need for error recovery
Maintains separation of concerns within MCP architecture
Notes
While the ideal fix might involve changes to the Claude desktop app itself, this server-side solution provides a workable improvement within the current architecture.
Here's a suggested implementation for the check_permissions tool:
// Add new schema for permission checkconstCheckPermissionsArgsSchema=z.object({paths: z.array(z.string()),});// Add new function to check permissionsasyncfunctioncheckPathPermissions(paths: string[]): Promise<Record<string,boolean>>{constresults: Record<string,boolean>={};for(constrequestedPathofpaths){try{// First validate if path is allowedconstvalidPath=awaitvalidatePath(requestedPath);// Then check if we have read accesstry{awaitfs.access(validPath,fs.constants.R_OK);results[requestedPath]=true;}catch{results[requestedPath]=false;}}catch(error){results[requestedPath]=false;}}returnresults;}// Add to tools list in setRequestHandler(ListToolsRequestSchema...){name: "check_permissions",description:
"Check if the server has necessary permissions to access specified paths. "+"Use this tool before attempting other operations to ensure proper access. "+"Returns a mapping of paths to their permission status. This allows establishing "+"system-level permissions upfront.",inputSchema: zodToJsonSchema(CheckPermissionsArgsSchema)asToolInput,}// Add to tool handler switch statement in CallToolRequestSchemacase"check_permissions": {constparsed=CheckPermissionsArgsSchema.safeParse(args);if(!parsed.success){thrownewError(`Invalid arguments for check_permissions: ${parsed.error}`);}constresults=awaitcheckPathPermissions(parsed.data.paths);constformattedResults=Object.entries(results).map(([path,hasAccess])=>`${path}: ${hasAccess ? 'Access granted' : 'Access denied'}`).join('\n');return{content: [{type: "text",text: formattedResults}],};}
The permission handling UX issue described in the original issue has not been addressed in the current implementation. Adding a check_permissions tool would:
Improve user experience significantly
Enable better error handling in MCP clients
Provide a clean separation between path validation and permission checking
Follow established patterns in the existing codebase
The implementation would fit naturally with the existing tool architecture and security model.
Reacted by Ola Hungerford and Antonio Hofmeister Ribeiro
Thank you for the suggestion, and apologies for the long wait for a response.
These servers are reference implementations: they exist to show how each part of MCP is used, not to be general-purpose products, so new features are taken selectively (CONTRIBUTING.md). OS-level permission prompts are raised by the host application, not by an MCP server, so a check_permissions tool cannot trigger them and does not fit the reference server's purpose. This is not a judgment on the idea or on you; a server in the MCP Registry may well offer it, and anyone is welcome to build on these servers to do so. This is happening as part of the backlog triage in #4875.
Activity
rovo79 commentedon Dec 5, 2024
Proposed Code Changes
Here's a suggested implementation for the
check_permissionstool:jspahrsummers commentedon Dec 5, 2024
@rovo79 If you'd like to put those changes into a PR, we'd be happy to review! 🙏
olaservo commentedon Aug 17, 2025
@claude is this feature request still relevant based on your understanding of the current filesystem implementation?
claude commentedon Aug 17, 2025
Claude finished @olaservo's task —— View job
Feature Relevance Assessment
Based on my analysis of the current filesystem MCP server implementation, this feature request remains highly relevant and valuable.
Current Permission Handling Analysis
Current Implementation
The filesystem server currently handles permissions through:
validatePathfunction (src/filesystem/index.ts:78-117) validates that requested paths are within allowed directoriesProblem Still Exists
The original issue persists in the current implementation:
Proposed Solution Value
Benefits of
check_permissionsToolThe proposed
check_permissionstool would provide:Implementation Considerations
The proposed solution could be enhanced beyond the original comment:
Recommendation
✅ This feature should be implemented.
The permission handling UX issue described in the original issue has not been addressed in the current implementation. Adding a
check_permissionstool would:The implementation would fit naturally with the existing tool architecture and security model.
cliffhall commentedon Oct 19, 2026
Closing: out of scope for the reference servers.
Thank you for the suggestion, and apologies for the long wait for a response.
These servers are reference implementations: they exist to show how each part of MCP is used, not to be general-purpose products, so new features are taken selectively (
CONTRIBUTING.md). OS-level permission prompts are raised by the host application, not by an MCP server, so a check_permissions tool cannot trigger them and does not fit the reference server's purpose. This is not a judgment on the idea or on you; a server in the MCP Registry may well offer it, and anyone is welcome to build on these servers to do so. This is happening as part of the backlog triage in #4875.