Skip to content

Commit 426c703

Browse files
committed
fix(github-mcp): repair binary install — asset names are version-less; download via gh API octet-stream instead of blocked direct CDN
- Release tarballs are named github-mcp-server_Linux_x86_64.tar.gz (no version in the filename), so the previous asset-name construction never matched and install silently failed (server pointed at a missing binary). - Direct GitHub CDN returns 404 from this network; switch to authenticated gh API asset endpoint (Accept: application/octet-stream). - Export GITHUB_PERSONAL_ACCESS_TOKEN (canonical env var the binary reads) in start.sh alongside GITHUB_TOKEN; mcp.json now resolves it.
1 parent 3b349eb commit 426c703

2 files changed

Lines changed: 37 additions & 24 deletions

File tree

support/install-github-mcp-server.sh

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,29 @@ case "$ARCH" in
2929
*) echo "ERROR: Unsupported architecture: $ARCH" >&2; exit 1 ;;
3030
esac
3131

32-
TARBALL="github-mcp-server_${VERSION#v}_${OS_ARCH}.tar.gz"
33-
DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${VERSION}/${TARBALL}"
34-
3532
echo "Installing GitHub MCP Server ${VERSION} (${OS_ARCH})..."
3633
mkdir -p "$BINARY_DIR"
3734

38-
curl -fsSL "$DOWNLOAD_URL" -o "/tmp/${TARBALL}"
39-
tar -xzf "/tmp/${TARBALL}" -C "$BINARY_DIR"
40-
rm -f "/tmp/${TARBALL}"
35+
# Direct GitHub CDN (github.com/.../releases/download/...) returns 404 from this
36+
# network. Download the release asset via the authenticated gh API octet-stream
37+
# endpoint (redirects to object storage). Match by filename substring — full-
38+
# string `==` on asset .name intermittently fails in gh's gojq, so use `contains`.
39+
# Release tarball names carry NO version (github-mcp-server_${OS_ARCH}.tar.gz).
40+
# Match by the OS_ARCH substring only.
41+
_asset_match="${OS_ARCH}"
42+
_asset_id="$(gh api "repos/${REPO}/releases/tags/${VERSION}" --jq '.assets[] | select(.name | contains("'"$_asset_match"'")) | .id' 2>/dev/null | head -1)"
43+
if [[ -z "$_asset_id" ]]; then
44+
echo "ERROR: Could not resolve release asset for ${VERSION}" >&2
45+
exit 1
46+
fi
47+
48+
TMP_TARBALL="/tmp/github-mcp-server.tar.gz"
49+
gh api -H "Accept: application/octet-stream" "repos/${REPO}/releases/assets/${_asset_id}" > "$TMP_TARBALL" 2>/dev/null || {
50+
echo "ERROR: Failed to download GitHub MCP Server binary" >&2
51+
exit 1
52+
}
53+
tar -xzf "$TMP_TARBALL" -C "$BINARY_DIR"
54+
rm -f "$TMP_TARBALL"
4155

4256
chmod +x "${BINARY_DIR}/github-mcp-server"
4357
echo "Installed: ${BINARY_DIR}/github-mcp-server"

support/start.sh

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ export LPB_EXA_API_KEY="${LPB_EXA_API_KEY:-${EXA_API_KEY:-}}"
124124
# lpb.conf.env may set LPB_GITHUB_TOKEN to a literal string; start.sh
125125
# resolves the actual token by trying: shell env > LPB_GITHUB_TOKEN (literal) > gh auth token.
126126
export GITHUB_TOKEN="${GITHUB_TOKEN:-${LPB_GITHUB_TOKEN:-$(gh auth token 2>/dev/null || true)}}"
127+
# Canonical env var name the github-mcp-server binary reads for stdio auth.
128+
# mcp.json resolves ${GITHUB_PERSONAL_ACCESS_TOKEN} from this export.
129+
export GITHUB_PERSONAL_ACCESS_TOKEN="${GITHUB_TOKEN}"
127130
export LPB_GITHUB_TOKEN="${GITHUB_TOKEN}"
128131

129132
# ── GitHub MCP Server toolsets ──
@@ -133,14 +136,20 @@ export GITHUB_TOOLSETS="${GITHUB_TOOLSETS:-${LPB_GITHUB_TOOLSETS:-all}}"
133136
_github_mcp_bin="/home/lpb/.local/pi-support/bin/github-mcp-server"
134137
if [[ ! -x "$_github_mcp_bin" ]]; then
135138
_version="${LPB_GITHUB_MCP_SERVER_VERSION:-v1.8.0}"
136-
_asset_name="github-mcp-server_${_version#v}_Linux_x86_64.tar.gz"
137139
info "Installing GitHub MCP Server v${_version}..."
138140
mkdir -p /home/lpb/.local/pi-support/bin
139-
# Direct GitHub CDN returns 404 from some container networks — use gh API for authenticated downloads
140-
_asset_url="$(gh api "repos/github/github-mcp-server/releases/tags/${_version}" --jq '.assets[] | select(.name=="'"$_asset_name"'") | .url' 2>/dev/null)"
141-
if [[ -n "$_asset_url" ]]; then
142-
_download_url="$(gh api "$_asset_url" --jq '.browser_download_url')"
143-
if curl -fsSL "$_download_url" -o /tmp/github-mcp-server.tar.gz 2>/dev/null; then
141+
# Direct GitHub CDN (github.com/.../releases/download/...) returns 404 from
142+
# this network, and gh's .browser_download_url resolves to that same blocked
143+
# URL. Instead download the release asset via the authenticated gh API
144+
# octet-stream endpoint (redirects to object storage). Match by filename
145+
# substring — full-string `==` on asset .name intermittently fails in gh's
146+
# gojq, so use `contains`.
147+
# Release tarball names carry NO version (github-mcp-server_Linux_x86_64.tar.gz).
148+
# Match by the OS_ARCH substring only.
149+
_asset_match="Linux_x86_64"
150+
_asset_id="$(gh api "repos/github/github-mcp-server/releases/tags/${_version}" --jq '.assets[] | select(.name | contains("'"$_asset_match"'")) | .id' 2>/dev/null | head -1)"
151+
if [[ -n "$_asset_id" ]]; then
152+
if gh api -H "Accept: application/octet-stream" "repos/github/github-mcp-server/releases/assets/${_asset_id}" > /tmp/github-mcp-server.tar.gz 2>/dev/null; then
144153
tar -xzf /tmp/github-mcp-server.tar.gz -C /home/lpb/.local/pi-support/bin
145154
chmod +x "$_github_mcp_bin"
146155
rm -f /tmp/github-mcp-server.tar.gz
@@ -150,18 +159,8 @@ if [[ ! -x "$_github_mcp_bin" ]]; then
150159
warn "Failed to download GitHub MCP Server binary via gh API."
151160
fi
152161
else
153-
# Fallback: try direct download (may fail from some networks)
154-
if curl -fsSL "https://github.com/github/github-mcp-server/releases/download/${_version}/${_asset_name}" \
155-
-o /tmp/github-mcp-server.tar.gz 2>/dev/null; then
156-
tar -xzf /tmp/github-mcp-server.tar.gz -C /home/lpb/.local/pi-support/bin
157-
chmod +x "$_github_mcp_bin"
158-
rm -f /tmp/github-mcp-server.tar.gz
159-
chown -R 1000:1000 /home/lpb/.local/pi-support
160-
info "GitHub MCP Server v${_version} installed."
161-
else
162-
warn "Failed to download GitHub MCP Server from release page."
163-
warn "Manually install with: curl -fsSL 'https://github.com/github/github-mcp-server/releases/download/${_version}/${_asset_name}' -o /tmp/github-mcp-server.tar.gz && tar -xzf /tmp/github-mcp-server.tar.gz -C /home/lpb/.local/pi-support/bin && chmod +x /home/lpb/.local/pi-support/bin/github-mcp-server"
164-
fi
162+
warn "Could not resolve GitHub MCP Server release asset for v${_version}."
163+
warn "Manually install with: gh api -H 'Accept: application/octet-stream' <asset_url> > /tmp/github-mcp-server.tar.gz && tar -xzf /tmp/github-mcp-server.tar.gz -C /home/lpb/.local/pi-support/bin"
165164
fi
166165
else
167166
debug "GitHub MCP Server already installed at $_github_mcp_bin"

0 commit comments

Comments
 (0)