# MCP Puppet Production Setup & Update Script
# Run this in PowerShell as Administrator
Write-Host "π MCP Puppet Production Setup & Update Script" -ForegroundColor Cyan
Write-Host "=============================================" -ForegroundColor Cyan
# Check if running as administrator
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
if (-not $isAdmin) {
Write-Host "β οΈ Please run this script as Administrator" -ForegroundColor Yellow
exit 1
}
# Step 1: Update Claude Desktop Configuration
Write-Host "`nπ Step 1: Updating Claude Desktop Configuration..." -ForegroundColor Green
$claudeConfigPath = "$env:APPDATA\Claude\claude_desktop_config.json"
$configContent = @'
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"G:\\",
"N:\\",
"M:\\",
"X:\\",
"F:\\",
"C:\\"
]
},
"puppet-production": {
"command": "node",
"args": [
"-e",
"const WebSocket = require('ws'); const ws = new WebSocket('wss://0074b446-63ea-4ec0-87f6-65be05f05ade-00-38w5635e857ah.kirk.replit.dev:3000/mcp'); ws.on('open', () => { process.stdin.on('data', (data) => ws.send(data)); ws.on('message', (data) => process.stdout.write(data)); process.stdin.resume(); }); ws.on('error', (err) => { console.error('WebSocket error:', err); process.exit(1); });"
],
"env": {}
}
}
}
'@
# Create Claude config directory if it doesn't exist
$claudeConfigDir = Split-Path $claudeConfigPath -Parent
if (-not (Test-Path $claudeConfigDir)) {
New-Item -Path $claudeConfigDir -ItemType Directory -Force | Out-Null
Write-Host "β
Created Claude config directory" -ForegroundColor Green
}
# Backup existing config if it exists
if (Test-Path $claudeConfigPath) {
$backupPath = "$claudeConfigPath.backup.$(Get-Date -Format 'yyyyMMdd_HHmmss')"
Copy-Item $claudeConfigPath $backupPath
Write-Host "β
Backed up existing config to: $backupPath" -ForegroundColor Green
}
# Write new configuration
$configContent | Out-File -FilePath $claudeConfigPath -Encoding UTF8
Write-Host "β
Updated Claude Desktop configuration" -ForegroundColor Green
# Step 2: Check and Install Dependencies
Write-Host "`nπ§ Step 2: Checking Dependencies..." -ForegroundColor Green
# Check Node.js
try {
$nodeVersion = node --version
Write-Host "β
Node.js: $nodeVersion" -ForegroundColor Green
} catch {
Write-Host "β Node.js not found. Please install Node.js from https://nodejs.org" -ForegroundColor Red
exit 1
}
# Check npm
try {
$npmVersion = npm --version
Write-Host "β
npm: $npmVersion" -ForegroundColor Green
} catch {
Write-Host "β npm not found" -ForegroundColor Red
exit 1
}
# Update npm to latest
Write-Host "π Updating npm to latest version..." -ForegroundColor Yellow
try {
npm install -g npm@latest | Out-Null
Write-Host "β
npm updated" -ForegroundColor Green
} catch {
Write-Host "β οΈ npm update failed (may require different permissions)" -ForegroundColor Yellow
}
# Install/Update WebSocket dependency globally
Write-Host "π Installing/Updating WebSocket dependency..." -ForegroundColor Yellow
try {
npm install -g ws | Out-Null
Write-Host "β
WebSocket dependency installed" -ForegroundColor Green
} catch {
Write-Host "β οΈ WebSocket installation failed" -ForegroundColor Yellow
}
# Step 3: Test MCP Server Connection
Write-Host "`nπ Step 3: Testing MCP Server Connection..." -ForegroundColor Green
$mcpUrl = "https://0074b446-63ea-4ec0-87f6-65be05f05ade-00-38w5635e857ah.kirk.replit.dev/api/health"
try {
$response = Invoke-RestMethod -Uri $mcpUrl -TimeoutSec 10
if ($response.status -eq "ok") {
Write-Host "β
MCP Server is responding" -ForegroundColor Green
Write-Host " Services:" -ForegroundColor Gray
Write-Host " - OpenAI: $($response.services.openai)" -ForegroundColor Gray
Write-Host " - Affogato: $($response.services.affogato)" -ForegroundColor Gray
Write-Host " - ElevenLabs: $($response.services.elevenlabs)" -ForegroundColor Gray
Write-Host " - Notion: $($response.services.notion)" -ForegroundColor Gray
}
} catch {
Write-Host "β MCP Server connection failed: $($_.Exception.Message)" -ForegroundColor Red
}
# Step 4: Test WebSocket Connection
Write-Host "`nπ Step 4: Testing WebSocket Connection..." -ForegroundColor Green
$wsTestScript = @'
const WebSocket = require('ws');
const ws = new WebSocket('wss://0074b446-63ea-4ec0-87f6-65be05f05ade-00-38w5635e857ah.kirk.replit.dev:3000/mcp');
ws.on('open', () => {
console.log('β
WebSocket connection successful');
ws.send(JSON.stringify({
jsonrpc: '2.0',
method: 'initialize',
params: {
protocolVersion: '2025-06-18',
capabilities: {},
clientInfo: { name: 'test-client', version: '1.0.0' }
},
id: 1
}));
});
ws.on('message', (data) => {
const response = JSON.parse(data.toString());
if (response.result && response.result.serverInfo) {
console.log('β
MCP Protocol handshake successful');
console.log(' Server:', response.result.serverInfo.name, response.result.serverInfo.version);
}
ws.close();
});
ws.on('error', (error) => {
console.log('β WebSocket connection failed:', error.message);
});
ws.on('close', () => {
process.exit(0);
});
setTimeout(() => {
console.log('β° Connection timeout');
process.exit(1);
}, 5000);
'@
try {
$wsTestScript | node
} catch {
Write-Host "β WebSocket test failed: $($_.Exception.Message)" -ForegroundColor Red
}
# Step 5: Kill and Restart Claude Desktop
Write-Host "`nπ Step 5: Restarting Claude Desktop..." -ForegroundColor Green
# Kill Claude Desktop processes
try {
Get-Process -Name "Claude" -ErrorAction SilentlyContinue | Stop-Process -Force
Write-Host "β
Stopped Claude Desktop processes" -ForegroundColor Green
} catch {
Write-Host "β οΈ No Claude Desktop processes found" -ForegroundColor Yellow
}
# Wait a moment
Start-Sleep -Seconds 2
# Try to start Claude Desktop (common installation paths)
$claudePaths = @(
"$env:LOCALAPPDATA\Programs\Claude\Claude.exe",
"$env:APPDATA\Claude\Claude.exe",
"C:\Program Files\Claude\Claude.exe",
"C:\Program Files (x86)\Claude\Claude.exe"
)
$claudeStarted = $false
foreach ($path in $claudePaths) {
if (Test-Path $path) {
try {
Start-Process $path
Write-Host "β
Started Claude Desktop: $path" -ForegroundColor Green
$claudeStarted = $true
break
} catch {
Write-Host "β οΈ Failed to start Claude Desktop: $path" -ForegroundColor Yellow
}
}
}
if (-not $claudeStarted) {
Write-Host "β οΈ Please manually start Claude Desktop" -ForegroundColor Yellow
}
# Final Summary
Write-Host "`nπ― Setup Complete!" -ForegroundColor Cyan
Write-Host "=================" -ForegroundColor Cyan
Write-Host "β
Claude Desktop configuration updated" -ForegroundColor Green
Write-Host "β
Dependencies checked/updated" -ForegroundColor Green
Write-Host "β
MCP server connectivity tested" -ForegroundColor Green
Write-Host "β
Claude Desktop restarted" -ForegroundColor Green
Write-Host ""
Write-Host "π Next Steps:" -ForegroundColor Yellow
Write-Host "1. Open Claude Desktop" -ForegroundColor White
Write-Host "2. Look for 'puppet-production' and 'filesystem' tools" -ForegroundColor White
Write-Host "3. Test character creation functionality" -ForegroundColor White
Write-Host ""
Write-Host "π MCP Server URLs:" -ForegroundColor Cyan
Write-Host " Dashboard: https://0074b446-63ea-4ec0-87f6-65be05f05ade-00-38w5635e857ah.kirk.replit.dev" -ForegroundColor White
Write-Host " WebSocket: wss://0074b446-63ea-4ec0-87f6-65be05f05ade-00-38w5635e857ah.kirk.replit.dev:3000/mcp" -ForegroundColor White
Read-Host "`nPress Enter to exit"