Connect MCP servers to Claude Desktop by editing the claude_desktop_config.json file. On macOS it is at ~/Library/Application Support/Claude/claude_desktop_config.json, on Windows at %APPDATA%\Claude\claude_desktop_config.json. Add a mcpServers object with server entries specifying command, args, and optional env. Restart Claude Desktop to activate. Connected tools appear as a hammer icon in the chat input area.
Configure Claude Desktop for MCP Server Connections
Claude Desktop was the first AI host to support MCP and remains the reference implementation. All MCP server configuration is done through a single JSON file. Claude Desktop launches configured servers as child processes, performs the MCP handshake, and presents the servers' tools as callable functions in your chat. This tutorial covers locating the config file, adding servers, passing secrets, and verifying connections.
Prerequisites
- Claude Desktop installed (latest version recommended)
- An MCP server to connect (npm package, local server, or Docker image)
- A text editor to modify JSON files
Step-by-step guide
Locate the Claude Desktop configuration file
Locate the Claude Desktop configuration file
Claude Desktop stores its configuration in a JSON file at a platform-specific location. On macOS, open Finder and navigate to ~/Library/Application Support/Claude/. On Windows, navigate to %APPDATA%\Claude\. If the file does not exist, create it. You can also open it quickly from Claude Desktop's settings menu.
1# macOS — open the config file in your default editor2open ~/Library/Application Support/Claude/claude_desktop_config.json34# macOS — if the file does not exist, create it5mkdir -p ~/Library/Application\ Support/Claude6touch ~/Library/Application\ Support/Claude/claude_desktop_config.json78# Windows (PowerShell)9notepad "$env:APPDATA\Claude\claude_desktop_config.json"Expected result: The config file is open in your text editor, ready to add MCP server entries.
Add your first MCP server
Add your first MCP server
Add a mcpServers object to the config file. Each server entry has a unique name (the key) and an object with command (the executable to run) and args (command-line arguments). This example adds the official Filesystem MCP server, which gives Claude access to read and write files in a specified directory.
1{2 "mcpServers": {3 "filesystem": {4 "command": "npx",5 "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/Documents"]6 }7 }8}Expected result: The config file contains one MCP server entry for the filesystem server.
Add servers with environment variables
Add servers with environment variables
Many MCP servers need API keys or connection strings. Use the env field to pass environment variables securely. These are injected into the server's process environment when Claude Desktop launches it. Never put API keys directly in the args array.
1{2 "mcpServers": {3 "filesystem": {4 "command": "npx",5 "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/Documents"]6 },7 "github": {8 "command": "docker",9 "args": ["run", "-i", "--rm",10 "-e", "GITHUB_PERSONAL_ACCESS_TOKEN",11 "ghcr.io/github/github-mcp-server"],12 "env": {13 "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token_here"14 }15 },16 "brave-search": {17 "command": "npx",18 "args": ["-y", "@modelcontextprotocol/server-brave-search"],19 "env": {20 "BRAVE_API_KEY": "your-brave-api-key"21 }22 }23 }24}Expected result: Multiple servers are configured with environment variables for secure credential passing.
Connect a custom local MCP server
Connect a custom local MCP server
If you built a custom MCP server (TypeScript or Python), add it to the config by specifying the execution command. For TypeScript servers, use npx tsx to run the source directly or node to run compiled JavaScript. For Python servers, use python or uv run.
1{2 "mcpServers": {3 "my-custom-server": {4 "command": "npx",5 "args": ["-y", "tsx", "/Users/you/projects/my-server/src/index.ts"]6 },7 "python-server": {8 "command": "uv",9 "args": ["run", "--directory", "/Users/you/projects/py-server", "server.py"]10 }11 }12}Expected result: Custom local servers are configured and will be launched when Claude Desktop starts.
Connect a remote MCP server via HTTP
Connect a remote MCP server via HTTP
For remote MCP servers running on another machine or cloud, use the url field instead of command/args. Claude Desktop connects to the server over Streamable HTTP. This is useful for shared team servers or cloud-deployed MCP services.
1{2 "mcpServers": {3 "remote-api": {4 "url": "https://mcp.your-company.com/api"5 }6 }7}Expected result: Claude Desktop connects to the remote MCP server over HTTP.
Restart Claude Desktop and verify connections
Restart Claude Desktop and verify connections
After saving the config file, completely quit Claude Desktop (Cmd+Q on macOS, not just close the window) and reopen it. Look for the hammer icon in the chat input area — this indicates MCP tools are available. Click it to see the list of available tools from all connected servers. If you do not see the hammer icon, the servers may have failed to connect.
Expected result: The hammer icon appears in the Claude Desktop chat, showing available MCP tools from your configured servers.
Test a tool by asking Claude a question
Test a tool by asking Claude a question
Ask Claude a question that requires an MCP tool. For example, with the filesystem server connected, ask 'What files are in my Documents folder?' Claude will request permission to use the tool, show you the tool call, and display the result. You can approve individual tool calls or allow all calls from a specific server.
Expected result: Claude calls the MCP tool, shows the result, and uses it to answer your question.
Complete working example
1{2 "mcpServers": {3 "filesystem": {4 "command": "npx",5 "args": [6 "-y",7 "@modelcontextprotocol/server-filesystem",8 "/Users/you/Documents"9 ]10 },11 "github": {12 "command": "docker",13 "args": [14 "run", "-i", "--rm",15 "-e", "GITHUB_PERSONAL_ACCESS_TOKEN",16 "ghcr.io/github/github-mcp-server"17 ],18 "env": {19 "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token_here"20 }21 },22 "brave-search": {23 "command": "npx",24 "args": ["-y", "@modelcontextprotocol/server-brave-search"],25 "env": {26 "BRAVE_API_KEY": "your-brave-api-key"27 }28 },29 "memory": {30 "command": "npx",31 "args": ["-y", "@modelcontextprotocol/server-memory"]32 },33 "postgres": {34 "command": "npx",35 "args": ["-y", "@modelcontextprotocol/server-postgres"],36 "env": {37 "POSTGRES_CONNECTION_STRING": "postgresql://user:pass@localhost:5432/mydb"38 }39 },40 "custom-server": {41 "command": "npx",42 "args": ["-y", "tsx", "/absolute/path/to/server/src/index.ts"],43 "env": {44 "API_KEY": "your-api-key"45 }46 }47 }48}Common mistakes when connecting MCP servers to Claude Desktop
Why it's a problem: Wrong config file location
How to avoid: macOS: ~/Library/Application Support/Claude/claude_desktop_config.json. Windows: %APPDATA%\Claude\claude_desktop_config.json. Do not create the file in your home directory or project directory.
Why it's a problem: Invalid JSON syntax in config file
How to avoid: JSON does not allow trailing commas, comments, or single quotes. Use a JSON validator or VS Code's JSON validation to check syntax before saving. One misplaced comma breaks all MCP servers.
Why it's a problem: Not fully quitting Claude Desktop after config changes
How to avoid: On macOS, closing the window does not quit the app — Claude continues running in the menu bar. Use Cmd+Q to fully quit, then reopen. The config is only read at startup.
Why it's a problem: Using the deprecated npm package for GitHub MCP server
How to avoid: The npm-based GitHub MCP server package was deprecated in April 2025. Use the Docker image instead: command: 'docker', args: ['run', '-i', '--rm', '-e', 'GITHUB_PERSONAL_ACCESS_TOKEN', 'ghcr.io/github/github-mcp-server'].
Best practices
- Always use absolute paths for directories and server files in the configuration
- Pass secrets via the env field, never as visible command-line arguments
- Always include -y in npx commands to prevent installation prompts that hang the server
- Test servers with MCP Inspector before adding them to Claude Desktop configuration
- Back up your claude_desktop_config.json before making changes
- Start with one server, verify it works, then add more incrementally
- Use the hammer icon in the chat to verify which tools are available from each server
- Check Claude Desktop logs for server startup errors if a server fails to connect
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
Show me how to configure MCP servers in Claude Desktop. I want to connect the filesystem server, GitHub server (via Docker), and a custom TypeScript server. Show the complete claude_desktop_config.json with the correct file path for macOS.
Help me set up MCP in Claude Desktop. I want to add the filesystem server for my project directory and a custom server I built. Show the config file contents and how to verify the connection is working.
Frequently asked questions
Where is the Claude Desktop config file on macOS?
~/Library/Application Support/Claude/claude_desktop_config.json. Open Finder, press Cmd+Shift+G, and paste the path. The Library folder is hidden by default.
Can I use Claude Desktop with remote MCP servers?
Yes. Use the url field instead of command/args to connect to remote servers via Streamable HTTP: { "url": "https://mcp.example.com/api" }. This works for cloud-deployed MCP servers.
How many MCP servers can I run in Claude Desktop?
There is no hard-coded limit. In practice, 5-10 servers work well. Each server runs as a separate process, so very large numbers may increase memory usage and startup time.
Why do I not see the hammer icon after adding servers?
Ensure you fully quit Claude Desktop (Cmd+Q) and reopened it. Check that the JSON syntax is valid. Check that the server commands are correct by testing them in your terminal first. Claude Desktop silently skips servers that fail to start.
Can RapidDev help configure MCP for our team?
Yes. RapidDev helps teams set up shared MCP configurations, build custom servers for internal tools, and establish best practices for secure credential management across Claude Desktop, Cursor, and other MCP hosts.
Does Claude Desktop ask permission before using MCP tools?
Yes. Claude Desktop shows a confirmation dialog when the model wants to use an MCP tool, displaying the tool name and arguments. You can approve individual calls or allow all calls from a specific server for the session.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation