- CLAUDE.md: project context and architecture spec - docs/: system specs, DB schema, messenger integration, deployment engine - skills/: guardia-deploy, guardia-agent, guardia-messenger - .claude/settings.json: project-level permissions - .gitignore: Python/FastAPI project Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
147 lines
5.6 KiB
PowerShell
147 lines
5.6 KiB
PowerShell
# ============================================================
|
|
# GUARDiA - Claude Code + MCP Filesystem 자동 설치 스크립트
|
|
# PowerShell을 관리자 권한으로 실행 후 붙여넣기
|
|
# ============================================================
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
function Write-Step($msg) {
|
|
Write-Host "`n>>> $msg" -ForegroundColor Cyan
|
|
}
|
|
|
|
function Write-OK($msg) {
|
|
Write-Host " [OK] $msg" -ForegroundColor Green
|
|
}
|
|
|
|
function Write-Warn($msg) {
|
|
Write-Host " [!!] $msg" -ForegroundColor Yellow
|
|
}
|
|
|
|
# ──────────────────────────────────────────
|
|
# 1. C:\GUARDiA 디렉토리 생성
|
|
# ──────────────────────────────────────────
|
|
Write-Step "1/5 C:\GUARDiA 디렉토리 확인"
|
|
|
|
if (-not (Test-Path "C:\GUARDiA")) {
|
|
New-Item -ItemType Directory -Path "C:\GUARDiA" | Out-Null
|
|
Write-OK "C:\GUARDiA 생성 완료"
|
|
} else {
|
|
Write-OK "C:\GUARDiA 이미 존재"
|
|
}
|
|
|
|
# ──────────────────────────────────────────
|
|
# 2. Claude Code 설치
|
|
# ──────────────────────────────────────────
|
|
Write-Step "2/5 Claude Code 설치"
|
|
|
|
$claudePath = "$env:USERPROFILE\.local\bin\claude.exe"
|
|
$claudeInstalled = $false
|
|
|
|
if (Get-Command claude -ErrorAction SilentlyContinue) {
|
|
Write-OK "claude 명령어 이미 사용 가능"
|
|
$claudeInstalled = $true
|
|
} elseif (Test-Path $claudePath) {
|
|
Write-OK "claude.exe 존재 - PATH만 추가 필요"
|
|
} else {
|
|
Write-Warn "Claude Code 설치 중..."
|
|
try {
|
|
Invoke-RestMethod https://claude.ai/install.ps1 | Invoke-Expression
|
|
Write-OK "Claude Code 설치 완료"
|
|
} catch {
|
|
Write-Warn "공식 설치 실패 - npm으로 재시도"
|
|
if (Get-Command npm -ErrorAction SilentlyContinue) {
|
|
npm install -g @anthropic-ai/claude-code
|
|
Write-OK "npm 설치 완료"
|
|
} else {
|
|
Write-Host "`n[오류] npm도 없습니다. Node.js를 먼저 설치해 주세요:" -ForegroundColor Red
|
|
Write-Host " https://nodejs.org/en/download" -ForegroundColor Yellow
|
|
exit 1
|
|
}
|
|
}
|
|
}
|
|
|
|
# ──────────────────────────────────────────
|
|
# 3. PATH 등록
|
|
# ──────────────────────────────────────────
|
|
Write-Step "3/5 PATH 환경변수 등록"
|
|
|
|
$localBin = "$env:USERPROFILE\.local\bin"
|
|
$npmGlobal = (npm config get prefix 2>$null)
|
|
|
|
$currentPath = [Environment]::GetEnvironmentVariable("PATH", "User")
|
|
|
|
$pathsToAdd = @($localBin)
|
|
if ($npmGlobal) { $pathsToAdd += "$npmGlobal" }
|
|
|
|
foreach ($p in $pathsToAdd) {
|
|
if ($currentPath -notlike "*$p*") {
|
|
[Environment]::SetEnvironmentVariable("PATH", "$currentPath;$p", [EnvironmentVariableTarget]::User)
|
|
$env:PATH = "$env:PATH;$p"
|
|
Write-OK "PATH 추가: $p"
|
|
} else {
|
|
Write-OK "이미 PATH에 있음: $p"
|
|
}
|
|
}
|
|
|
|
# ──────────────────────────────────────────
|
|
# 4. .mcp.json 생성 (Claude Code 프로젝트 설정)
|
|
# ──────────────────────────────────────────
|
|
Write-Step "4/5 C:\GUARDiA\.mcp.json 생성"
|
|
|
|
$mcpConfig = @{
|
|
mcpServers = @{
|
|
filesystem = @{
|
|
command = "cmd"
|
|
args = @("/c", "npx", "-y", "@modelcontextprotocol/server-filesystem", "C:/GUARDiA")
|
|
}
|
|
}
|
|
} | ConvertTo-Json -Depth 5
|
|
|
|
$mcpPath = "C:\GUARDiA\.mcp.json"
|
|
Set-Content -Path $mcpPath -Value $mcpConfig -Encoding UTF8
|
|
Write-OK ".mcp.json 저장 완료: $mcpPath"
|
|
|
|
# ──────────────────────────────────────────
|
|
# 5. Claude Desktop config 업데이트
|
|
# ──────────────────────────────────────────
|
|
Write-Step "5/5 Claude Desktop 설정 업데이트"
|
|
|
|
$desktopConfigDir = "$env:APPDATA\Claude"
|
|
$desktopConfigPath = "$desktopConfigDir\claude_desktop_config.json"
|
|
|
|
if (-not (Test-Path $desktopConfigDir)) {
|
|
New-Item -ItemType Directory -Path $desktopConfigDir | Out-Null
|
|
}
|
|
|
|
$desktopConfig = @{
|
|
mcpServers = @{
|
|
filesystem = @{
|
|
command = "npx"
|
|
args = @("-y", "@modelcontextprotocol/server-filesystem", "C:\\GUARDiA")
|
|
}
|
|
}
|
|
} | ConvertTo-Json -Depth 5
|
|
|
|
Set-Content -Path $desktopConfigPath -Value $desktopConfig -Encoding UTF8
|
|
Write-OK "claude_desktop_config.json 저장 완료"
|
|
|
|
# ──────────────────────────────────────────
|
|
# 완료 메시지
|
|
# ──────────────────────────────────────────
|
|
Write-Host "`n============================================" -ForegroundColor Magenta
|
|
Write-Host " 설치 완료!" -ForegroundColor Magenta
|
|
Write-Host "============================================" -ForegroundColor Magenta
|
|
Write-Host @"
|
|
|
|
다음 단계:
|
|
1. PowerShell 창을 닫고 새로 여세요 (PATH 적용)
|
|
2. Claude Desktop을 완전히 종료 후 재시작하세요
|
|
3. Claude Code 실행:
|
|
cd C:\GUARDiA
|
|
claude
|
|
4. Claude Code 안에서 확인:
|
|
/mcp (MCP 서버 상태)
|
|
/doctor (전체 진단)
|
|
|
|
"@ -ForegroundColor White
|