feat: 打通出库作业链路
This commit is contained in:
42
tools/mcp/sqlserver-mcp-server/start.ps1
Normal file
42
tools/mcp/sqlserver-mcp-server/start.ps1
Normal file
@@ -0,0 +1,42 @@
|
||||
param(
|
||||
[string]$ConfigPath = "$PSScriptRoot\..\..\..\.cursorrules-mcp.json"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$resolvedConfig = Resolve-Path -LiteralPath $ConfigPath
|
||||
$config = Get-Content -Raw -LiteralPath $resolvedConfig | ConvertFrom-Json
|
||||
$serverConfig = $config.mcpServers.mssql
|
||||
|
||||
if (-not $serverConfig) {
|
||||
throw "Cannot find mcpServers.mssql in $resolvedConfig"
|
||||
}
|
||||
|
||||
foreach ($property in $serverConfig.env.PSObject.Properties) {
|
||||
[Environment]::SetEnvironmentVariable($property.Name, [string]$property.Value, "Process")
|
||||
}
|
||||
|
||||
if (-not $env:ENABLE_DDL) {
|
||||
$env:ENABLE_DDL = "true"
|
||||
}
|
||||
|
||||
if (-not $env:MAX_ROWS) {
|
||||
$env:MAX_ROWS = "1000"
|
||||
}
|
||||
|
||||
if (-not $env:MAX_WRITE_ROWS) {
|
||||
$env:MAX_WRITE_ROWS = "100"
|
||||
}
|
||||
|
||||
$entry = Join-Path $PSScriptRoot "dist\index.js"
|
||||
if (-not (Test-Path -LiteralPath $entry)) {
|
||||
throw "MCP server is not built. Run npm install and npm run build in $PSScriptRoot first."
|
||||
}
|
||||
|
||||
$nodeExe = $env:NODE_EXE
|
||||
if (-not $nodeExe) {
|
||||
$nodeExe = (Get-Command node -ErrorAction Stop).Source
|
||||
}
|
||||
|
||||
& $nodeExe $entry @args
|
||||
exit $LASTEXITCODE
|
||||
Reference in New Issue
Block a user