[WIP] Fix MCP config generation for Copilot CLI#14881
Closed
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plan: Fix sandbox: false MCP config and base_branch issues ✅
All Issues Fixed
RenderJSONMCPConfigDirectfunction to write/home/runner/.copilot/mcp-config.jsondirectly when sandbox is disabled, enabling Copilot CLI to discover safeoutputs servercreate_pull_requestandpush_to_pull_request_branchhandlers to usegithub.event.pull_request.head.ref || github.ref_nameinstead of justgithub.ref_nameref: ${{ github.event.pull_request.head.ref || github.ref }}to safe_outputs checkout stepImplementation Complete ✅
Changes Summary
Files Modified:
pkg/workflow/compiler_safe_outputs_config.go- Updatedbase_branchincreate_pull_requestandpush_to_pull_request_branchhandlers to usegithub.event.pull_request.head.ref || github.ref_namepkg/workflow/compiler_safe_outputs_steps.go- Addedref: ${{ github.event.pull_request.head.ref || github.ref }}parameter to checkout steppkg/workflow/copilot_mcp.go- Added logic to callRenderJSONMCPConfigDirectwhen sandbox is disabledpkg/workflow/mcp_renderer.go- Added newRenderJSONMCPConfigDirectfunction with comprehensive documentationpkg/workflow/mcp_setup_generator.go- Added "Write MCP config" step when sandbox is disabled for Copilot engineValidation ✅
✅ All unit tests pass (make test-unit)
✅ All linters pass (make lint)
✅ All 147 workflows recompile successfully (make recompile)
✅ Code review completed with documentation improvements addressed
✅ Test workflow confirms MCP config is written when
sandbox: false✅ Test workflow confirms base_branch uses
github.event.pull_request.head.ref || github.ref_name✅ Test workflow confirms checkout uses
ref: ${{ github.event.pull_request.head.ref || github.ref }}Security Summary
No new security vulnerabilities introduced. The changes:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.