🌌 Setting Up Filesystem and Command-Line Execution MCP Servers for Claude Desktop: A Detailed Guide
The Claude Desktop application provides a dedicated environment for interacting with Claude’s advanced artificial intelligence capabilities directly on macOS and Windows operating systems 1. This integration offers users a streamlined workflow, allowing them to leverage Claude’s abilities without the need for a web browser 2. While Claude Desktop offers powerful features out of the box, its functionality can be significantly extended through the use of Model Context Protocol (MCP) servers. MCP is an open standard developed by Anthropic, designed to facilitate secure and standardized communication between large language models and external tools or data sources 3. By configuring MCP servers, users can unlock a new level of interaction with their local computer through Claude Desktop. This includes the ability to manage and work with local files and to execute command-line instructions, effectively creating a more powerful and customizable environment that shares similarities with Anthropic’s terminal-based coding tool, Claude Code 11. The underlying architecture of MCP follows a client-server model, where the Claude Desktop application functions as the client, initiating requests, and the configured MCP servers act as the providers of specific functionalities, fulfilling those requests in a modular and extensible manner 3.
🌟 Prerequisites: Installing Claude Desktop, Node.js, and npm
Before proceeding with the configuration of MCP servers, it is essential to ensure that the necessary software components are installed on your system. This includes the Claude Desktop application itself, as well as Node.js and npm (Node Package Manager), which are required for running the Filesystem MCP Server and some command-line servers.
⚡ Installing Claude Desktop
To begin, the Claude Desktop application needs to be installed. Users can download the appropriate version for their operating system (macOS or Windows) from the official Anthropic website, accessible via https://claude.ai/download or https://support.anthropic.com/en/articles/10065433-installing-claude-for-desktop 1. Currently, the Claude Desktop application does not officially support Linux 15. For macOS, the installation process involves downloading the installer file and following the on-screen instructions to install the application in the Applications folder 1. The system requirement for macOS is version 11 (Big Sur) or higher 1. For Windows, users need to download the Windows installer from the same download page and run the executable file to install Claude Desktop, which will typically be added to the Start menu 1. The required Windows version is Windows 10 or higher 1. Once installed, it is crucial to ensure that the Claude Desktop application is updated to the latest version. This can usually be done by opening the application, clicking on the Claude menu, and selecting “Check for Updates…” 15. Keeping the application up to date ensures access to the latest features and improvements.
⚡ Installing Node.js and npm
The Filesystem MCP Server and some command-line execution servers rely on Node.js and its package manager, npm 8. To check if these are already installed on your system, open your command line interface (Terminal on macOS, Command Prompt or PowerShell on Windows) and run the command node —version. Similarly, check for npm by running npm —version 8. If Node.js or npm are not installed, or if you have an older version, you will need to download and install them. Visit the official Node.js website at https://nodejs.org/ to download the appropriate installer for your operating system 8. It is generally recommended to download and install the LTS (Long-Term Support) version for better stability and ongoing support 30. As of the research conducted, the current LTS version is 22.14.0 30. Follow the installation instructions provided on the website.
npm is typically bundled with Node.js during the installation process 15. However, if you find that npm is not installed globally, you can install it by running the command npm install -g npm in your command line 19. Ensuring npm is installed globally is important as the npx command, which will be used to run the MCP servers, relies on npm for package execution 15.
🌟 Configuring the Filesystem MCP Server
The Filesystem MCP Server allows Claude Desktop to interact with your local file system, enabling tasks such as reading, writing, and searching files within specified directories 8. Configuration involves locating and editing the claude_desktop_config.json file.
⚡ Locating the claude_desktop_config.json file
The location of this configuration file varies depending on your operating system:
-
macOS: The file can be found in the following directory: ~/Library/Application Support/Claude/ 8.
-
Windows: The file is located in the %APPDATA%\Claude\ directory. You can access this directory by typing %APPDATA% in File Explorer’s address bar and pressing Enter 8. Alternatively, a convenient way to access this file is through the Claude Desktop application itself. Open Claude Desktop, navigate to “Settings…” from the Claude menu, select the “Developer” tab on the left, and click the “Edit Config” button 15. This action will either open the existing claude_desktop_config.json file or create a new one in the correct location if it doesn’t already exist 8.
⚡ Editing the claude_desktop_config.json file
Once you have located the claude_desktop_config.json file, open it in a text editor. If the file is empty or does not contain a “mcpServers” section, you will need to add the following structure, ensuring you replace “username” with your actual computer username and adjust the paths to the directories you wish Claude to access. It is crucial to use absolute paths for the directories.
⚡ Table 1: claude_desktop_config.json Location by Operating System
Operating System | File Path |
---|---|
macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |
Windows | %APPDATA%\Claude\claude_desktop_config.json |
For macOS/Linux:
JSON
{ “mcpServers”: { “filesystem”: { “command”: “npx”, “args”: [ “-y”, “@modelcontextprotocol/server-filesystem”, “/Users/username/Desktop”, “/Users/username/Downloads” ] } } }
For Windows:
JSON
{ “mcpServers”: { “filesystem”: { “command”: “npx”, “args”: } } }
If the file already has an “mcpServers” section, simply add the “filesystem” configuration block inside it. Ensure that the JSON syntax remains valid, using commas to separate entries. Windows users should be mindful of potential issues with spaces or special characters in file paths. In some cases, using the short name (8.3 format) of the path might be necessary as a workaround 35.
⚡ Restarting Claude Desktop
After editing and saving the claude_desktop_config.json file, it is essential to completely close the Claude Desktop application and then reopen it 8. A simple closing of the window might not be sufficient, as the application might continue running in the background 22. Ensure you quit the application fully (e.g., by right-clicking the Claude icon in the system tray on Windows or the menu bar on macOS and selecting “Quit”).
⚡ Verifying Filesystem MCP Server
Upon restarting Claude Desktop, a hammer icon should appear in the bottom right corner of the input box 8. Clicking on this icon will reveal the tools provided by the Filesystem MCP Server. These typically include read_file, write_file, and search_files, among others 8.
⚡ Table 2: Filesystem MCP Server Tools
Tool Name | Description |
---|---|
read_file | Reads the complete content of a file. |
write_file | Creates a new file or overwrites an existing one. |
search_files | Recursively searches for files and directories based on a pattern. |
read_multiple_files | Reads the content of multiple files simultaneously. |
create_directory | Creates a new directory or ensures it exists. |
list_directory | Lists the contents of a directory. |
move_file | Moves or renames files and directories. |
get_file_info | Retrieves detailed metadata about a file or directory. |
list_allowed_directories | Lists all directories the server is allowed to access. |
edit_file | Makes selective edits to a file using pattern matching. |
If the hammer icon does not appear, it indicates that the Filesystem MCP Server has not been configured correctly or is not running. In such cases, it is advisable to check the Claude Desktop logs for any error messages. The logs can be found in ~/Library/Logs/Claude/ on macOS and %APPDATA%\Claude\logs\ on Windows 15. Common issues to check include incorrect JSON syntax in the claude_desktop_config.json file, invalid or relative file paths, and problems with the Node.js or npm installation 8.
🌟 Configuring Command-Line Execution MCP Server (using Desktop Commander as an example)
To enable Claude Desktop to execute command-line commands, a command-line execution MCP server needs to be configured. Desktop Commander is a popular example of such a server, which also extends the functionality to include file system search and diff file editing capabilities 37. There are several methods to install and configure Desktop Commander:
1. Method 1 (using Smithery): Open your terminal and run the following command: Bash npx -y @smithery/cli install @wonderwhy-er/desktop-commander —client claude
This method uses the Smithery CLI to automatically install Desktop Commander for Claude Desktop 37. 2. Method 2 (using npx): Open your terminal and execute: Bash npx @wonderwhy-er/desktop-commander setup
This command will install dependencies, build the server, and configure Claude’s desktop app 37. Restart Claude Desktop after running this command. 3. Method 3 (manual configuration in claude_desktop_config.json): Open the claude_desktop_config.json file as described earlier and add the following entry within the “mcpServers” section: JSON { “desktop-commander”: { “command”: “npx”, “args”: [ “-y”, “@wonderwhy-er/desktop-commander” ] } }
Save the file and restart Claude Desktop 37. 4. Method 4 (local checkout): Open your terminal and run the following commands: Bash git clone https://github.com/wonderwhy-er/ClaudeComputerCommander.git cd ClaudeComputerCommander npm run setup
This involves cloning the Desktop Commander repository locally and then running the setup script. Restart Claude Desktop after completion 37. After using any of these methods, it is crucial to completely close and restart the Claude Desktop application. Upon restarting, the hammer icon should still be present. Clicking on it should now reveal additional tool categories provided by Desktop Commander, such as “Terminal Tools” (e.g., execute_command), “Filesystem Tools” (e.g., read_file, search_files), and “Edit Tools” (e.g., edit_block) 37.
⚡ Table 3: Desktop Commander Tool Categories and Example Tools
Tool Category | Example Tools |
---|---|
Terminal Tools | execute_command, read_output, list_processes |
Filesystem Tools | read_file, write_file, search_files |
Edit Tools | edit_block, write_file |
🌟 Using the Configured MCP Servers
Once both the Filesystem MCP Server and the command-line execution MCP Server (like Desktop Commander) are configured, you can start interacting with them through Claude Desktop.
⚡ Filesystem MCP Server
With the Filesystem MCP Server set up, you can ask Claude to perform various actions on the directories specified in your claude_desktop_config.json file 8. For example, you can ask Claude to:
-
“Create a file Desktop/my_note.txt with ‘This is a test note’ as content.”
-
“List all files in my Downloads folder.”
-
“Move the file Desktop/old_file.txt to Downloads/.”
It is important to note that Claude will typically ask for your permission before executing any file system operations, providing a layer of security and control 15.
⚡ Command-Line Execution MCP Server (Desktop Commander)
When Desktop Commander is configured, you can instruct Claude to execute terminal commands on your behalf 37. Examples of prompts you can use include:
-
“Execute the command ls -l in the terminal.”
-
“Run the command pwd to see the current directory.”
-
“Execute the command ping google.com -c 3.”
Similar to file system operations, Claude will likely request your authorization before executing any terminal commands, ensuring that no unintended actions are performed on your system 37.
🌟 Troubleshooting Common Issues
Setting up MCP servers can sometimes present challenges. Here are some common issues and potential solutions:
-
Incorrect JSON syntax in claude_desktop_config.json: Use an online JSON validator to check if your configuration file has any syntax errors 38.
-
Invalid or relative file paths: Ensure that all file paths specified in the configuration are absolute paths and that they exist on your system 15.
-
Node.js or npm not installed or working correctly: Verify that Node.js and npm are installed by checking their versions in the terminal. If not, reinstall them from the official website 8.
-
Errors reported in Claude Desktop logs: Check the log files located in ~/Library/Logs/Claude/ (macOS) or %APPDATA%\Claude\logs\ (Windows) for any error messages related to MCP servers 15.
-
MCP server failing to start: Try running the command to start the MCP server manually in your terminal. This can help identify any specific errors preventing the server from launching 15.
-
npx command not found: This usually indicates that npm is either not installed or not added to your system’s PATH. Ensure npm is installed globally using npm install -g npm 15.
-
Firewall issues: If you encounter connection errors, especially with other types of MCP servers, check your firewall settings to ensure that the necessary ports are open 40.
-
Environment variable issues (Windows): If you see errors related to %APPDATA% in paths, try explicitly setting the expanded value of this environment variable in the env section of your configuration 15.
-
Node version conflicts: Using a Node version manager like nvm (for macOS/Linux) or nvm-windows can help manage multiple Node.js versions and avoid conflicts 22.
🌟 Security Considerations
Granting file system access and command-line execution capabilities to an AI model introduces potential security risks that users should be aware of 37. It is crucial to adopt a security-conscious approach when configuring and using these features.
-
Principle of Least Privilege: Only allow Claude access to directories that are absolutely necessary for your intended use cases 37. Consider creating a dedicated folder for Claude’s interactions to limit its access to sensitive areas of your file system 22.
-
Exercise Caution: Carefully review and understand any commands or file system operations suggested by Claude before authorizing them 37. Only approve actions that you trust and are familiar with.
-
Keep Software Updated: Regularly update your Node.js and npm installations to benefit from the latest security patches and fixes 37.
-
Review Third-Party Servers: If you use MCP servers from third-party sources, thoroughly review their documentation and security features to understand their potential impact on your system 37.
-
Permission System: Be aware that Claude Desktop and the MCP framework include a permission system that requires explicit user approval for sensitive operations before they are executed 41.
-
Safeguards: Claude Code, which shares underlying technology with Claude Desktop’s MCP integration, includes safeguards against prompt injection and command injection attacks 41. However, users should still remain vigilant.
-
Broader AI Security Risks: Understand the general security risks associated with AI models, such as data breaches, adversarial attacks, and prompt injection, and how these might relate to granting local system access 43.
-
Best Practices: Implement general AI security best practices, including input sanitization and establishing an incident response plan, where applicable 45.
🌟 Conclusion
By following these detailed steps, users can successfully set up the Filesystem MCP Server and a command-line execution MCP Server (like Desktop Commander) for their Claude Desktop application. This configuration significantly enhances the capabilities of Claude Desktop, allowing for seamless interaction with local files and the execution of system commands, thereby automating workflows and creating a more integrated AI experience. It is important to remember the security considerations and to exercise caution when granting an AI model access to local resources.
🔧 Works cited
1. Installing Claude for Desktop | Anthropic Help Center, accessed on March 26, 2025, https://support.anthropic.com/en/articles/10065433-installing-claude-for-desktop 2. Claude AI Desktop App | Installation, Features, and Usage, accessed on March 26, 2025, https://claudeaihub.com/claude-ai-desktop-app/ 3. Anthropic Publishes Model Context Protocol Specification for LLM App Integration - InfoQ, accessed on March 26, 2025, https://www.infoq.com/news/2024/12/anthropic-model-context-protocol/ 4. Model Context Protocol (MCP): A Guide With Demo Project - DataCamp, accessed on March 26, 2025, https://www.datacamp.com/tutorial/mcp-model-context-protocol 5. An Introduction to Model Context Protocol - MCP 101 - DigitalOcean, accessed on March 26, 2025, https://www.digitalocean.com/community/tutorials/model-context-protocol 6. Model Context Protocol for Dummies - Modelmetry, accessed on March 26, 2025, https://modelmetry.com/blog/model-context-protocol-for-dummies 7. Introducing the Model Context Protocol - Anthropic, accessed on March 26, 2025, https://www.anthropic.com/news/model-context-protocol 8. Setting up Claude Filesystem MCP - Medium, accessed on March 26, 2025, https://medium.com/@richardhightower/setting-up-claude-filesystem-mcp-80e48a1d3def 9. Model Context Protocol: Introduction, accessed on March 26, 2025, https://modelcontextprotocol.io/introduction 10. modelcontextprotocol.io, accessed on March 26, 2025, https://modelcontextprotocol.io/introduction#:~:text=MCP%20is%20an%20open%20protocol,C%20port%20for%20AI%20applications. 11. Supercharge Your Claude Desktop Experience: How MCP Servers Create a Claude Code-Like Environment | by Ravi Kiran Vemula | Feb, 2025 | Medium, accessed on March 26, 2025, https://medium.com/@vrknetha/supercharge-your-claude-desktop-experience-how-mcp-servers-create-a-claude-code-like-environment-7e984c802107 12. How to install the Claude app on desktop - Techloy, accessed on March 26, 2025, https://www.techloy.com/how-to-install-claude-app-on-desktop/ 13. Download - Claude, accessed on March 26, 2025, https://claude.ai/download 14. How To Install Claude For Windows For Free In 2 Minutes - YouTube, accessed on March 26, 2025, https://www.youtube.com/watch?v=iAFlMzoasX4 15. For Claude Desktop Users - Model Context Protocol, accessed on March 26, 2025, https://modelcontextprotocol.io/quickstart/user 16. How To Install Claude Computer Use (MAC) | Complete Step-by-step Guide - YouTube, accessed on March 26, 2025, https://www.youtube.com/watch?v=IG_jZ7KoJ4c 17. Install Node on macOS, Windows, and Linux - Ghost, accessed on March 26, 2025, https://ghost.org/tutorials/node/ 18. How to Install Node.js and NPM on Windows and Mac? - Radixweb, accessed on March 26, 2025, https://radixweb.com/blog/installing-npm-and-nodejs-on-windows-and-mac 19. Installing Node.js Tutorial: macOS - NodeSource, accessed on March 26, 2025, https://nodesource.com/blog/installing-nodejs-tutorial-mac-os-x 20. How to Install NodeJS on MacOS - GeeksforGeeks, accessed on March 26, 2025, https://www.geeksforgeeks.org/how-to-install-nodejs-on-macos/ 21. How to Install NPM and Node.js on Mac | phoenixNAP KB, accessed on March 26, 2025, https://phoenixnap.com/kb/install-npm-mac 22. My Claude Workflow Guide: Advanced Setup with MCP External Tools : r/ClaudeAI - Reddit, accessed on March 26, 2025, https://www.reddit.com/r/ClaudeAI/comments/1ji8ruv/my_claude_workflow_guide_advanced_setup_with_mcp/ 23. How to Install Node.js and npm on Windows, macOS & Linux - Kinsta, accessed on March 26, 2025, https://kinsta.com/blog/how-to-install-node-js/ 24. How to Install Node.js on Windows: Top 4 Methods - GeeksforGeeks, accessed on March 26, 2025, https://www.geeksforgeeks.org/install-node-js-on-windows/ 25. Set up Node.js on native Windows - Learn Microsoft, accessed on March 26, 2025, https://learn.microsoft.com/en-us/windows/dev-environment/javascript/nodejs-on-windows 26. Downloading and installing Node.js and npm, accessed on March 26, 2025, https://docs.npmjs.com/downloading-and-installing-node-js-and-npm/ 27. [How-To] Install Node.js on Windows the Recommended Way - Reddit, accessed on March 26, 2025, https://www.reddit.com/r/node/comments/12bo3vz/howto_install_nodejs_on_windows_the_recommended/ 28. Use Claude Desktop and MCP Servers to Automate Your Desktop & Coding Workflow., accessed on March 26, 2025, https://medium.com/@mknebel/how-to-automate-your-workflow-wtih-claude-desktop-and-mcp-servers-5072844b86d1 29. ryaker/CommandExecution: Command Execution MCP Server for Claude Desktop - GitHub, accessed on March 26, 2025, https://github.com/ryaker/CommandExecution 30. Node.js Releases, accessed on March 26, 2025, https://nodejs.org/en/about/previous-releases 31. Node.js — Run JavaScript Everywhere, accessed on March 26, 2025, https://nodejs.org/en 32. Node.js - endoflife.date, accessed on March 26, 2025, https://endoflife.date/nodejs 33. Download Node.js, accessed on March 26, 2025, https://nodejs.org/en/download 34. How Does npx Actually Work and When to Use It - DEV Community, accessed on March 26, 2025, https://dev.to/orlikova/understanding-npx-1m4 35. TUTORIAL: GET MCP WORKING ON WINDOWS : r/ClaudeAI - Reddit, accessed on March 26, 2025, https://www.reddit.com/r/ClaudeAI/comments/1h1mmi8/tutorial_get_mcp_working_on_windows/ 36. filesystem MCP server doesn’t support legal Windows pathnames in claude_desktop_config.json · Issue #447 - GitHub, accessed on March 26, 2025, https://github.com/modelcontextprotocol/servers/issues/447 37. wonderwhy-er/DesktopCommanderMCP: This is MCP server for Claude that gives it terminal control, file system search and diff file editing capabilities - GitHub, accessed on March 26, 2025, https://github.com/wonderwhy-er/ClaudeDesktopCommander 38. Using an MCP Server and Claude to Work with Local Files | by …, accessed on March 26, 2025, https://sebastian-petrus.medium.com/mcp-server-claude-work-with-local-files-594f332a7084 39. How to work with Local Files Directly Using an MCP Server and Claude - Apidog, accessed on March 26, 2025, https://apidog.com/blog/local-file-mcp-server 40. claude-desktop-setup.md - aliargun/mcp-server-gemini - GitHub, accessed on March 26, 2025, https://github.com/aliargun/mcp-server-gemini/blob/main/docs/claude-desktop-setup.md 41. Claude Code overview - Anthropic API, accessed on March 26, 2025, https://docs.anthropic.com/s/claude-code-security 42. Claude Code overview - Anthropic, accessed on March 26, 2025, https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview 43. AI Security: Risks, Frameworks, and Best Practices - Perception Point, accessed on March 26, 2025, https://perception-point.io/guides/ai-security/ai-security-risks-frameworks-and-best-practices/ 44. Understanding AI Threats: Prompt Injection Attacks - HITRUST, accessed on March 26, 2025, https://hitrustalliance.net/blog/understanding-ai-threats-prompt-injection-attacks 45. AI security explained: How to secure AI - Wiz, accessed on March 26, 2025, https://www.wiz.io/academy/ai-security 46. How to Secure AI and Model Data with Storage Infrastructure, accessed on March 26, 2025, https://blog.purestorage.com/purely-educational/how-to-secure-ai-and-model-data-with-storage-infrastructure/