-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-server.ps1
More file actions
66 lines (57 loc) · 1.88 KB
/
test-server.ps1
File metadata and controls
66 lines (57 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# PowerShell script to test MSSQL MCP server with different profile directories
param (
[string]$ProfilesDir,
[switch]$CreateCustomDir
)
Write-Host "Starting MSSQL MCP Server Test" -ForegroundColor Cyan
# Function to create and test with a custom profiles directory
function Test-WithCustomDir {
param (
[string]$CustomDir
)
# Create the test directory if it doesn't exist
if (-not (Test-Path $CustomDir)) {
Write-Host "Creating custom profiles directory: $CustomDir" -ForegroundColor Yellow
New-Item -Path $CustomDir -ItemType Directory -Force | Out-Null
}
Write-Host "Testing server with custom profiles directory: $CustomDir" -ForegroundColor Green
# Set environment variable and run the server
Write-Host "Setting MCP_PROFILES_DIR=$CustomDir and starting server..."
$env:MCP_PROFILES_DIR = $CustomDir
try {
python server.py
}
catch {
Write-Host "Error running server: $_" -ForegroundColor Red
}
finally {
# Clean up environment variable
Remove-Item Env:\MCP_PROFILES_DIR
}
}
# Function to test with default directory
function Test-WithDefaultDir {
Write-Host "Testing server with default profiles directory" -ForegroundColor Green
# Run the server with default directory
try {
python server.py
}
catch {
Write-Host "Error running server: $_" -ForegroundColor Red
}
}
# Main execution logic
if ($CreateCustomDir -and -not $ProfilesDir) {
# Create a test directory in the current location
$testDir = Join-Path -Path (Get-Location) -ChildPath "test_profiles"
Test-WithCustomDir -CustomDir $testDir
}
elseif ($ProfilesDir) {
# Use the provided profiles directory
Test-WithCustomDir -CustomDir $ProfilesDir
}
else {
# Use default directory
Test-WithDefaultDir
}
Write-Host "Test complete" -ForegroundColor Cyan