Setting Up MCP with Claude Desktop
Claude Desktop provides native support for the Model Context Protocol (MCP), enabling you to extend Claude's capabilities with custom tools, data sources, and workflows. This guide walks you through the complete setup process.
Prerequisites
Before starting, ensure you have:
- Claude Desktop installed on your system
- Basic understanding of JSON configuration
- MCP server ready to connect (or use existing servers)
Installing Claude Desktop
Download and Installation
- Visit claude.ai/download
- Download the appropriate version for your operating system:
- macOS: Claude Desktop.dmg
- Windows: Claude Desktop Setup.exe
- Run the installer and follow the setup wizard
Initial Setup
After installation:
- Launch Claude Desktop
- Sign in with your Anthropic account
- Complete the initial onboarding
MCP Configuration
Configuration File Location
Claude Desktop reads MCP configuration from a JSON file located at:
macOS
~/Library/Application Support/Claude/claude_desktop_config.json
Windows
%APPDATA%\Claude\claude_desktop_config.json
Basic Configuration Structure
Create or edit the configuration file with this structure:
{
"mcpServers": {
"server-name": {
"command": "command-to-run-server",
"args": ["argument1", "argument2"],
"env": {
"ENVIRONMENT_VARIABLE": "value"
}
}
}
}
Configuring Built-in Servers
Filesystem Server
Access local files and directories:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/path/to/allowed/directory"
]
}
}
}
Capabilities:
- Read file contents
- List directory contents
- Search for files
- Get file metadata
Git Server
Interact with Git repositories:
{
"mcpServers": {
"git": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-git",
"--repository",
"/path/to/git/repository"
]
}
}
}
Capabilities:
- View commit history
- Show file changes
- Create branches
- Manage repositories
GitHub Server
Access GitHub repositories and issues:
{
"mcpServers": {
"github": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-github"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "your-github-token"
}
}
}
}
Capabilities:
- Search repositories and issues
- Create and manage issues
- Access repository contents
- View pull requests
Custom Server Configuration
Python Server Example
{
"mcpServers": {
"my-python-server": {
"command": "python",
"args": ["/path/to/your/server.py"],
"env": {
"API_KEY": "your-api-key",
"DEBUG": "false"
}
}
}
}
Node.js Server Example
{
"mcpServers": {
"my-node-server": {
"command": "node",
"args": ["/path/to/your/server.js"],
"env": {
"NODE_ENV": "production",
"PORT": "3000"
}
}
}
}
Executable Server Example
{
"mcpServers": {
"my-executable": {
"command": "/path/to/your/executable",
"args": ["--config", "/path/to/config.json"],
"env": {
"LOG_LEVEL": "info"
}
}
}
}
Complete Configuration Examples
Development Setup
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/username/projects"
]
},
"git": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-git",
"--repository",
"/Users/username/projects/my-repo"
]
},
"github": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-github"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxxxxxxxxxxx"
}
}
}
}
Data Analysis Setup
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/username/data"
]
},
"sqlite": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-sqlite",
"/path/to/database.db"
]
},
"web-search": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-brave-search"
],
"env": {
"BRAVE_API_KEY": "your-brave-api-key"
}
}
}
}
Testing Your Configuration
Verify Configuration
- Save your configuration file
- Restart Claude Desktop completely
- Start a new conversation
- Test MCP functionality with commands like:
- "List files in my project directory"
- "Show me the latest commits"
- "Search for issues in my repository"
Check Server Status
Claude Desktop provides feedback about MCP servers:
- Green dot: Server connected successfully
- Red dot: Server failed to connect
- Orange dot: Server starting up
Debug Connection Issues
If servers fail to connect:
- Check file paths: Ensure all paths are correct and accessible
- Verify commands: Make sure commands are installed and executable
- Review environment variables: Check that required API keys are set
- Check logs: Look for error messages in Claude Desktop
Common Configuration Patterns
Environment-Specific Configs
Use environment variables for different setups:
{
"mcpServers": {
"api-server": {
"command": "node",
"args": ["server.js"],
"env": {
"NODE_ENV": "development",
"API_BASE_URL": "http://localhost:3000",
"DEBUG": "true"
}
}
}
}
Multiple Server Instances
Run multiple instances of the same server type:
{
"mcpServers": {
"project-a-files": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/path/to/project-a"
]
},
"project-b-files": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/path/to/project-b"
]
}
}
}
Conditional Server Loading
Use shell scripts for conditional server loading:
{
"mcpServers": {
"conditional-server": {
"command": "bash",
"args": ["-c", "if [ -f /path/to/server ]; then /path/to/server; fi"]
}
}
}
Security Considerations
API Key Management
- Never commit API keys to version control
- Use environment files for local development
- Rotate keys regularly for production use
- Limit permissions to minimum required scope
File System Access
- Restrict directory access to only necessary paths
- Use absolute paths to avoid confusion
- Set proper permissions on configuration files
- Regular security audits of accessible directories
Network Security
- Use HTTPS for all external connections
- Validate certificates for secure connections
- Implement rate limiting where appropriate
- Monitor network traffic for suspicious activity
Troubleshooting
Common Issues
Server Won't Start
Problem: Red dot next to server name
Solutions:
- Check command path and arguments
- Verify environment variables
- Ensure dependencies are installed
- Check file permissions
Server Connects But No Functionality
Problem: Green dot but tools don't work
Solutions:
- Verify server implements required capabilities
- Check server logs for errors
- Test server independently
- Review server documentation
Performance Issues
Problem: Slow responses or timeouts
Solutions:
- Optimize server implementation
- Add caching where appropriate
- Reduce data transfer size
- Check network connectivity
Getting Help
If you encounter issues:
- Check documentation for your specific server
- Review Claude Desktop logs for error messages
- Test servers independently outside of Claude Desktop
- Contact support with specific error details
Advanced Configuration
Custom Server Discovery
Implement dynamic server discovery:
{
"mcpServers": {
"dynamic-server": {
"command": "python",
"args": ["discover_servers.py"],
"env": {
"SERVER_DISCOVERY_PATH": "/path/to/servers"
}
}
}
}
Load Balancing
Distribute load across multiple server instances:
{
"mcpServers": {
"load-balanced-server-1": {
"command": "node",
"args": ["server.js", "--instance", "1"]
},
"load-balanced-server-2": {
"command": "node",
"args": ["server.js", "--instance", "2"]
}
}
}
Next Steps
Once you have MCP configured with Claude Desktop:
- Explore capabilities of your connected servers
- Build custom workflows using multiple servers
- Create your own servers for specific use cases
- Share configurations with your team
- Monitor performance and optimize as needed
Claude Desktop's MCP integration opens up unlimited possibilities for extending AI capabilities. With proper configuration and security practices, you can create powerful, customized AI workflows tailored to your specific needs.
Ready to build custom MCP servers? Check out our development guides for creating servers in Python and TypeScript.