Skip to main content
mcpFirst-partyReview first Safety · Privacy ·

Claude Desktop MCP Setup

Master Claude Desktop MCP server setup in 20 minutes. Complete config JSON tutorial with filesystem integration, troubleshooting, and proven solutions.

by JSONbored·added 2025-10-27·
Claude CodeClaude Desktop
HarnessClaude CodeClaude Desktop
Review first review before installing

Open the source and read safety notes before installing.

Prerequisites

  • Claude Desktop installed and running (macOS, Windows, or Linux)
  • Basic JSON knowledge - understand JSON syntax, objects, arrays, and key-value pairs
  • Text editor with JSON syntax highlighting (VS Code, Sublime Text, or similar)
  • Node.js 18+ installed for running npx commands and MCP server packages
  • npm or compatible package manager for installing MCP server packages
  • Command-line access (Terminal on macOS/Linux, PowerShell or Command Prompt on Windows)
  • File system permissions to create and edit configuration files in application support directories
  • Network access for downloading MCP server packages via npx (if using remote servers)
  • API keys or tokens for services you want to integrate (GitHub, databases, etc.)
  • Understanding of your operating system file paths and environment variable syntax

Schema details

Install type
package
Reading time
4 min
Difficulty score
100
Troubleshooting
Yes
Breaking changes
No
Package metadata
Package verified
Yes
SHA-256
57690091c83e5827fb0e82a2a6193d2da2171c6637fae598edb894029828d1b5
Collection metadata
Estimated setup
3 minutes
Difficulty
beginner
Full copyable content
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/username/Documents"]
    }
  }
}

About this resource

Content

TL;DR

This tutorial teaches you to configure MCP servers in Claude Desktop using JSON configuration files in 20 minutes. You'll learn config file location and structure, server setup syntax, and multi-server deployment. Build a complete development environment with filesystem, GitHub, and database integrations. Perfect for developers who want to extend Claude Desktop with local tool access.

Key Points:

  • Config file location and JSON structure - create working MCP configurations
  • Filesystem server setup - enable local file access in Claude
  • Environment variables and API keys - secure credential management
  • 20 minutes total with 5 hands-on configuration exercises

Master MCP server configuration in Claude Desktop with this comprehensive tutorial. By completion, you'll have multiple working MCP servers and understand JSON configuration patterns. This guide includes 5 practical examples, 10 code samples, and 3 real-world configurations.

Tutorial Requirements

Prerequisites: Basic JSON knowledge, Claude Desktop installed
Time Required: 20 minutes active work
Tools Needed: Text editor, npm/Node.js installed
Outcome: Working MCP server configuration with filesystem access

What You'll Learn

Step-by-Step Tutorial

  1. Step 1: Locate Configuration Directory

  2. Step 2: Create Basic Configuration

  3. Step 3: Add Environment Variables

  4. Step 4: Deploy Multiple Servers

  5. Step 5: Validate and Test Configuration

Key Concepts Explained

Understanding these concepts ensures you can adapt this tutorial to your specific needs and troubleshoot issues effectively.

Practical Examples

Troubleshooting Guide

Common Issues and Solutions

Issue 1: Cannot connect to MCP server
Solution: Validate JSON syntax with python -m json.tool. This fixes invalid JSON causing connection failures.

Issue 2: Server disconnected unexpectedly
Solution: Check Claude Desktop logs at ~/Library/Logs/Claude/. Missing dependencies cause 80% of disconnections.

Issue 3: Windows path errors
Solution: Use double backslashes or forward slashes. Escape sequences break Windows path parsing.

Advanced Techniques

Professional Tips

Performance Optimization: Global npm installation reduces startup time by 3 seconds while maintaining functionality.

Security Best Practice: Always use platform keychains for credentials. This approach prevents token exposure in configs.

Scalability Pattern: For multiple projects, use separate configs. Switch configurations based on active project context.

Validation and Testing

Next Steps and Learning Path

Quick Reference

Tutorial Cheat Sheet - Essential commands and concepts:

  • Primary Command: npx -y @modelcontextprotocol/server-filesystem /path - Core command that enables filesystem access and produces directory listing
  • Configuration Pattern: {"mcpServers": {"name": {"command": "npx", "args": []}}} - Standard configuration for MCP servers with required fields
  • Validation Check: python -m json.tool claude_desktop_config.json - Verifies JSON syntax and confirms proper formatting
  • Troubleshooting: tail -f ~/Library/Logs/Claude/mcp*.log - Monitors MCP server logs - target: zero errors
  • Performance Metric: Server startup under 5 seconds - Measures initialization speed - target: <5s benchmark
  • Best Practice: Use environment variables for all credentials - Professional standard for secure credential management

Related Learning Resources


Tutorial Complete!

Congratulations! You've mastered MCP server configuration and can now extend Claude Desktop with local tools.

What you achieved:

  • ✅ Created working MCP server configurations
  • ✅ Implemented secure credential management
  • ✅ Deployed multiple servers successfully

Ready for more? Explore our tutorials collection or join our community to share your implementation and get help with advanced use cases.

Last updated: September 2025 | Found this helpful? Share it with your team and explore more Claude tutorials.

Features

  • Configuration file management - locate and create claude_desktop_config.json files on macOS, Windows, and Linux
  • MCP server setup - configure filesystem, GitHub, and database servers with proper JSON syntax
  • Multi-server deployment - combine multiple MCP servers for complex development workflows
  • Environment variable management - secure API key and credential handling using platform keychains
  • JSON validation and troubleshooting - validate configuration syntax and diagnose connection issues
  • Platform-specific configuration - adapt setup instructions for macOS, Windows, and Linux environments
  • Security best practices - implement secure credential management and prevent token exposure
  • Cross-platform configuration management with platform-specific path handling, environment variable resolution, and configuration validation for reliable MCP server deployment

Use Cases

  • Setting up local development environment - configure filesystem access for code editing and project management
  • Integrating GitHub workflows - connect Claude Desktop to GitHub for repository management and issue tracking
  • Database integration setup - enable database access for query execution and data analysis
  • Multi-service configuration - combine filesystem, API, and database servers for comprehensive tool access
  • Team collaboration setup - configure shared MCP servers for consistent development workflows
  • Security-conscious setup - implement secure credential management for production environments
  • Troubleshooting existing configurations - diagnose and fix common MCP server connection issues

Installation

Claude Code

  1. Open terminal in your project directory
  2. Run: claude mcp add --transport http server-name https://api.example.com/mcp
  3. Or create .mcp.json file in project root
  4. Add mcpServers configuration following JSON format
  5. Restart Claude Code to apply changes
  6. Verify servers with: claude mcp list

Claude Desktop

  1. Locate Claude Desktop configuration directory
  2. macOS: ~/Library/Application Support/Claude/
  3. Windows: %APPDATA%\Claude\
  4. Linux: ~/.config/claude/
  5. Create or edit claude_desktop_config.json file
  6. Add mcpServers configuration object
  7. Save file and restart Claude Desktop
  8. Verify MCP servers appear in Claude Desktop interface

Requirements

  • Claude Desktop installed and running (macOS, Windows, or Linux)
  • Basic JSON knowledge - understand JSON syntax, objects, arrays, and key-value pairs
  • Text editor with JSON syntax highlighting (VS Code, Sublime Text, or similar)
  • Node.js 18+ installed for running npx commands and MCP server packages
  • npm or compatible package manager for installing MCP server packages
  • Command-line access (Terminal on macOS/Linux, PowerShell or Command Prompt on Windows)
  • File system permissions to create and edit configuration files in application support directories
  • Network access for downloading MCP server packages via npx (if using remote servers)
  • API keys or tokens for services you want to integrate (GitHub, databases, etc.)
  • Understanding of your operating system file paths and environment variable syntax

Configuration

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/username/Documents"
      ]
    }
  }
}

Examples

Basic Filesystem Server Configuration

Simple filesystem server setup for document access in Claude Desktop

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/username/Documents"
      ]
    }
  }
}

GitHub Server with Secure Token

GitHub integration with environment variable for secure token management

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_PAT}"
      }
    }
  }
}

Complete Development Environment

Combined filesystem, memory, and GitHub servers for full development workflow

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "./projects"]
    },
    "memory": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-memory"]
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"]
    }
  }
}

PostgreSQL Database Server

PostgreSQL database server with connection string from environment variable

{
  "mcpServers": {
    "database": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres"],
      "env": {
        "DATABASE_URL": "${POSTGRES_CONNECTION}"
      }
    }
  }
}

Validate Configuration Syntax

Command to validate JSON syntax and catch configuration errors before restarting Claude Desktop

python -m json.tool claude_desktop_config.json

Monitor MCP Server Logs

Real-time log monitoring to diagnose MCP server connection issues on macOS

tail -f ~/Library/Logs/Claude/mcp*.log

Claude Code HTTP Server Setup

Add remote HTTP MCP server to Claude Code using CLI command

claude mcp add --transport http server-name https://api.example.com/mcp

Security

  • Never hardcode API keys or tokens directly in configuration files - always use environment variables or platform keychains to prevent credential exposure
  • Validate JSON syntax before deploying configurations - invalid JSON can cause connection failures and expose configuration structure
  • Restrict filesystem server paths to specific directories - avoid granting access to entire home directory or sensitive system locations
  • Use platform keychains (macOS Keychain, Windows Credential Manager) for storing sensitive credentials instead of plaintext environment variables
  • Review server commands before execution - malicious servers could execute arbitrary commands with your user privileges
  • Monitor MCP server logs regularly for unauthorized access attempts or unexpected behavior patterns
  • Implement separate configurations for development and production environments - never share production credentials in development configs
  • MCP server configuration files may expose server commands, file paths, and environment variable names - ensure configuration files are kept private and not committed to public repositories
  • MCP server commands execute with user privileges and could potentially access sensitive system resources - review server commands before deployment and restrict filesystem server paths to specific directories

Troubleshooting

Cannot connect to MCP server

Validate JSON syntax with python -m json.tool claude_desktop_config.json. Invalid JSON causes connection failures. Check for missing commas, unclosed brackets, or syntax errors.

Server disconnected unexpectedly

Check Claude Desktop logs at ~/Library/Logs/Claude/ (macOS) or %APPDATA%\Claude\logs\ (Windows). Missing dependencies cause 80% of disconnections. Install required packages: npm install -g @modelcontextprotocol/server-package.

Windows path errors in configuration

Use double backslashes (\\) or forward slashes (/) in Windows paths. Escape sequences break Windows path parsing. Example: Use C:/Users/username/Documents instead of C:\Users\username\Documents.

Environment variables not resolving

Verify environment variables are set in your shell session. Use ${VAR_NAME} syntax in JSON config. For Windows, use %VAR_NAME% format. Test with echo $VAR_NAME (Unix) or echo %VAR_NAME% (Windows).

MCP servers not appearing in Claude Desktop

Restart Claude Desktop after configuration changes. Verify config file location matches your platform. Check file permissions allow Claude Desktop to read the config. Use Settings > Developer > Edit Config to verify file is being read.

MCP server configuration not loading after restart

Validate JSON syntax with python -m json.tool. Check config file location matches platform requirements. Verify file permissions allow Claude Desktop to read the config. Use Settings > Developer > Edit Config to verify file is being read.

MCP server commands failing with permission errors

Verify command paths are correct and executable. Check file system permissions for server directories. Ensure npx/node are in PATH. For custom servers, verify installation and dependencies are available.

Environment variables not resolving in MCP server configuration

Verify environment variables are set in your shell session. Use ${VAR_NAME} syntax in JSON config. For Windows, use %VAR_NAME% format. Test with echo $VAR_NAME (Unix) or echo %VAR_NAME% (Windows).

#tutorial#intermediate#configuration#mcp-servers

Source citations

Signals

Loading live community signals…

More like this, weekly

A short, calm digest of reviewed Claude resources. Unsubscribe any time.