setup.shโข3.48 kB
#!/bin/bash
# DollhouseMCP Setup Script
# Automatically configures and provides Claude Desktop integration instructions
set -e
echo "๐ญ DollhouseMCP Setup Script"
echo "=========================="
echo
# Get the absolute path of the current directory
INSTALL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DIST_PATH="${INSTALL_DIR}/dist/index.js"
echo "๐ Installation detected at:"
echo " ${INSTALL_DIR}"
echo
# Install dependencies and build
echo "๐ฆ Installing dependencies..."
npm install --silent
echo "๐จ Building TypeScript..."
npm run build
echo
# Verify build was successful
if [[ ! -f "${DIST_PATH}" ]]; then
echo "โ Build failed - dist/index.js not found"
exit 1
fi
echo "โ
DollhouseMCP successfully installed and built!"
echo
# Detect platform and set config file path
if [[ "$OSTYPE" == "darwin"* ]]; then
CONFIG_FILE="$HOME/Library/Application Support/Claude/claude_desktop_config.json"
PLATFORM="macOS"
elif [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
CONFIG_FILE="$APPDATA/Claude/claude_desktop_config.json"
PLATFORM="Windows"
else
CONFIG_FILE="$HOME/.config/claude/claude_desktop_config.json"
PLATFORM="Linux"
fi
echo "๐ง Claude Desktop Configuration:"
echo "================================"
echo "๐ Platform: $PLATFORM"
echo "๐ Config file: $CONFIG_FILE"
echo
# Check if config file exists and read it
if [[ -f "$CONFIG_FILE" ]]; then
echo "โ
Found existing Claude Desktop configuration"
# Check if it has valid JSON
if python3 -m json.tool "$CONFIG_FILE" > /dev/null 2>&1; then
echo "๐ Reading existing configuration..."
# Use Python to merge the configurations
MERGED_CONFIG=$(python3 << EOF
import json
import sys
# Read existing config
with open("$CONFIG_FILE", 'r') as f:
config = json.load(f)
# Ensure mcpServers exists
if 'mcpServers' not in config:
config['mcpServers'] = {}
# Add or update dollhousemcp server
config['mcpServers']['dollhousemcp'] = {
"command": "node",
"args": ["$DIST_PATH"]
}
# Pretty print the result
print(json.dumps(config, indent=2))
EOF
)
echo "๐ Updated configuration (copy this entire content to your config file):"
echo
echo "$MERGED_CONFIG"
echo
echo "๐ฏ The dollhousemcp server has been added to your existing configuration."
else
echo "โ ๏ธ Existing config file has invalid JSON. Here's a fresh configuration:"
echo
cat << EOF
{
"mcpServers": {
"dollhousemcp": {
"command": "node",
"args": ["$DIST_PATH"]
}
}
}
EOF
fi
else
echo "๐ No existing configuration found. Here's a fresh configuration:"
echo
cat << EOF
{
"mcpServers": {
"dollhousemcp": {
"command": "node",
"args": ["$DIST_PATH"]
}
}
}
EOF
echo
echo "๐ก Create the config file at: $CONFIG_FILE"
fi
echo
echo "๐ After updating the configuration:"
echo " 1. Save the configuration file"
echo " 2. Restart Claude Desktop completely"
echo " 3. All 23 DollhouseMCP tools will be available in your next conversation"
echo
echo "๐ฏ Quick Test:"
echo " Try using 'list_personas' tool in Claude to verify the installation works"
echo
echo "๐ Documentation:"
echo " Repository: https://github.com/DollhouseMCP/mcp-server"
echo " Marketplace: https://github.com/DollhouseMCP/personas"
echo
echo "๐ญ Happy persona management!"