#!/bin/bash
# Claude Desktop Configuration Fix Script
CONFIG_PATH="/Users/batchlions/Library/Application Support/Claude/claude_desktop_config.json"
CONFIG_DIR="/Users/batchlions/Library/Application Support/Claude"
BACKUP_DIR="/Users/batchlions/Documents/augment-projects/MCPAgent"
echo "๐ง Claude Desktop Configuration Fix Script"
echo "=========================================="
# Ensure directory exists
if [ ! -d "$CONFIG_DIR" ]; then
echo "๐ Creating Claude config directory..."
mkdir -p "$CONFIG_DIR"
fi
# Remove any existing config file
if [ -f "$CONFIG_PATH" ]; then
echo "๐๏ธ Removing existing config file..."
rm "$CONFIG_PATH"
fi
# Create minimal, clean config using Python to ensure perfect JSON
echo "๐ Creating new configuration file..."
python3 -c "
import json
config = {
'mcpServers': {
'speech': {
'command': '/Users/batchlions/miniconda3/envs/mcp_agent/bin/python',
'args': ['/Users/batchlions/Documents/augment-projects/MCPAgent/audio_server.py']
}
}
}
with open('$CONFIG_PATH', 'w') as f:
json.dump(config, f, indent=2)
"
# Validate JSON
echo "โ
Validating JSON syntax..."
if python -m json.tool "$CONFIG_PATH" > /dev/null 2>&1; then
echo "โ
JSON is valid"
else
echo "โ JSON validation failed"
exit 1
fi
# Check file permissions
echo "๐ Checking file permissions..."
chmod 644 "$CONFIG_PATH"
echo "โ
Permissions set to 644"
# Check if audio server exists
AUDIO_SERVER="/Users/batchlions/Documents/augment-projects/MCPAgent/audio_server.py"
if [ -f "$AUDIO_SERVER" ]; then
echo "โ
Audio server script found"
else
echo "โ Audio server script not found: $AUDIO_SERVER"
exit 1
fi
# Check Python environment
PYTHON_PATH="/Users/batchlions/miniconda3/envs/mcp_agent/bin/python"
if [ -f "$PYTHON_PATH" ]; then
echo "โ
Python environment found"
else
echo "โ Python environment not found: $PYTHON_PATH"
exit 1
fi
# Test audio server can start
echo "๐งช Testing audio server startup..."
timeout 3 "$PYTHON_PATH" "$AUDIO_SERVER" 2>&1 | head -5
if [ $? -eq 124 ]; then
echo "โ
Audio server starts successfully (timeout expected)"
else
echo "โ ๏ธ Audio server test completed"
fi
# Check for conflicting files
echo "๐ Checking for conflicting configuration files..."
find "$CONFIG_DIR" -name "*.json" -not -path "*/node_modules/*" -not -path "*/sentry/*" | grep -v claude_desktop_config.json | head -5
echo ""
echo "๐ Configuration fixed successfully!"
echo ""
echo "๐ Next steps:"
echo " 1. Completely quit Claude Desktop (Cmd+Q)"
echo " 2. Wait 10 seconds"
echo " 3. Restart Claude Desktop"
echo " 4. Wait for MCP servers to initialize (15-30 seconds)"
echo " 5. Test with: 'Please use speech to say Hello World'"
echo ""
echo "๐ Config file location: $CONFIG_PATH"
echo "๐ Current config:"
cat "$CONFIG_PATH"
echo ""
echo "๐ก If problems persist:"
echo " โข Check Claude Desktop Console logs (Help > Developer Tools)"
echo " โข Ensure no other MCP configs conflict"
echo " โข Try running: $PYTHON_PATH $AUDIO_SERVER manually"
echo " โข Check if Claude Desktop has permission to access files"