-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-claude.sh
executable file
·58 lines (48 loc) · 1.9 KB
/
install-claude.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# Exit on error
set -e
# Get the absolute path to the project directory
PROJECT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BUILD_DIR="$PROJECT_DIR/build"
echo "Building the project..."
bash "$PROJECT_DIR/build.sh"
# Get the platform-specific Claude configuration directory
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
CONFIG_DIR="$HOME/Library/Application Support/Claude"
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Linux
CONFIG_DIR="$HOME/.config/Claude"
else
# Windows (untested)
CONFIG_DIR="$APPDATA/Claude"
fi
echo "Detected Claude configuration directory: $CONFIG_DIR"
# Create the configuration directory if it doesn't exist
mkdir -p "$CONFIG_DIR"
# Create or update the Claude configuration
CONFIG_FILE="$CONFIG_DIR/claude_desktop_config.json"
if [ -f "$CONFIG_FILE" ]; then
echo "Found existing Claude configuration, updating..."
# Create a backup of the existing configuration
cp "$CONFIG_FILE" "$CONFIG_FILE.backup"
# Check if the configuration already has an mcpServers section
if grep -q "\"mcpServers\"" "$CONFIG_FILE"; then
# Replace or add the prompt-manager entry
TMP_FILE=$(mktemp)
jq ".mcpServers.\"prompt-manager\" = {\"command\": \"node\", \"args\": [\"$BUILD_DIR/index.js\"]}" "$CONFIG_FILE" > "$TMP_FILE"
mv "$TMP_FILE" "$CONFIG_FILE"
else
# Add the mcpServers section
TMP_FILE=$(mktemp)
jq ". += {\"mcpServers\": {\"prompt-manager\": {\"command\": \"node\", \"args\": [\"$BUILD_DIR/index.js\"]}}}" "$CONFIG_FILE" > "$TMP_FILE"
mv "$TMP_FILE" "$CONFIG_FILE"
fi
else
echo "Creating new Claude configuration..."
# Create a new configuration file
echo "{\"mcpServers\": {\"prompt-manager\": {\"command\": \"node\", \"args\": [\"$BUILD_DIR/index.js\"]}}}" > "$CONFIG_FILE"
fi
echo "Configuration updated successfully:"
cat "$CONFIG_FILE"
echo "Installation complete! Please restart Claude Desktop to use the Prompt Manager."