Back to Learn
MCP
15 min read

Setting Up MCP Servers with Claude Desktop

clauderules.net

What is MCP?

Model Context Protocol (MCP) is an open standard that lets you connect Claude to external tools and data sources. An MCP server exposes "tools" that Claude can call — like reading files, querying databases, searching the web, or calling APIs.

Without MCP, Claude can only work with information you paste into the conversation. With MCP servers, Claude can read your codebase, query your database, check your calendar, or browse documentation — all without you having to copy-paste.

The claude_desktop_config.json File

Claude Desktop reads MCP server configuration from a JSON file. The location varies by OS:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
json
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/your/project"],
      "env": {}
    },
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres"],
      "env": {
        "POSTGRES_URL": "postgresql://localhost/mydb"
      }
    }
  }
}

Installing Your First MCP Server

Let's install the official Filesystem MCP server, which lets Claude read and write files on your computer.

bash
# Step 1: Verify Node.js is installed (MCP servers require Node 18+)
node --version

# Step 2: Test the server runs (it will print its capabilities and exit)
npx -y @modelcontextprotocol/server-filesystem /tmp

# Step 3: Edit your claude_desktop_config.json (macOS)
open ~/Library/Application Support/Claude/

# Step 4: Add the filesystem server config (see JSON above)
# Step 5: Restart Claude Desktop
# Step 6: Look for the MCP indicator in the Claude Desktop UI
Be careful with the paths you expose via the Filesystem MCP. Only expose directories you're comfortable with Claude reading and modifying. Avoid exposing your home directory root or sensitive config directories.

Popular MCP Servers

The MCP ecosystem has grown rapidly. Here are the most useful servers for developers:

@modelcontextprotocol/server-filesystem

Read/write local files and directories

@modelcontextprotocol/server-github

Browse repos, issues, PRs via GitHub API

@modelcontextprotocol/server-postgres

Query PostgreSQL databases with natural language

@modelcontextprotocol/server-sqlite

Read and query SQLite database files

@modelcontextprotocol/server-brave-search

Search the web using Brave Search API

@modelcontextprotocol/server-fetch

Fetch and parse web pages

Configuring Multiple Servers

json
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem",
               "/Users/me/projects", "/Users/me/Documents"],
      "env": {}
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token_here"
      }
    },
    "brave-search": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-brave-search"],
      "env": {
        "BRAVE_API_KEY": "your_brave_api_key"
      }
    }
  }
}

Troubleshooting

Common issues when setting up MCP servers:

  • Server doesn't appear in Claude Desktop: Restart Claude Desktop after editing the config file.
  • npx command not found: Ensure Node.js is on your PATH. Try using the absolute path to npx in the command field.
  • Permission errors: Ensure the paths you're exposing are readable by the process running Claude Desktop.
  • Server crashes on startup: Run the npx command manually in your terminal to see error output.