|
| 1 | +# Firecrawl Extension Installer for Claude SEO (Windows) |
| 2 | +$ErrorActionPreference = 'Stop' |
| 3 | + |
| 4 | +Write-Host "====================================" -ForegroundColor Cyan |
| 5 | +Write-Host " Firecrawl Extension - Installer" -ForegroundColor Cyan |
| 6 | +Write-Host " For Claude SEO" -ForegroundColor Cyan |
| 7 | +Write-Host "====================================" -ForegroundColor Cyan |
| 8 | +Write-Host "" |
| 9 | + |
| 10 | +$SkillDir = "$env:USERPROFILE\.claude\skills\seo-firecrawl" |
| 11 | +$SeoSkillDir = "$env:USERPROFILE\.claude\skills\seo" |
| 12 | +$SettingsFile = "$env:USERPROFILE\.claude\settings.json" |
| 13 | + |
| 14 | +# Check prerequisites |
| 15 | +if (-not (Test-Path $SeoSkillDir)) { |
| 16 | + Write-Host "x Claude SEO is not installed." -ForegroundColor Red |
| 17 | + Write-Host " Install it first: irm https://raw.githubusercontent.com/AgriciDaniel/claude-seo/main/install.ps1 | iex" |
| 18 | + exit 1 |
| 19 | +} |
| 20 | +Write-Host "v Claude SEO detected" -ForegroundColor Green |
| 21 | + |
| 22 | +$nodeVersion = (node -v 2>$null) -replace 'v','' |
| 23 | +if (-not $nodeVersion) { |
| 24 | + Write-Host "x Node.js is required but not installed." -ForegroundColor Red |
| 25 | + exit 1 |
| 26 | +} |
| 27 | +$major = [int]($nodeVersion -split '\.')[0] |
| 28 | +if ($major -lt 20) { |
| 29 | + Write-Host "x Node.js 20+ required (found v$nodeVersion)." -ForegroundColor Red |
| 30 | + exit 1 |
| 31 | +} |
| 32 | +Write-Host "v Node.js v$nodeVersion detected" -ForegroundColor Green |
| 33 | + |
| 34 | +# Prompt for API key |
| 35 | +Write-Host "" |
| 36 | +Write-Host "Firecrawl API key required." -ForegroundColor Yellow |
| 37 | +Write-Host "Sign up at: https://www.firecrawl.dev/app/sign-up" |
| 38 | +Write-Host "Free tier: 500 credits/month" |
| 39 | +Write-Host "" |
| 40 | + |
| 41 | +$apiKey = Read-Host "Firecrawl API key" -AsSecureString |
| 42 | +$apiKeyPlain = [Runtime.InteropServices.Marshal]::PtrToStringAuto( |
| 43 | + [Runtime.InteropServices.Marshal]::SecureStringToBSTR($apiKey)) |
| 44 | +if ([string]::IsNullOrWhiteSpace($apiKeyPlain)) { |
| 45 | + Write-Host "x API key cannot be empty." -ForegroundColor Red |
| 46 | + exit 1 |
| 47 | +} |
| 48 | + |
| 49 | +# Determine source directory |
| 50 | +$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path |
| 51 | +$SourceDir = $null |
| 52 | +if (Test-Path "$ScriptDir\skills\seo-firecrawl\SKILL.md") { |
| 53 | + $SourceDir = $ScriptDir |
| 54 | +} elseif (Test-Path "$ScriptDir\extensions\firecrawl\skills\seo-firecrawl\SKILL.md") { |
| 55 | + $SourceDir = "$ScriptDir\extensions\firecrawl" |
| 56 | +} else { |
| 57 | + Write-Host "x Cannot find extension source files." -ForegroundColor Red |
| 58 | + exit 1 |
| 59 | +} |
| 60 | + |
| 61 | +# Install skill |
| 62 | +Write-Host "" |
| 63 | +Write-Host "=> Installing Firecrawl skill..." -ForegroundColor Yellow |
| 64 | +New-Item -ItemType Directory -Force -Path $SkillDir | Out-Null |
| 65 | +Copy-Item "$SourceDir\skills\seo-firecrawl\SKILL.md" "$SkillDir\SKILL.md" -Force |
| 66 | + |
| 67 | +# Configure MCP server |
| 68 | +Write-Host "=> Configuring MCP server..." -ForegroundColor Yellow |
| 69 | +$settingsContent = if (Test-Path $SettingsFile) { Get-Content $SettingsFile -Raw | ConvertFrom-Json } else { @{} } |
| 70 | +if (-not $settingsContent.mcpServers) { $settingsContent | Add-Member -NotePropertyName mcpServers -NotePropertyValue @{} -Force } |
| 71 | +$settingsContent.mcpServers | Add-Member -NotePropertyName 'firecrawl-mcp' -NotePropertyValue @{ |
| 72 | + command = 'npx' |
| 73 | + args = @('-y', 'firecrawl-mcp') |
| 74 | + env = @{ FIRECRAWL_API_KEY = $apiKeyPlain } |
| 75 | +} -Force |
| 76 | +$settingsContent | ConvertTo-Json -Depth 10 | Set-Content $SettingsFile -Encoding UTF8 |
| 77 | +Write-Host " v MCP server configured" -ForegroundColor Green |
| 78 | + |
| 79 | +# Pre-warm |
| 80 | +Write-Host "=> Pre-downloading firecrawl-mcp..." -ForegroundColor Yellow |
| 81 | +npx -y firecrawl-mcp --help 2>$null | Out-Null |
| 82 | + |
| 83 | +Write-Host "" |
| 84 | +Write-Host "v Firecrawl extension installed!" -ForegroundColor Green |
| 85 | +Write-Host "" |
| 86 | +Write-Host "Usage:" |
| 87 | +Write-Host " /seo firecrawl crawl https://example.com" |
| 88 | +Write-Host " /seo firecrawl map https://example.com" |
| 89 | +Write-Host " /seo firecrawl scrape https://example.com/page" |
0 commit comments