feat: Add Dev parameter to install development dependencies
Add the Docker parameter to build the Zen MCP server Docker imag Add environnement detection (Python vs Docker) to configure the MCP server command in MCP client settings
This commit is contained in:
@@ -40,6 +40,9 @@
|
|||||||
.PARAMETER VerboseOutput
|
.PARAMETER VerboseOutput
|
||||||
Enables more detailed output (currently unused).
|
Enables more detailed output (currently unused).
|
||||||
|
|
||||||
|
.PARAMETER Dev
|
||||||
|
Installs development dependencies from requirements-dev.txt if available.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
.\run-server.ps1
|
.\run-server.ps1
|
||||||
Prepares the environment and starts the Zen MCP server.
|
Prepares the environment and starts the Zen MCP server.
|
||||||
@@ -50,6 +53,9 @@
|
|||||||
.\run-server.ps1 -Config
|
.\run-server.ps1 -Config
|
||||||
Shows configuration instructions for clients.
|
Shows configuration instructions for clients.
|
||||||
|
|
||||||
|
.\run-server.ps1 -Dev
|
||||||
|
Prepares the environment with development dependencies and starts the server.
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
Project Author : BeehiveInnovations
|
Project Author : BeehiveInnovations
|
||||||
Script Author : GiGiDKR (https://github.com/GiGiDKR)
|
Script Author : GiGiDKR (https://github.com/GiGiDKR)
|
||||||
@@ -69,7 +75,8 @@ param(
|
|||||||
[switch]$SkipVenv,
|
[switch]$SkipVenv,
|
||||||
[switch]$SkipDocker,
|
[switch]$SkipDocker,
|
||||||
[switch]$Force,
|
[switch]$Force,
|
||||||
[switch]$VerboseOutput
|
[switch]$VerboseOutput,
|
||||||
|
[switch]$Dev
|
||||||
)
|
)
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
@@ -619,10 +626,18 @@ function Initialize-VirtualEnvironment {
|
|||||||
|
|
||||||
# Install dependencies function
|
# Install dependencies function
|
||||||
function Install-Dependencies {
|
function Install-Dependencies {
|
||||||
param([string]$PythonPath = "")
|
param(
|
||||||
|
[string]$PythonPath = "",
|
||||||
|
[switch]$InstallDevDependencies = $false
|
||||||
|
)
|
||||||
|
|
||||||
|
Write-Step "Installing Dependencies"
|
||||||
|
|
||||||
|
# If this is a legacy call without parameters, handle the global $Dev parameter
|
||||||
if ($PythonPath -eq "" -or $args.Count -eq 0) {
|
if ($PythonPath -eq "" -or $args.Count -eq 0) {
|
||||||
# Legacy call without parameters
|
$InstallDevDependencies = $Dev
|
||||||
|
|
||||||
|
# Legacy call without parameters - use pip
|
||||||
$pipCmd = if (Test-Path "$VENV_PATH\Scripts\pip.exe") {
|
$pipCmd = if (Test-Path "$VENV_PATH\Scripts\pip.exe") {
|
||||||
"$VENV_PATH\Scripts\pip.exe"
|
"$VENV_PATH\Scripts\pip.exe"
|
||||||
} elseif (Test-Command "pip") {
|
} elseif (Test-Command "pip") {
|
||||||
@@ -632,8 +647,7 @@ function Install-Dependencies {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Step "Installing Dependencies"
|
Write-Info "Installing Python dependencies with pip..."
|
||||||
Write-Info "Installing Python dependencies..."
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
# Install main dependencies
|
# Install main dependencies
|
||||||
@@ -642,14 +656,17 @@ function Install-Dependencies {
|
|||||||
throw "Failed to install main dependencies"
|
throw "Failed to install main dependencies"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Install dev dependencies if file exists
|
# Install dev dependencies if requested and file exists
|
||||||
if (Test-Path "requirements-dev.txt") {
|
if ($InstallDevDependencies -and (Test-Path "requirements-dev.txt")) {
|
||||||
|
Write-Info "Installing development dependencies..."
|
||||||
& $pipCmd install -r requirements-dev.txt
|
& $pipCmd install -r requirements-dev.txt
|
||||||
if ($LASTEXITCODE -ne 0) {
|
if ($LASTEXITCODE -ne 0) {
|
||||||
Write-Warning "Failed to install dev dependencies, continuing..."
|
Write-Warning "Failed to install dev dependencies, continuing..."
|
||||||
} else {
|
} else {
|
||||||
Write-Success "Development dependencies installed"
|
Write-Success "Development dependencies installed"
|
||||||
}
|
}
|
||||||
|
} elseif ($InstallDevDependencies -and !(Test-Path "requirements-dev.txt")) {
|
||||||
|
Write-Warning "Development dependencies requested but requirements-dev.txt not found"
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Success "Dependencies installed successfully"
|
Write-Success "Dependencies installed successfully"
|
||||||
@@ -660,15 +677,30 @@ function Install-Dependencies {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
# Version with parameter - use uv or pip
|
# New version with parameter - handle global $Dev parameter if not explicitly passed
|
||||||
Write-Step "Installing Dependencies"
|
if ($args.Count -eq 1 -and $args[0] -is [string]) {
|
||||||
|
$InstallDevDependencies = $Dev
|
||||||
|
}
|
||||||
|
|
||||||
# Try uv first
|
# Try uv first for faster package management
|
||||||
if (Test-Uv) {
|
if (Test-Uv) {
|
||||||
Write-Info "Installing dependencies with uv..."
|
Write-Info "Installing dependencies with uv..."
|
||||||
try {
|
try {
|
||||||
uv pip install -r requirements.txt
|
uv pip install -r requirements.txt
|
||||||
if ($LASTEXITCODE -eq 0) {
|
if ($LASTEXITCODE -eq 0) {
|
||||||
|
# Install dev dependencies if requested and file exists
|
||||||
|
if ($InstallDevDependencies -and (Test-Path "requirements-dev.txt")) {
|
||||||
|
Write-Info "Installing development dependencies with uv..."
|
||||||
|
uv pip install -r requirements-dev.txt
|
||||||
|
if ($LASTEXITCODE -eq 0) {
|
||||||
|
Write-Success "Development dependencies installed with uv"
|
||||||
|
} else {
|
||||||
|
Write-Warning "Failed to install dev dependencies with uv, continuing..."
|
||||||
|
}
|
||||||
|
} elseif ($InstallDevDependencies -and !(Test-Path "requirements-dev.txt")) {
|
||||||
|
Write-Warning "Development dependencies requested but requirements-dev.txt not found"
|
||||||
|
}
|
||||||
|
|
||||||
Write-Success "Dependencies installed with uv"
|
Write-Success "Dependencies installed with uv"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -698,14 +730,17 @@ function Install-Dependencies {
|
|||||||
throw "Failed to install main dependencies"
|
throw "Failed to install main dependencies"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Install dev dependencies if file exists
|
# Install dev dependencies if requested and file exists
|
||||||
if (Test-Path "requirements-dev.txt") {
|
if ($InstallDevDependencies -and (Test-Path "requirements-dev.txt")) {
|
||||||
|
Write-Info "Installing development dependencies with pip..."
|
||||||
& $pipCmd install -r requirements-dev.txt
|
& $pipCmd install -r requirements-dev.txt
|
||||||
if ($LASTEXITCODE -eq 0) {
|
if ($LASTEXITCODE -eq 0) {
|
||||||
Write-Success "Development dependencies installed"
|
Write-Success "Development dependencies installed"
|
||||||
} else {
|
} else {
|
||||||
Write-Warning "Failed to install dev dependencies, continuing..."
|
Write-Warning "Failed to install dev dependencies, continuing..."
|
||||||
}
|
}
|
||||||
|
} elseif ($InstallDevDependencies -and !(Test-Path "requirements-dev.txt")) {
|
||||||
|
Write-Warning "Development dependencies requested but requirements-dev.txt not found"
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Success "Dependencies installed successfully"
|
Write-Success "Dependencies installed successfully"
|
||||||
@@ -1797,7 +1832,7 @@ function Start-MainProcess {
|
|||||||
|
|
||||||
# Step 6: Install dependencies
|
# Step 6: Install dependencies
|
||||||
try {
|
try {
|
||||||
Install-Dependencies $pythonPath
|
Install-Dependencies $pythonPath -InstallDevDependencies:$Dev
|
||||||
} catch {
|
} catch {
|
||||||
Write-Error "Failed to install dependencies: $_"
|
Write-Error "Failed to install dependencies: $_"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user