MCP Library updated 17 min read

How to Install and Configure MCP Servers: Complete Setup Guide

Step-by-step guide to installing MCP servers for Claude Desktop, Cursor, and VS Code. Includes troubleshooting and examples.

RP

Rajesh Praharaj

Aug 20, 2025 · Updated Dec 27, 2025

How to Install and Configure MCP Servers: Complete Setup Guide

TL;DR - MCP Installation Quick Start

Want to get MCP running in 5 minutes? Here’s the fastest path:

🆕 December 2025: MCP is now supported by ChatGPT, Copilot, and Gemini in addition to Claude Desktop! For an introduction to MCP, see the MCP Introduction guide.

Prerequisites:

# Check Node.js (v18+ required)
node --version

# If not installed, get it from nodejs.org

Claude Desktop Setup:

  1. Create/edit config file:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%/Claude/claude_desktop_config.json
  2. Add this config:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/your/projects"]
    }
  }
}
  1. Restart Claude Desktop completely (quit and reopen)

  2. Test it: Ask Claude “What files are in my projects folder?”

💡 That’s it! For more servers, hosts, and advanced config, read on.


Prerequisites

Before installing MCP servers, ensure you have the required runtime environments:

Node.js (Required for Most Servers)

Most MCP servers are written in TypeScript/JavaScript and distributed via npm.

# Check if Node.js is installed
node --version
# Should output v18.0.0 or higher

# Check npm
npm --version

# Check npx (comes with npm)
npx --version

Installing Node.js:

PlatformInstallation Method
macOSbrew install node or download from nodejs.org
WindowsDownload installer from nodejs.org
Linuxsudo apt install nodejs npm or use nvm

⚠️ Important: MCP servers require Node.js v18 or higher. If you have an older version, upgrade first.

Python (For Python-based Servers)

Some MCP servers are written in Python (like mcp-server-sqlite):

# Check Python version
python3 --version
# Should output Python 3.10.0 or higher

# Check pip
pip3 --version

# Install uvx (recommended for Python MCP servers)
pip3 install uvx

Docker (Optional)

For fully isolated environments or server environments:

# Check Docker
docker --version

# Pull an MCP server image
docker pull ghcr.io/modelcontextprotocol/server-filesystem

Installation Methods Comparison

There are several ways to run MCP servers. Here’s when to use each:

MethodCommandBest ForProsCons
npxnpx -y @pkg/serverQuick start, testingAlways latest, no installSlower first run
npm globalnpm i -g @pkg/serverFrequent useFast executionManual updates
uvxuvx mcp-server-namePython serversClean isolationPython required
Dockerdocker run mcp/serverEnterprise, CI/CDFully isolatedMore setup

The easiest way - runs the latest version without installation:

# Runs server without installing
npx -y @modelcontextprotocol/server-filesystem /path/to/allow

The -y flag auto-confirms the install prompt.

In your config file:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/projects"]
    }
  }
}

Method 2: Global npm Install

Faster execution for servers you use frequently:

# Install globally once
npm install -g @modelcontextprotocol/server-filesystem

# Now use directly
mcp-server-filesystem /path/to/allow

In your config file:

{
  "mcpServers": {
    "filesystem": {
      "command": "mcp-server-filesystem",
      "args": ["/path/to/projects"]
    }
  }
}

Method 3: uvx for Python Servers

For Python-based MCP servers:

# Install uvx first
pip install uvx

# Run Python MCP server
uvx mcp-server-sqlite --db-path /path/to/database.db

In your config file:

{
  "mcpServers": {
    "sqlite": {
      "command": "uvx",
      "args": ["mcp-server-sqlite", "--db-path", "/path/to/database.db"]
    }
  }
}

Method 4: Docker

For isolated, reproducible environments:

docker run -i --rm \
  -v /local/path:/data \
  ghcr.io/modelcontextprotocol/server-filesystem /data

In your config file:

{
  "mcpServers": {
    "filesystem": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "-v", "/local/path:/data",
        "ghcr.io/modelcontextprotocol/server-filesystem",
        "/data"
      ]
    }
  }
}

Claude Desktop Configuration

Claude Desktop is Anthropic’s official client with native MCP support since November 2024.

💡 Note: As of December 2025, ChatGPT, Microsoft Copilot, and Google Gemini also support MCP. See their dedicated sections below.

Step 1: Locate the Config File

Operating SystemConfig File Path
macOS~/Library/Application Support/Claude/claude_desktop_config.json
Windows%APPDATA%\Claude\claude_desktop_config.json
Linux~/.config/Claude/claude_desktop_config.json

Quick access commands:

# macOS - Open in Finder
open ~/Library/Application\ Support/Claude/

# macOS - Open in VS Code
code ~/Library/Application\ Support/Claude/claude_desktop_config.json

# Windows PowerShell
notepad $env:APPDATA\Claude\claude_desktop_config.json

# Linux
nano ~/.config/Claude/claude_desktop_config.json

💡 Tip: If the file doesn’t exist, create it! Make sure you create valid JSON.

Step 2: Basic Configuration Structure

Here’s the basic structure of the config file:

{
  "mcpServers": {
    "server-name": {
      "command": "npx",
      "args": ["-y", "@package/name", "arg1", "arg2"],
      "env": {
        "API_KEY": "your-key-here"
      }
    }
  }
}

Anatomy of a server config:

FieldRequiredDescription
server-nameYesUnique identifier (you choose this)
commandYesExecutable to run (npx, node, python, docker)
argsYesArray of command arguments
envNoEnvironment variables for the server

Step 3: Example Configurations

Filesystem Server (Read Your Files)

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/yourname/projects",
        "/Users/yourname/documents"
      ]
    }
  }
}

GitHub Server (Manage Repos)

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

PostgreSQL Server (Query Databases)

{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-postgres",
        "postgresql://user:password@localhost:5432/mydb"
      ]
    }
  }
}

Multiple Servers (Complete Setup)

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/me/projects"]
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxxxxxxxxxxx"
      }
    },
    "memory": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-memory"]
    },
    "fetch": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-fetch"]
    }
  }
}

Step 4: Restart Claude Desktop

Important: You must completely restart Claude Desktop after changing the config.

macOS:

  1. Click Claude in menu bar → Quit Claude
  2. Reopen from Applications

Windows:

  1. Right-click Claude in system tray → Exit
  2. Reopen from Start Menu

Linux:

  1. Close Claude window
  2. Reopen from applications menu

Step 5: Verify MCP is Working

After restart, you should see the MCP indicator in Claude’s interface:

  1. Look for the 🔌 icon or “MCP” indicator in the chat interface
  2. Test with a simple prompt:
You: What MCP servers are connected?
Claude: I have access to the following MCP servers:
- filesystem: Read and write files in /Users/me/projects
- github: Manage GitHub repositories
...

Or test a specific server:

You: List the files in my projects folder
Claude: Here are the files in /Users/me/projects:
- project-a/
- project-b/
- notes.md
...

Cursor Configuration

Cursor is an AI-powered IDE that supports MCP natively. For a comparison of AI coding tools, see the AI-Powered IDEs Comparison guide.

Step 1: Open Cursor Settings

  1. Open Cursor
  2. Press Cmd+, (macOS) or Ctrl+, (Windows/Linux)
  3. Search for “MCP” or navigate to Features → MCP Servers

Step 2: Configure via Settings UI

Cursor has a visual interface for adding MCP servers:

  1. Click “Add Server”
  2. Enter server name
  3. Enter command and arguments
  4. Add environment variables if needed
  5. Save

Step 3: Configure via JSON (Alternative)

You can also edit the config directly:

Location: .cursor/mcp.json in your project root (project-level) or global settings

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

Project-Level vs Global Config

ScopeLocationBest For
Project.cursor/mcp.json in project rootProject-specific tools
GlobalCursor settingsTools you use everywhere

Step 4: Using MCP in Cursor

Once configured, use MCP in Cursor’s AI chat:

  1. Press Cmd+L (macOS) or Ctrl+L (Windows) to open AI chat
  2. Ask questions that leverage MCP:
You: Read the README.md and suggest improvements
You: Create a new file called utils.ts with helper functions
You: Search for all TODO comments in this project

VS Code + Continue Configuration

VS Code doesn’t have native MCP support, but the Continue extension adds it.

Step 1: Install Continue Extension

  1. Open VS Code Extensions (Cmd+Shift+X)
  2. Search for “Continue”
  3. Install the Continue extension
  4. Reload VS Code

Step 2: Configure Continue for MCP

Open Continue settings:

  1. Click the Continue icon in the sidebar
  2. Click the gear icon ⚙️
  3. Select “Open config.json”

Add MCP configuration:

{
  "models": [...],
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "${workspaceFolder}"]
    }
  }
}

💡 Tip: Use ${workspaceFolder} to automatically use the current workspace path.

Step 3: Using MCP in Continue

  1. Open Continue chat panel
  2. Use @ to reference files or MCP tools
  3. Ask questions that use MCP capabilities
You: @filesystem Read all TypeScript files and find potential bugs
You: @github Create an issue for the bug we discussed

Windsurf Configuration

Windsurf (by Codeium) is another AI IDE with MCP support. For more on AI coding assistants, see the AI Assistant Comparison guide.

Step 1: Open Windsurf Settings

  1. Open Windsurf
  2. Press Cmd+, (macOS) or Ctrl+, (Windows)
  3. Navigate to Cascade → MCP Servers

Step 2: Add MCP Configuration

Windsurf uses similar JSON structure:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/projects"]
    }
  }
}

Step 3: Using MCP in Windsurf

Use Cascade (Windsurf’s AI) with MCP:

  1. Open Cascade chat
  2. Ask file-related questions:
You: Analyze the codebase and suggest architecture improvements
You: Find all files that import lodash

ChatGPT Configuration (New in 2025)

OpenAI added native MCP support to ChatGPT in early 2025, making it part of the MCP ecosystem.

Step 1: Enable Developer Mode

  1. Open ChatGPT settings
  2. Navigate to Advanced Settings
  3. Enable Developer Mode (rolling out for paid accounts)

Step 2: Add MCP Connector

  1. Go to Settings → Connectors → Create
  2. Enter your MCP server details:
    • Name: Descriptive name for the server
    • Server URL: URL of your remote MCP server
    • Authentication: OAuth (required - API keys not supported)

Step 3: Configure Remote MCP Server

Unlike Claude Desktop which runs local servers, ChatGPT requires remote MCP servers:

┌─────────────────┐        ┌─────────────────┐        ┌─────────────────┐
│    ChatGPT      │───────▶│  Remote MCP     │───────▶│  Your Data/     │
│    (Browser)    │  HTTPS │  Server         │        │  Services       │
└─────────────────┘        └─────────────────┘        └─────────────────┘

⚠️ Important: ChatGPT’s MCP integration uses OAuth authentication only. You’ll need to deploy your MCP server to a publicly accessible URL with OAuth support.

Step 4: Test the Connection

  1. Open Deep Research mode or Use Connectors tool
  2. Ask a question that requires your MCP server
  3. Verify the server responds correctly

Microsoft Copilot Configuration (New in 2025)

Microsoft added MCP support to Copilot as part of their collaboration with the Agentic AI Foundation.

Copilot in VS Code

Copilot’s MCP support in VS Code works through extensions:

  1. Ensure you have GitHub Copilot extension installed
  2. Install MCP-compatible extensions
  3. Configure via the extension settings

Copilot for Enterprise

For Microsoft 365 Copilot in enterprise environments:

  1. Contact your IT administrator for MCP configuration
  2. MCP servers are typically configured at the organization level
  3. Uses Azure AD for authentication

📌 Note: Microsoft Copilot’s MCP implementation is designed for enterprise scenarios with proper governance.


Google Gemini Configuration (New in December 2025)

Google announced fully managed remote MCP servers in December 2025.

Google Cloud MCP Servers

Google provides hosted MCP servers for their services:

  1. Enable MCP in Google AI Studio or Gemini settings
  2. Connect to Google services directly:
    • Google Drive
    • Google Docs
    • BigQuery
    • Cloud Storage
    • And more…

Configuration Example

In Gemini settings:
1. Navigate to Integrations → MCP Servers
2. Select from available Google Cloud MCP services
3. Authorize access via Google OAuth
4. Start using in conversations

Benefits of Google’s Approach

FeatureDescription
No local setupServers run on Google Cloud
Unified authUses your Google account
Managed scalingAutomatic resource management
Enterprise-readyIntegrates with Workspace

Managing Multiple MCP Servers

How Many Servers Can You Run?

There’s no hard limit, but consider:

Usage LevelRecommendation
Personal3-5 active servers
Professional5-10 servers
EnterpriseUse Docker/container management

Resource Considerations

Each MCP server is a separate process:

┌─────────────────────────────────────────┐
│              Your Machine               │
├─────────────────────────────────────────┤
│  Claude Desktop                         │
│    ├── Filesystem Server (Node.js)      │  ~50MB RAM
│    ├── GitHub Server (Node.js)          │  ~50MB RAM
│    ├── Postgres Server (Node.js)        │  ~50MB RAM
│    └── Memory Server (Node.js)          │  ~60MB RAM
└─────────────────────────────────────────┘
                                          Total: ~210MB RAM

Naming Conventions

Use descriptive, consistent names:

{
  "mcpServers": {
    "files-projects": { ... },      // Filesystem for projects
    "files-notes": { ... },         // Filesystem for notes
    "db-production": { ... },       // Prod database (read-only!)
    "db-development": { ... },      // Dev database
    "github-work": { ... },         // Work GitHub account
    "github-personal": { ... }      // Personal GitHub account
  }
}

Environment Variables & Secrets

Passing API Keys

Many MCP servers need API keys. Use the env block:

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxxxxxxxxxxx"
      }
    },
    "notion": {
      "command": "npx",
      "args": ["-y", "@notionhq/mcp"],
      "env": {
        "NOTION_API_KEY": "secret_xxxxxxxxxxxx"
      }
    }
  }
}

Security Best Practices

✅ Do❌ Don’t
Store config locally onlyCommit config to git with keys
Use minimal permission scopesUse admin/full-access tokens
Rotate keys regularlyShare keys between tools
Use read-only tokens when possibleUse write tokens for read operations

For more on AI security best practices, see the Understanding AI Safety, Ethics, and Limitations guide.

Using System Environment Variables

Some setups support referencing system environment variables:

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

⚠️ Note: Environment variable expansion support varies by MCP client. Claude Desktop supports it; check your client’s documentation.

Creating API Tokens

Here’s where to get tokens for popular servers:

ServerToken LocationRequired Scopes
GitHubSettings → Developer → Personal Access Tokensrepo, read:org
NotionMy IntegrationsRead/write content
SlackCreate App → OAuthchannels:read, chat:write
Firecrawlfirecrawl.devN/A (account key)

Troubleshooting Common Issues

Issue 1: Server Not Appearing

Symptoms: MCP icon doesn’t show, servers not listed

Causes & Solutions:

CauseSolution
JSON syntax errorValidate with jsonlint.com
Didn’t restart appCompletely quit and reopen
Wrong config pathDouble-check file location
File permissionsEnsure file is readable

Debug Steps:

# Validate JSON syntax
cat ~/Library/Application\ Support/Claude/claude_desktop_config.json | python -m json.tool

# Check if file exists
ls -la ~/Library/Application\ Support/Claude/

Issue 2: “Command Not Found”

Symptoms: Server fails to start, “npx not found” error

Causes & Solutions:

CauseSolution
Node.js not installedInstall Node.js v18+
PATH not set correctlyAdd Node to PATH
Using wrong shellMake sure shell can find commands

Debug Steps:

# Check Node is accessible
which node
which npx

# Test manually
npx -y @modelcontextprotocol/server-filesystem --help

Issue 3: Connection Timeout

Symptoms: Server starts but AI can’t connect

Causes & Solutions:

CauseSolution
Server crashedCheck logs for errors
Wrong argumentsReview server documentation
Port conflictClose conflicting apps

Issue 4: Permission Denied

Symptoms: Server runs but operations fail

Causes & Solutions:

CauseSolution
Path not allowedAdd path to server args
File permissionsCheck OS-level permissions
Token permissionsAdd required scopes

Issue 5: Rate Limiting

Symptoms: Operations work then fail

Causes & Solutions:

CauseSolution
API limits hitAdd delays between operations
Too many requestsReduce active servers
Token limitsUpgrade API plan

Using MCP Inspector

For deep debugging, use the official MCP Inspector:

# Install and run inspector
npx @modelcontextprotocol/inspector

# Connect to your server
# The inspector provides a UI to test tools and view logs

Quick Reference Cheat Sheet

Config File Locations

PlatformClaude DesktopCursor
macOS~/Library/Application Support/Claude/claude_desktop_config.json.cursor/mcp.json
Windows%APPDATA%/Claude/claude_desktop_config.json.cursor/mcp.json
Linux~/.config/Claude/claude_desktop_config.json.cursor/mcp.json

Common Server Commands

# Filesystem - Read/write files
npx -y @modelcontextprotocol/server-filesystem /path/to/allow

# GitHub - Manage repos
npx -y @modelcontextprotocol/server-github

# PostgreSQL - Query database
npx -y @modelcontextprotocol/server-postgres postgresql://user:pass@host/db

# Memory - Knowledge graph
npx -y @modelcontextprotocol/server-memory

# Fetch - Web content
npx -y @modelcontextprotocol/server-fetch

# Git - Version control
npx -y @modelcontextprotocol/server-git --repository /path/to/repo

# Playwright - Browser automation
npx -y @playwright/mcp

Complete Example Config

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", 
               "/Users/me/projects", "/Users/me/documents"]
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxxx"
      }
    },
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres",
               "postgresql://localhost:5432/mydb"]
    },
    "memory": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-memory"]
    }
  }
}

Troubleshooting Commands

# Validate JSON
python -m json.tool < config.json

# Check Node.js
node --version && npm --version && npx --version

# Test server manually
npx -y @modelcontextprotocol/server-filesystem --help

# Run MCP Inspector
npx @modelcontextprotocol/inspector

Next Steps

You’ve learned how to install and configure MCP servers. Here’s what to explore next:

ArticleWhat You’ll Learn
Building Your First MCP ServerCreate custom servers
GitHub MCP GuideMaster GitHub integration
Filesystem MCP GuideDeep dive into file access
PostgreSQL MCP GuideQuery databases with AI

If you’re a developer:

{
  "mcpServers": {
    "filesystem": { ... },
    "github": { ... },
    "git": { ... }
  }
}

If you’re a data analyst:

{
  "mcpServers": {
    "postgres": { ... },
    "filesystem": { ... },
    "fetch": { ... }
  }
}

If you’re a productivity user:

{
  "mcpServers": {
    "notion": { ... },
    "slack": { ... },
    "memory": { ... }
  }
}

Summary

In this guide, you learned:

  • Prerequisites: Node.js v18+, Python 3.10+ (optional), Docker (optional)
  • Installation methods: npx (recommended), npm global, uvx, Docker
  • Configuration: JSON format for Claude Desktop, Cursor, VS Code, Windsurf
  • New in 2025: ChatGPT, Microsoft Copilot, and Google Gemini MCP support
  • Remote servers: Cloud-hosted MCP for ChatGPT and Gemini
  • Environment variables: Passing API keys securely
  • Troubleshooting: Common issues and solutions

The key takeaway: MCP is now the industry standard supported by all major AI platforms. Whether you use Claude, ChatGPT, Copilot, or Gemini, MCP provides a consistent way to connect your AI to external tools and data.

Next: Learn how to Build Your First MCP Server →


Having trouble? Check out the MCP Discord community or file an issue on GitHub.

Was this page helpful?

Let us know if you found what you were looking for.