install.shโข3.17 kB
#!/bin/bash
# SCS MCP Server - One-line installer
set -e
echo "๐ Installing SCS MCP Server..."
# Get the directory of this script
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
# Check Python version
echo "๐ฆ Checking Python..."
if ! command -v python3 &> /dev/null; then
echo "โ Python 3 is required but not installed."
exit 1
fi
PYTHON_VERSION=$(python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
echo " โ
Python $PYTHON_VERSION found"
# Install dependencies
echo "๐ฆ Installing dependencies..."
cd "$PROJECT_DIR"
pip3 install -q -r requirements.txt 2>/dev/null || {
echo " โ ๏ธ Some dependencies might have conflicts, but continuing..."
}
# Download and check the AI model
python3 "$PROJECT_DIR/scripts/download_model.py" || {
echo " โ ๏ธ Model download had issues but may work on first use"
}
# Create Claude Desktop config directory if it doesn't exist
CLAUDE_CONFIG_DIR="$HOME/.config/claude"
if [ ! -d "$CLAUDE_CONFIG_DIR" ]; then
echo "๐ Creating Claude Desktop config directory..."
mkdir -p "$CLAUDE_CONFIG_DIR"
fi
# Update Claude Desktop MCP config
echo "๐ง Configuring Claude Desktop..."
CLAUDE_CONFIG_FILE="$CLAUDE_CONFIG_DIR/claude_desktop_config.json"
if [ -f "$CLAUDE_CONFIG_FILE" ]; then
# Backup existing config
cp "$CLAUDE_CONFIG_FILE" "$CLAUDE_CONFIG_FILE.backup.$(date +%Y%m%d_%H%M%S)"
echo " ๐ Backed up existing config"
# Add our server to existing config
python3 -c "
import json
import sys
config_file = '$CLAUDE_CONFIG_FILE'
with open(config_file, 'r') as f:
config = json.load(f)
if 'mcpServers' not in config:
config['mcpServers'] = {}
config['mcpServers']['scs-mcp'] = {
'command': 'python3',
'args': ['-m', 'src.server'],
'cwd': '$PROJECT_DIR',
'env': {
'PYTHONPATH': '$PROJECT_DIR'
}
}
with open(config_file, 'w') as f:
json.dump(config, f, indent=2)
print(' โ
Updated Claude Desktop configuration')
"
else
# Create new config
cat > "$CLAUDE_CONFIG_FILE" << EOF
{
"mcpServers": {
"scs-mcp": {
"command": "python3",
"args": ["-m", "src.server"],
"cwd": "$PROJECT_DIR",
"env": {
"PYTHONPATH": "$PROJECT_DIR"
}
}
}
}
EOF
echo " โ
Created Claude Desktop configuration"
fi
# Test the server
echo "๐งช Testing server..."
cd "$PROJECT_DIR"
timeout 2 python3 -m src.server 2>/dev/null || {
if [ $? -eq 124 ]; then
echo " โ
Server starts successfully"
else
echo " โ ๏ธ Server test had issues but may still work"
fi
}
echo ""
echo "โจ Installation complete!"
echo ""
echo "๐ Next steps:"
echo " 1. Restart Claude Desktop"
echo " 2. The SCS MCP tools will be available in your conversations"
echo ""
echo "๐ ๏ธ Available tools:"
echo " โข search - Search code by meaning"
echo " โข index - Index a project"
echo " โข analyze_symbol - Analyze a symbol"
echo " โข find_similar - Find similar code"
echo " โข get_context - Get relevant context"
echo ""
echo "๐ Project location: $PROJECT_DIR"
echo ""