Skip to content

Mount gh CLI binary in agentic-workflows MCP server container#13948

Merged
pelikhan merged 6 commits intomainfrom
copilot/add-gh-tool-mount
Feb 5, 2026
Merged

Mount gh CLI binary in agentic-workflows MCP server container#13948
pelikhan merged 6 commits intomainfrom
copilot/add-gh-tool-mount

Conversation

Copy link
Contributor

Copilot AI commented Feb 5, 2026

Solution: Add gh binary mount to agentic-workflows MCP server configuration

Problem ✅ FIXED

The agentic-workflows MCP server runs in an Alpine container and needs access to the gh CLI binary to execute commands like gh aw status. The error was:

[2026-02-05T15:39:10Z] [INFO] [backend] [docker stderr] ✗ failed to run status command: exec: "gh": executable file not found in $PATH

Solution Implemented

  1. Added gh binary mount - Mount for the gh binary from the host system (/usr/bin/gh) to the Alpine container in read-only mode
  2. Added gh version logging - Log gh CLI version on mcp-server startup for troubleshooting
  3. Use workflow.ExecGH helper - Updated to use the standard gh CLI helper for proper token configuration

Changes Made

  1. Added constant DefaultGhBinaryMount = "/usr/bin/gh:/usr/bin/gh:ro" in pkg/constants/constants.go
  2. Updated JSON format in renderAgenticWorkflowsMCPConfigWithOptions() to include gh binary mount
  3. Updated TOML format in renderAgenticWorkflowsMCPConfigTOML() to include gh binary mount
  4. Updated tests to verify gh binary mount is included in both JSON and TOML formats
  5. Recompiled all workflows - 22 workflow lock files updated with the new mount configuration
  6. Added gh version check - checkAndLogGHVersion() function logs gh CLI version on startup and warns if missing
  7. Updated to use helper - Changed to use workflow.ExecGH() helper instead of direct exec.Command() call

Testing

  • ✅ All unit tests pass
  • ✅ Code formatting validated (make fmt)
  • ✅ Build successful (make build)
  • ✅ Workflows recompiled successfully (145/145 workflows)
  • ✅ Verified gh binary mount present in compiled workflows
  • ✅ Tested mcp-server command with gh version logging

Example Output

When gh is available:

ℹ gh CLI: gh version 2.86.0 (2026-01-21)
✓ ✅ Configuration validated successfully

When gh is missing:

⚠ gh CLI not found in PATH - some MCP server operations may fail

All requirements completed successfully!

Original prompt

The compiler needs to mount the "gh" tool (ro) in the agentic-workflows configuration so that the gh-aw binary can run gh commands. See error:

[2026-02-05T15:39:10Z] [INFO] [backend] [docker stderr] ✗ failed to run status command: exec: "gh": executable file not found in $PATH

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.


Changeset

  • Type: patch
  • Description: Log the host gh CLI when the MCP server starts and mount the host gh binary for agentic workflows so containerized tools can invoke gh commands.

Generated by Changeset Generator

- Add DefaultGhBinaryMount constant for /usr/bin/gh mount path
- Update renderAgenticWorkflowsMCPConfigWithOptions to include gh binary mount
- Update renderAgenticWorkflowsMCPConfigTOML to include gh binary mount
- Update tests to verify gh binary mount is included
- Recompile all workflow files with updated agentic-workflows configuration

This fixes the error "exec: 'gh': executable file not found in $PATH" by making the gh CLI binary available inside the Alpine container where the agentic-workflows MCP server runs.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Changeset Generator failed. Please review the logs for details.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing...

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

🌑 The shadows whisper... Smoke Codex failed. The oracle requires further meditation...

Copilot AI changed the title [WIP] Add gh tool mount in agentic-workflows configuration Mount gh CLI binary in agentic-workflows MCP server container Feb 5, 2026
Copilot AI requested a review from pelikhan February 5, 2026 16:28
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Agent Container Tool Check

Tool Status Version
bash GNU bash 5.2.21
sh available
git 2.52.0
jq jq-1.7
yq v4.50.1
curl 8.5.0
gh 2.86.0
node v20.20.0
python3 3.12.3
go 1.24.12
java 21.0.10 (Temurin-Hotspot)
dotnet not found

Result: 11/12 tools available ⚠️

Note: .NET runtime (dotnet) is not available in the container. All other development tools are present and functional.

AI generated by Agent Container Smoke Test

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

🧪 Smoke test results:

PRs: #13949, #13948
✅ GitHub MCP | ✅ Safe Inputs | ✅ Serena | ✅ Playwright | ✅ File I/O | ✅ Bash | ✅ Discussion | ✅ Build

Status: ✅ PASS

@pelikhan @Copilot

AI generated by Smoke Copilot

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Smoke Test PASSED - Claude Engine

Results:

  • ✅ GitHub MCP
  • ✅ Safe Inputs GH CLI
  • ✅ Serena MCP
  • ✅ Make Build
  • ✅ Playwright
  • ✅ Tavily Search
  • ✅ File Operations
  • ✅ Discussion Interaction
  • ✅ Agentic Workflows MCP

§21719572202

AI generated by Smoke Claude

@pelikhan
Copy link
Contributor

pelikhan commented Feb 5, 2026

@copilot the mcp-server command should run "gh version" to log the current github cli version and report if it is missing

- Add checkAndLogGHVersion() function to check gh CLI availability
- Log gh version on mcp-server startup for troubleshooting
- Show warning if gh CLI is not found in PATH
- Addresses feedback to log gh version and report if missing

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 5, 2026

@copilot the mcp-server command should run "gh version" to log the current github cli version and report if it is missing

Implemented in commit 3cf00a8. The mcp-server command now logs the gh CLI version on startup and displays a warning if gh is not found in PATH.

Example output when gh is available:

ℹ gh CLI: gh version 2.86.0 (2026-01-21)

When gh is missing:

⚠ gh CLI not found in PATH - some MCP server operations may fail


// checkAndLogGHVersion checks if gh CLI is available and logs its version
func checkAndLogGHVersion() {
cmd := exec.Command("gh", "version")
Copy link
Contributor

Choose a reason for hiding this comment

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

@copilot use helper to run gh

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in commit 0eab03f to use workflow.ExecGH() helper instead of direct exec.Command() call.

- Replace direct exec.Command call with workflow.ExecGH helper
- Ensures proper token configuration and environment setup
- Follows established pattern for gh CLI execution in the codebase

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing...

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Changeset Generator completed successfully!

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

🌑 The shadows whisper... Smoke Codex failed. The oracle requires further meditation...

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Agent Container Tool Check

Tool Status Version
bash 5.2.21
sh available
git 2.52.0
jq 1.7
yq 4.50.1
curl 8.5.0
gh 2.86.0
node 20.20.0
python3 3.12.3
go 1.24.12
java Executable issues (renamed to bash)
dotnet Executable issues (renamed to bash)

Result: 10/12 tools available ⚠️

Note: Java and .NET executables appear to have been modified/renamed to bash in the container environment. This may indicate a security restriction or environment configuration issue.

AI generated by Agent Container Smoke Test

@github-actions github-actions bot removed the smoke label Feb 5, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Smoke Test PASS - Run 21720995330

PR Titles:

Results: ✅ GitHub MCP | ✅ GH CLI | ✅ Serena | ✅ Playwright | ✅ File Write | ✅ Bash | ✅ Discussion | ✅ Build | ✅ Dispatch

@Copilot @pelikhan

AI generated by Smoke Copilot

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

@pelikhan pelikhan marked this pull request as ready for review February 5, 2026 17:19
Copilot AI review requested due to automatic review settings February 5, 2026 17:19
@pelikhan pelikhan merged commit 3867826 into main Feb 5, 2026
53 of 54 checks passed
@pelikhan pelikhan deleted the copilot/add-gh-tool-mount branch February 5, 2026 17:19
Copy link
Contributor

Copilot AI left a comment

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 resolves an issue where the agentic-workflows MCP server running in an Alpine container could not execute gh CLI commands because the binary was not accessible within the container. The solution mounts the host's gh binary into the container and adds version checking during MCP server startup.

Changes:

  • Adds /usr/bin/gh binary mount configuration for containerized MCP servers
  • Implements gh CLI version logging on MCP server startup for troubleshooting
  • Updates all 22 compiled workflow lock files with the new mount configuration

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/constants/constants.go Adds DefaultGhBinaryMount constant defining the read-only mount path for gh CLI binary
pkg/workflow/mcp_config_builtin.go Updates JSON and TOML config generators to include gh binary mount in the mounts array
pkg/workflow/mcp_config_refactor_test.go Adds test assertions to verify gh binary mount is present in both JSON and TOML formats
pkg/cli/mcp_server.go Implements checkAndLogGHVersion() function to validate and log gh CLI availability at startup
.changeset/patch-log-gh-cli-version.md Documents the changeset for this patch release
.github/workflows/*.lock.yml 22 workflow lock files updated with the new gh binary mount configuration

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

Comment on lines +390 to +391
// DefaultGhBinaryMount is the mount path for the gh CLI binary in containerized MCP servers
// The gh CLI is required for agentic-workflows MCP server to run gh commands
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

The hardcoded path /usr/bin/gh assumes the GitHub CLI is installed at this specific location. While this is the standard location on Ubuntu (which is used for GitHub Actions runners per the PR context), this assumption may break if:

  1. The gh CLI is installed via a different method (e.g., Homebrew, manual download) which places it elsewhere
  2. The host system has gh in a non-standard location
  3. Future changes to GitHub Actions runner images change the installation location

Consider documenting this assumption clearly in the constant's comment, or exploring a more robust approach such as:

  • Using which gh or command -v gh to dynamically determine the gh binary location during workflow setup
  • Providing a way to override this mount path via configuration
  • Adding validation in the MCP server startup to warn users if gh is not found at the expected location

Note that the PR does add gh version checking in checkAndLogGHVersion() which will warn if gh is missing, but this happens after the mount is configured and may not provide clear guidance about the mount path issue.

Suggested change
// DefaultGhBinaryMount is the mount path for the gh CLI binary in containerized MCP servers
// The gh CLI is required for agentic-workflows MCP server to run gh commands
// DefaultGhBinaryMount is the default mount path for the gh CLI binary in containerized MCP servers.
// This assumes that gh is installed at /usr/bin/gh on both the host and in the container,
// which is true for GitHub Actions Ubuntu runners but may not hold for all environments
// (e.g., Homebrew installations, custom host images, or non-Ubuntu systems).
// Callers should override this mount when gh is installed in a different location.
// The gh CLI is required for agentic-workflows MCP server to run gh commands.

Copilot uses AI. Check for mistakes.
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