Troubleshooting MCP Servers
Fix common MCP problems: server not appearing, connection errors, tool failures, and performance issues. Complete debug guide with logs, diagnostics, and solutions.
QUICK DIAGNOSTIC
1. Server Not Appearing in Claude Desktop
This is the most common issue. Your MCP server is configured but doesn't show up in Claude Desktop's tool list.
Check 1: Verify JSON Syntax
Common JSON Errors
- Missing comma between server definitions
- Trailing comma after last server
- Unescaped quotes in strings
- Missing closing braces
❌ INVALID JSON
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "ghp_token"
}
}, // ← Trailing comma causes error
}
}✓ VALID JSON
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "ghp_token"
}
}
}
}Solution: Use a JSON validator like jsonlint.com to check your config file.
Check 2: Restart Claude Desktop Completely
Configuration changes only take effect after a full restart.
How to Restart Properly
Check 3: Verify Config File Location
Make sure you're editing the correct configuration file:
Config File Locations
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.jsonQuick Test
# macOS - Open config file open ~/Library/Application\ Support/Claude/claude_desktop_config.json # Windows - Open config file notepad %APPDATA%\Claude\claude_desktop_config.json
Check 4: Verify Server Command Exists
Test if the server command can be executed from your terminal:
Test Server Command
# Test if npx can run the server npx -y @modelcontextprotocol/server-github --help # Should display help text, not an error
2. Connection Errors
Server appears but shows connection or authentication errors.
Authentication Failed
Common Error Messages
- "Authentication failed" or "Invalid credentials"
- "401 Unauthorized"
- "403 Forbidden"
- "API key is invalid"
Solution 1: Verify API Key Format
API Key Formats
ghp_... (Classic token)secret_...sk-...sk-ant-...Solution 2: Check Token Permissions/Scopes
Ensure your API token has the necessary permissions:
Required Scopes
repo (for private repos),read:org, userdrive.readonly or drive.fileSolution 3: Check Token Expiration
- Verify token hasn't expired (check service dashboard)
- Regenerate token if necessary
- Update config file with new token
- Restart Claude Desktop
Permission Denied Errors
Token is valid but lacks access to specific resources.
Examples
- Notion: Integration not shared with specific pages
- GitHub: Token lacks access to private repos
- Postgres: Database user lacks required privileges
3. Tools Not Working Properly
Tool Execution Errors
Server connects but specific tool calls fail.
Check Logs for Details
View MCP Logs
# macOS tail -f ~/Library/Logs/Claude/mcp*.log # Or view all recent logs ls -lt ~/Library/Logs/Claude/mcp*.log | head -5 cat ~/Library/Logs/Claude/mcp-server-github.log # Windows # Logs in: %APPDATA%\Claude\Logs\ type %APPDATA%\Claude\Logs\mcp-server-github.log
Common Tool Errors
Error: "File not found"
Cause: Filesystem server can't access the file
Solution: Verify file exists and is in allowed directory
Error: "Rate limit exceeded"
Cause: Too many API requests to external service
Solution: Wait before retrying, or upgrade API tier
Error: "Timeout"
Cause: Operation took too long
Solution: Break into smaller operations, or increase timeout
Unexpected Tool Behavior
Tool Returns Empty Results
- Notion: Check pages are shared with integration
- GitHub: Verify repo exists and token has access
- Database: Confirm query syntax and table names
Tool Changes Don't Persist
- Filesystem: Check file permissions (read-only?)
- Git: Verify repo isn't in detached HEAD state
- Database: Check transaction isn't rolling back
4. Performance Issues
Slow Response Times
Common Causes
- Reading very large files (100k+ lines)
- Searching entire codebases without filters
- Making many sequential API calls
- Network latency to external services
Optimization Strategies
Be Specific
Instead of: "Read all files in the project"
Try: "Read src/auth/login.js and src/auth/utils.js"
Use Search First
Instead of: "Read every file to find the auth logic"
Try: "Search for 'authenticate' in the codebase, then read the relevant files"
Batch Operations
Ask Claude to plan multi-step operations to minimize round-trips
High Memory Usage
Claude Desktop or MCP servers consuming excessive memory.
- Restart Claude Desktop periodically for long sessions
- Close unused conversations
- Avoid loading massive files into context
- Limit concurrent MCP servers (disable unused ones)
5. Environment-Specific Issues
Windows-Specific Problems
Path Issues
Use Forward Slashes or Escape Backslashes
// ❌ Wrong "args": ["C:\Users\Me\code"] // ✓ Correct option 1 "args": ["C:/Users/Me/code"] // ✓ Correct option 2 "args": ["C:\\Users\\Me\\code"]
npx Not Found
If npx isn't recognized:
- Ensure Node.js is installed (download from nodejs.org)
- Add Node.js to PATH environment variable
- Restart Claude Desktop after installing Node.js
macOS-Specific Problems
Permission Issues
macOS may block MCP servers from accessing files:
- Grant Claude Desktop "Full Disk Access" in System Settings → Privacy & Security
- Allow access to specific folders when prompted
Homebrew-Installed Tools
If using Homebrew-installed commands:
{
"command": "/opt/homebrew/bin/node",
"args": ["/path/to/server.js"]
}
6. Debugging Techniques
Enable Verbose Logging
Some MCP servers support debug mode via environment variables:
Enable Debug Logging
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "ghp_token",
"DEBUG": "*",
"MCP_LOG_LEVEL": "debug"
}
}
}
}Test Server Manually
Run the server directly in your terminal to see error messages:
Manual Server Test
# Set environment variables export GITHUB_TOKEN="ghp_your_token" # Run server npx -y @modelcontextprotocol/server-github # Watch for error messages in output
Minimal Config Test
Strip down to a minimal configuration to isolate the issue:
Minimal Test Config
{
"mcpServers": {
"test": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-memory"]
}
}
}
If this works, gradually add back servers one at a time to find the problematic one.
7. Common Configuration Mistakes
| Mistake | Symptom | Fix |
|---|---|---|
| Relative paths | File not found errors | Use absolute paths only |
| Wrong env var name | Authentication failures | Check docs for exact var names |
| Missing -y flag | Server hangs on startup | Add -y to npx args |
| Outdated packages | Tools behave unexpectedly | Clear npx cache, update |
| Multiple servers same name | Only one server loads | Use unique server names |
8. Getting Help
Gather Diagnostic Information
Before asking for help, collect this information:
Diagnostic Checklist
Where to Get Help
- MCP GitHub Discussions: github.com/modelcontextprotocol/discussions
- Anthropic Discord: discord.gg/anthropic (#mcp channel)
- Server-Specific Issues: Check individual server GitHub repos for issue trackers
9. Quick Reference: Error Messages
"Server failed to start"
Check: JSON syntax, command exists, required dependencies installed
"Invalid JSON in config file"
Check: Trailing commas, missing braces, unescaped quotes
"ENOENT: no such file or directory"
Check: File path is absolute, file actually exists, permissions
"EACCES: permission denied"
Check: File permissions, macOS Full Disk Access, user privileges
"401 Unauthorized"
Check: API token is correct, not expired, in right env var
"429 Too Many Requests"
Check: Rate limits exceeded, reduce request frequency
Prevention Tips
Best Practices to Avoid Issues
- Always validate JSON before saving config changes
- Use environment variables for secrets (keep them out of config file)
- Start with one server, verify it works, then add more
- Keep MCP packages updated (
npxcaches can be outdated) - Document your setup (which servers, what they're for)
- Regularly check logs for warnings
- Test servers individually before combining them
Maintenance Checklist
Monthly Maintenance