You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's the PowerShell script content that should be saved as setup-claude-mcps.ps1:
# Claude MCP Setup Script# Package Configuration# Format: # - Packages starting with @ will be installed via npm# - Other packages will be installed via pip$PACKAGES_TO_INSTALL=@(
"@modelcontextprotocol/server-filesystem","@patruff/server-terminator","mcp-server-sqlite"# Add new packages below this line# "@patruff/server-somenewone",# "patruff-mcp-financetool"
)
# API Keys Configuration# Define all API keys here - they can be passed as parameters or prompted during script execution$API_KEYS=@{
GIT_PAT_TOKEN=""# GitHub Personal Access Token# Add new API keys here# OPENAI_API_KEY = ""# AZURE_API_KEY = ""
}
# MCP Server Configurations# Add new MCP configurations here as hashtables$MCP_CONFIGS=@{
filesystem=@{
command="C:\Program Files\nodejs\node.exe"args=@(
"C:\Users\$env:USERNAME\AppData\Roaming\npm\node_modules\@modelcontextprotocol\server-filesystem\dist\index.js","C:\Users\$env:USERNAME\anthropicFun"
)
}
terminator=@{
command="C:\Program Files\nodejs\node.exe"args=@(
"C:\Users\$env:USERNAME\AppData\Roaming\npm\node_modules\@patruff\server-terminator\dist\index.js"
)
env=@{
GITHUB_PERSONAL_ACCESS_TOKEN="{GIT_PAT_TOKEN}"# Reference to API key
}
}
sqlite=@{
command="uv"args=@(
"--directory","parent_of_servers_repo/servers/src/sqlite","run","mcp-server-sqlite","--db-path","~/test.db"
)
}
}
param (
[Parameter(HelpMessage="GitHub Personal Access Token")]
[string]$GIT_PAT_TOKEN="",# Add additional API key parameters here
[Parameter(HelpMessage="Skip API key prompts and use empty values")]
[switch]$skipPrompts=$false
)
# Get current username and paths$username=$env:USERNAME$configPath="C:\Users\$username\AppData\Roaming\Claude"$configFile=Join-Path$configPath"claude_desktop_config.json"# Check if Claude desktop directory existsif (-not (Test-Path$configPath)) {
Write-Host"Error: Claude desktop directory not found. Please install Claude desktop first."-ForegroundColor Red
exit1
}
# Check if config file existsif (-not (Test-Path$configFile)) {
Write-Host"Error: Claude desktop config file not found."-ForegroundColor Red
exit1
}
# Function to collect API keysfunctionGet-ApiKeys {
# First, apply any keys passed as parametersforeach ($keyin$API_KEYS.Keys) {
$paramValue=Get-Variable-Name $key-ErrorAction SilentlyContinue
if ($paramValue-and$paramValue.Value) {
$API_KEYS[$key] =$paramValue.Value
}
}
# Then prompt for any missing keys if not skipping promptsif (-not$skipPrompts) {
foreach ($keyin$API_KEYS.Keys) {
if (-not$API_KEYS[$key]) {
$API_KEYS[$key] =Read-Host"Enter value for $key (press Enter to skip)"
}
}
}
}
# Function to replace API key placeholders in configfunctionReplace-ApiKeyPlaceholders {
param (
[hashtable]$config
)
$jsonConfig=$config|ConvertTo-Json-Depth 10foreach ($keyin$API_KEYS.Keys) {
$placeholder="{$key}"if ($jsonConfig.Contains($placeholder)) {
$jsonConfig=$jsonConfig.Replace($placeholder,$API_KEYS[$key])
}
}
return$jsonConfig|ConvertFrom-Json
}
# Function to update config JSONfunctionUpdate-Config {
param (
[string]$configFile,
[PSCustomObject]$newConfig
)
try {
$config=Get-Content$configFile|ConvertFrom-Json# Initialize mcpServers if it doesn't existif (-not$config.PSObject.Properties.Name.Contains("mcpServers")) {
$config|Add-Member-NotePropertyName "mcpServers"-NotePropertyValue @{}
}
# Replace API key placeholders and merge config$newConfig= Replace-ApiKeyPlaceholders -config $newConfigforeach ($serverin$newConfig.PSObject.Properties) {
$config.mcpServers|Add-Member-NotePropertyName $server.Name-NotePropertyValue $server.Value-Force
}
# Save updated config$config|ConvertTo-Json-Depth 10|Set-Content$configFileWrite-Host"Config updated successfully for $($server.Name)"-ForegroundColor Green
}
catch {
Write-Host"Error updating config: $_"-ForegroundColor Red
}
}
# Function to install packages based on prefixfunctionInstall-Package {
param (
[string]$package
)
try {
if ($package.StartsWith("@")) {
Write-Host"Installing NPM package: $package"-ForegroundColor Yellow
npm install -g $package
}
else {
Write-Host"Installing Python package: $package"-ForegroundColor Yellow
pip install $package
}
Write-Host"Successfully installed $package"-ForegroundColor Green
}
catch {
Write-Host"Error installing $package`: $_"-ForegroundColor Red
}
}
# Collect API keysWrite-Host"Collecting API keys..."-ForegroundColor Yellow
Get-ApiKeys# Install all packagesWrite-Host"Installing packages..."-ForegroundColor Yellow
foreach ($packagein$PACKAGES_TO_INSTALL) {
Install-Package-package $package
}
# Update configurationsWrite-Host"Updating configurations..."-ForegroundColor Yellow
Update-Config-configFile $configFile-newConfig ([PSCustomObject]$MCP_CONFIGS)
Write-Host"Setup completed successfully!"-ForegroundColor Green
You can copy this content and save it as setup-claude-mcps.ps1 in the repository.
The text was updated successfully, but these errors were encountered:
Here's the PowerShell script content that should be saved as
setup-claude-mcps.ps1
:You can copy this content and save it as
setup-claude-mcps.ps1
in the repository.The text was updated successfully, but these errors were encountered: