@@ -105,6 +105,19 @@ function isNewVersion(
105
105
return $true
106
106
}
107
107
108
+ function Get-GitHubApiHeaders {
109
+ $token = $env: GITHUB_TOKEN
110
+ if ($token )
111
+ {
112
+ Write-Host " Using authenticated GitHub API requests to install MCP server."
113
+ $headers = @ {
114
+ Authorization = " bearer $token "
115
+ }
116
+ return $headers
117
+ }
118
+ return @ {}
119
+ }
120
+
108
121
<#
109
122
. SYNOPSIS
110
123
Installs a standalone version of an engsys tool.
@@ -135,11 +148,12 @@ function Install-Standalone-Tool (
135
148
}
136
149
137
150
$tag = " ${Package} _${Version} "
151
+ $headers = Get-GitHubApiHeaders
138
152
139
153
if (! $Version -or $Version -eq " *" ) {
140
154
Write-Host " Attempting to find latest version for package '$Package '"
141
155
$releasesUrl = " https://api.github.com/repos/$Repository /releases"
142
- $releases = Invoke-RestMethod - Uri $releasesUrl
156
+ $releases = Invoke-RestMethod - Uri $releasesUrl - Headers $headers
143
157
$found = $false
144
158
foreach ($release in $releases ) {
145
159
if ($release.tag_name -like " $Package *" ) {
@@ -163,7 +177,7 @@ function Install-Standalone-Tool (
163
177
164
178
if (isNewVersion $version $downloadFolder ) {
165
179
Write-Host " Installing '$Package ' '$Version ' to '$downloadFolder ' from $downloadUrl "
166
- Invoke-WebRequest - Uri $downloadUrl - OutFile $downloadLocation
180
+ Invoke-WebRequest - Uri $downloadUrl - OutFile $downloadLocation - Headers $headers
167
181
168
182
if ($downloadFile -like " *.zip" ) {
169
183
Expand-Archive - Path $downloadLocation - DestinationPath $downloadFolder - Force
0 commit comments