Monday, May 19, 2025

How to Connect an MCP Server to Claude Desktop: A Step-by-Step Guide

The Model Context Protocol (MCP) is revolutionizing how AI assistants like Claude interact with external tools and data sources. By connecting Claude to an MCP server, you can enable it to perform tasks such as reading, writing, and organizing files on your computer—all with your explicit permission. This guide will walk you through the process of setting up an MCP server with Claude Desktop.

๐Ÿงฐ Prerequisites

Before you begin, ensure you have the following:

  • Claude for Desktop: Available for macOS and Windows. Download it from Claude for Desktop.

  • Node.js: Required to run the MCP server. Download it from nodejs.org.

๐Ÿ› ️ Step 1: Install Claude for Desktop

  1. Download and install Claude for Desktop for your operating system.

  2. Open the application.

  3. In the menu bar, click on Claude and select Check for Updates to ensure you have the latest version.

๐Ÿ“ Step 2: Configure the Filesystem MCP Server

  1. In Claude for Desktop, go to Settings (not the in-app settings).

  2. Click on the Developer tab.

  3. Click on Edit Config. This will open the configuration file:

    • On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

    • On Windows: %APPDATA%\Claude\claude_desktop_config.json

  4. Replace the contents of the file with the following, updating the paths to match your system

macOS Example:
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/your_username/Desktop",
        "/Users/your_username/Downloads"
      ]
    }
  }
}

Windows Example:
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "C:\\Users\\your_username\\Desktop",
        "C:\\Users\\your_username\\Downloads"
      ]
    }
  }
}

Ensure that the paths you provide are absolute and point to directories you want Claude to access.

๐Ÿ”„ Step 3: Restart Claude for Desktop

After saving the configuration file, restart Claude for Desktop to apply the changes.


๐Ÿงช Step 4: Test the Integration

Once Claude restarts, you should see a hammer icon in the bottom right corner of the input box. Clicking on this icon will display the tools available through the Filesystem MCP Server.

Try asking Claude to perform tasks like:

  • "Can you write a poem and save it to my desktop?"

  • "What are some work-related files in my downloads folder?"

  • "Can you take all the images on my desktop and move them to a new folder called 'Images'?"

Claude will seek your approval before executing any actions.

๐Ÿ› ️ Troubleshooting Tips

If the server isn't connecting:

  1. Ensure Node.js is installed by running node --version in your terminal or command prompt.

  2. Verify that the paths in your claude_desktop_config.json file are correct and absolute.

  3. Check the syntax of your JSON configuration file.

  4. Review Claude's log files for errors:

    • macOS: ~/Library/Logs/Claude

    • Windows: %APPDATA%\Claude\logs

  5. Manually run the server to check for errors

macOS Example:
npx -y @modelcontextprotocol/server-filesystem /Users/your_username/Desktop  /Users/your_username/Downloads

Windows Example:
npx -y @modelcontextprotocol/server-filesystem C:\Users\your_username\Desktop C:\Users\your_username\Downloads


No comments:

Post a Comment

AEO vs SEO: Understanding the Future of Search Visibility

As AI-driven platforms like ChatGPT, Microsoft Copilot, and Perplexity reshape how users find information,  AEO —Answer Engine Optimizati...