Skip to content

Commit 1607278

Browse files
Merge pull request #342 from dhruv7539/codex/improve-docker-ghcr-troubleshooting
Improve GHCR pull troubleshooting and post-publish visibility checks
2 parents c3659b3 + 7d0a94f commit 1607278

File tree

3 files changed

+107
-0
lines changed

3 files changed

+107
-0
lines changed

.github/workflows/publish-docker.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,60 @@ jobs:
6161
labels: ${{ steps.meta.outputs.labels }}
6262
cache-from: type=gha
6363
cache-to: type=gha,mode=max
64+
65+
verify-public-access:
66+
name: Verify Anonymous GHCR Pull Access
67+
runs-on: ubuntu-latest
68+
needs: publish
69+
if: needs.publish.result == 'success'
70+
timeout-minutes: 10
71+
steps:
72+
- name: Verify anonymous manifest access (with retry)
73+
run: |
74+
set -euo pipefail
75+
image="ghcr.io/gleanwork/local-mcp-server:latest"
76+
attempts=18
77+
sleep_seconds=10
78+
success=0
79+
80+
for attempt in $(seq 1 "${attempts}"); do
81+
if docker manifest inspect "${image}" >/dev/null 2>&1; then
82+
success=1
83+
echo "Anonymous manifest access verified for ${image}"
84+
break
85+
fi
86+
87+
echo "Attempt ${attempt}/${attempts}: ${image} not anonymously available yet"
88+
sleep "${sleep_seconds}"
89+
done
90+
91+
if [[ "${success}" -ne 1 ]]; then
92+
echo "::error title=Anonymous GHCR pull failed::Unable to pull ${image} without authentication. Set GitHub Packages visibility to Public for ghcr.io/gleanwork/local-mcp-server."
93+
exit 1
94+
fi
95+
96+
- name: Pull and smoke test image anonymously
97+
run: |
98+
set -euo pipefail
99+
image="ghcr.io/gleanwork/local-mcp-server:latest"
100+
101+
docker pull "${image}"
102+
docker run --rm --entrypoint node "${image}" --version
103+
104+
init_payload='{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"gh-actions","version":"1.0"}}}'
105+
printf '%s\n' "${init_payload}" | docker run --rm -i "${image}" > /tmp/mcp-init.txt 2>&1 &
106+
docker_pid=$!
107+
sleep 3
108+
109+
if kill -0 "${docker_pid}" 2>/dev/null; then
110+
kill "${docker_pid}" 2>/dev/null || true
111+
wait "${docker_pid}" 2>/dev/null || true
112+
fi
113+
114+
if grep -q '"result"' /tmp/mcp-init.txt; then
115+
echo "MCP initialize handshake succeeded"
116+
else
117+
echo "::error title=Docker runtime smoke test failed::MCP initialize response missing from container output"
118+
cat /tmp/mcp-init.txt
119+
exit 1
120+
fi

docs/troubleshooting.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
11
# Troubleshooting
22

33
This guide helps you diagnose and resolve common issues with the Glean MCP Server.
4+
5+
## Docker image pull fails with `denied` / `403 Forbidden`
6+
7+
If `docker pull ghcr.io/gleanwork/local-mcp-server:latest` fails with a permissions error:
8+
9+
1. Authenticate to GitHub Container Registry:
10+
11+
```bash
12+
# Token must include read:packages
13+
echo "$GITHUB_TOKEN" | docker login ghcr.io -u "$GITHUB_USERNAME" --password-stdin
14+
```
15+
16+
2. Retry the pull:
17+
18+
```bash
19+
docker pull ghcr.io/gleanwork/local-mcp-server:latest
20+
```
21+
22+
3. If the image was just published, wait a few minutes for GHCR propagation and retry.
23+
24+
4. If access is still blocked, build from source as a fallback:
25+
26+
```bash
27+
docker build -t glean/local-mcp-server:local .
28+
```
29+
30+
5. If the issue persists, open a GitHub issue and include:
31+
32+
- the exact `docker pull` command
33+
- the full error output

packages/local-mcp-server/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,20 @@ Multi-architecture Docker images are published to GitHub Container Registry and
8585
docker pull ghcr.io/gleanwork/local-mcp-server:latest
8686
```
8787

88+
If you see `denied` / `403 Forbidden` when pulling from GHCR, authenticate first:
89+
90+
```bash
91+
# Token must include read:packages
92+
echo "$GITHUB_TOKEN" | docker login ghcr.io -u "$GITHUB_USERNAME" --password-stdin
93+
docker pull ghcr.io/gleanwork/local-mcp-server:latest
94+
```
95+
96+
If GHCR access is blocked in your environment, you can build locally:
97+
98+
```bash
99+
docker build -t glean/local-mcp-server:local .
100+
```
101+
88102
### MCP Client Configuration
89103

90104
Configure your MCP client to use the Docker image. Most MCP clients support passing environment variables via the `env` block:
@@ -152,6 +166,12 @@ If your MCP client doesn't pass the `env` block to Docker, use `-e` flags in the
152166
- Verify your `GLEAN_API_TOKEN` is valid
153167
- Check your `GLEAN_SERVER_URL` or `GLEAN_INSTANCE` matches your Glean deployment
154168

169+
**`docker pull` returns `denied` or `403 Forbidden`:**
170+
171+
- Authenticate to `ghcr.io` with a token that has `read:packages`
172+
- Retry pull with the same image/tag
173+
- If this persists, open an issue with your exact pull command and error output
174+
155175
**MCP client can't connect:**
156176

157177
- Verify Docker is installed and running

0 commit comments

Comments
 (0)