Skip to content

fix: wire MCP gateway into Gemini CLI settings (localhost) - #2405

Closed
lpcox wants to merge 1 commit into
mainfrom
fix/smoke-gemini-mcp-localhost
Closed

fix: wire MCP gateway into Gemini CLI settings (localhost)#2405
lpcox wants to merge 1 commit into
mainfrom
fix/smoke-gemini-mcp-localhost

Conversation

@lpcox

@lpcox lpcox commented May 2, 2026

Copy link
Copy Markdown
Collaborator

Problem

The smoke-gemini workflow fails at "Validate safe outputs were invoked" because Gemini CLI can't reach MCP tools (github, safeoutputs).

Root cause: The MCP gateway correctly writes MCP server config to .gemini/settings.json with URLs like http://host.docker.internal:8080/mcp/github. However, host.docker.internal only resolves inside Docker containers. Unlike Claude (which runs inside AWF), Gemini runs directly on the host runner where host.docker.internal doesn't resolve.

The gateway log shows it wrote the config:

[info] Gemini configuration written to .gemini/settings.json
[info] "github": { "url": "http://host.docker.internal:8080/mcp/github" }
[info] "safeoutputs": { "url": "http://host.docker.internal:8080/mcp/safeoutputs" }

But Gemini reported: MCP issues detected. Run /mcp list for status.

Fix

Modifies the "Write Gemini Config" step in the lock file to:

  1. Replace host.docker.internal with localhost in MCP server URLs
  2. Set trust: true on MCP servers for yolo mode compatibility
  3. Log final settings for debugging

Note

This is a manual lock file patch to test the diagnosis. The proper fix belongs in gh-aw's Gemini engine compiler. If this works, we should file a gh-aw issue.

Failed run

https://github.com/github/gh-aw-firewall/actions/runs/25259025540

The MCP gateway writes github and safeoutputs server config to
.gemini/settings.json, but uses host.docker.internal URLs which
don't resolve on the host runner (only inside Docker containers).

Gemini runs directly on the host (unlike Claude which runs inside
AWF), so the URLs need to use localhost instead.

This patch:
- Replaces host.docker.internal with localhost in settings.json
- Sets trust=true on MCP servers for --yolo mode compatibility
- Logs the final settings for debugging

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 2, 2026 19:00
@lpcox
lpcox requested a review from Mossaka as a code owner May 2, 2026 19:00
@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 85.76% 85.84% 📈 +0.08%
Statements 85.64% 85.72% 📈 +0.08%
Functions 88.11% 88.11% ➡️ +0.00%
Branches 78.65% 78.69% 📈 +0.04%
📁 Per-file Coverage Changes (1 files)
File Lines (Before → After) Statements (Before → After)
src/docker-manager.ts 87.4% → 87.7% (+0.29%) 87.0% → 87.3% (+0.27%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

Smoke Test Results

  • fix: move smoke-gemini tests into agent container ✅
  • feat: unify schema versioning — use repo release tag for all schemas, publish JSONL schemas as release assets ✅
  • GitHub Connectivity: ✅ (200)
  • File Write/Read: ✅

Overall Status: PASS

💎 Faceted by Smoke Gemini

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR patches the generated Smoke Gemini workflow lock file to make Gemini CLI (running on the host runner) able to reach MCP tools exposed by the MCP gateway that currently emits host.docker.internal URLs.

Changes:

  • Post-processes .gemini/settings.json to replace host.docker.internal with localhost.
  • Forces trust: true on all configured MCP servers for --yolo runs.
  • Adds debug logging of the final Gemini settings.
Show a summary per file
File Description
.github/workflows/smoke-gemini.lock.yml Rewrites MCP server URLs for host execution, sets MCP trust flags, and logs resulting Gemini settings for debugging.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 2

Comment on lines +708 to +709
echo "Final Gemini settings:"
cat "$SETTINGS"
Comment on lines +703 to +705
if [ -f "$SETTINGS" ] && jq -e '.mcpServers' "$SETTINGS" > /dev/null 2>&1; then
jq '.mcpServers |= with_entries(.value.trust = true)' "$SETTINGS" > "${SETTINGS}.tmp" && mv "${SETTINGS}.tmp" "$SETTINGS"
echo "Set trust=true on all MCP servers"
@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

Smoke test results:
✅ GitHub MCP: Retrieved last 2 merged PRs
✅ Playwright: Page title contains "GitHub"
✅ File Writing: Created test file successfully
✅ Bash Tool: Verified file creation

Status: PASS

💥 [THE END] — Illustrated by Smoke Claude

@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia N/A ❌ CLONE_FAILED
Bun hono N/A ❌ CLONE_FAILED
C++ fmt N/A ❌ CLONE_FAILED
C++ json N/A ❌ CLONE_FAILED
Deno oak N/A ❌ CLONE_FAILED
Deno std N/A ❌ CLONE_FAILED
.NET hello-world N/A ❌ CLONE_FAILED
.NET json-parse N/A ❌ CLONE_FAILED
Go color N/A ❌ CLONE_FAILED
Go env N/A ❌ CLONE_FAILED
Go uuid N/A ❌ CLONE_FAILED
Java gson N/A ❌ CLONE_FAILED
Java caffeine N/A ❌ CLONE_FAILED
Node.js clsx N/A ❌ CLONE_FAILED
Node.js execa N/A ❌ CLONE_FAILED
Node.js p-limit N/A ❌ CLONE_FAILED
Rust fd N/A ❌ CLONE_FAILED
Rust zoxide N/A ❌ CLONE_FAILED

Overall: 0/8 ecosystems passed — ❌ FAIL

Error Details

All repository clones failed. The gh CLI is not authenticated — GH_TOKEN environment variable is not set in this workflow run.

gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable. Example:
  env:
    GH_TOKEN: $\{\{ github.token }}

Action required: Ensure the workflow passes GH_TOKEN so gh repo clone can access the test repositories.

Generated by Build Test Suite for issue #2405 · ● 144.3K ·

@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

🤖 Smoke Test Results

Test Status
GitHub MCP connectivity ✅ PR list retrieved successfully
GitHub.com HTTP connectivity ❌ Pre-step data not injected (template vars unexpanded)
File write/read ❌ Pre-step data not injected (template vars unexpanded)

PR: "fix: wire MCP gateway into Gemini CLI settings (localhost)" by @lpcox (reviewers: @Mossaka, @Copilot)

Overall: FAIL — Pre-computed smoke data was not substituted into the agent prompt; tests 2 and 3 could not be verified.

📰 BREAKING: Report filed by Smoke Copilot

@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

fix: move smoke-gemini tests into agent container
feat: unify schema versioning — use repo release tag for all schemas, publish JSONL schemas as release assets
GitHub MCP review: ❌
safeinputs-gh PR query: ❌
Playwright title / Tavily search: ✅ / ❌
File write+cat / discussion comment / AWF build: ✅ / ✅ / ✅
Overall: FAIL

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • registry.npmjs.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "registry.npmjs.org"

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex

@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot BYOK (Offline) — Results

Test Result
1. GitHub MCP (list PRs) ✅ PR #2401 "fix: move smoke-gemini tests into agent container"
2. github.com HTTP ⚠️ Template vars unexpanded ($\{\{ steps.smoke-data.outputs.SMOKE_HTTP_CODE }})
3. File write/read ⚠️ Template vars unexpanded (path not resolved)
4. BYOK inference (this response)

Running in BYOK offline mode (COPILOT_OFFLINE=true) via api-proxy → api.githubcopilot.com.

Overall: PARTIAL — tests 2 & 3 indeterminate due to unexpanded workflow template variables. Author: @lpcox. Reviewer: @Mossaka.

🔑 BYOK report filed by Smoke Copilot BYOK

@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

Smoke Test Results

  • Redis PING: ❌ (connection timeout)
  • PostgreSQL pg_isready: ❌ (no response)
  • PostgreSQL SELECT 1: ❌ (not attempted)

Overall: FAILhost.docker.internal is not reachable from this environment. Service containers may not be running or network routing is unavailable.

🔌 Service connectivity validated by Smoke Services

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants