-
Notifications
You must be signed in to change notification settings - Fork 34
Implement MCP gateway step generation with multi-agent support #9185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add MCP field to SandboxConfig structure - Implement extractMCPGatewayConfig() to parse sandbox.mcp configuration - Add generateMCPGatewayStep() to generate gateway start step - Step reads configuration via stdin, starts gateway process, waits for /health - Captures stdout for rewritten configuration, collects logs - Handles both command and container execution modes - Supports environment variables, ports, API keys per spec - Update smoke-copilot-no-firewall workflow with container configuration Co-authored-by: pelikhan <[email protected]>
Co-authored-by: pelikhan <[email protected]>
|
|
@copilot add a step that converts the configuration from the gateway into the configuration expected by the agent. This script is agent-specific. |
…p MCPs step - Created start_mcp_gateway.sh in actions/setup/sh/ with complete gateway logic - Modified generateMCPGatewayStepInline to export env vars and call script - Integrated gateway start into Setup MCPs step instead of separate step - Gateway now runs as part of MCP configuration setup - Maintains all spec compliance (health checks, output capture, error handling) Co-authored-by: pelikhan <[email protected]>
Done in commit 026d19b:
The workflow now shows: - name: Setup MCPs
run: |
# MCP config generation...
# Start MCP gateway
export MCP_GATEWAY_PORT="8080"
export MCP_GATEWAY_DOMAIN="localhost"
export MCP_GATEWAY_API_KEY="$(openssl rand -base64 45 | tr -d '/+=')"
export MCP_GATEWAY_CONTAINER='docker run...'
# Run gateway start script
bash /tmp/gh-aw/actions/start_mcp_gateway.sh |
- Created convert_gateway_config_copilot.sh to convert gateway output to Copilot format - Modified start_mcp_gateway.sh to call appropriate converter based on agent - Gateway outputs standard HTTP format, converter adds Copilot-specific fields - Adds "tools": ["*"] field required by Copilot - Handles Authorization header with actual API key value - Extensible design allows adding converters for other agents Co-authored-by: pelikhan <[email protected]>
Done in commit 6110728. Added Gateway output (standard): {
"mcpServers": {
"server": {
"type": "http",
"url": "http://localhost:8080/mcp/server",
"headers": {"Authorization": "apiKey"}
}
}
}Copilot format (converted): {
"mcpServers": {
"server": {
"type": "http",
"url": "http://localhost:8080/mcp/server",
"headers": {"Authorization": "apiKey"},
"tools": ["*"]
}
}
}The converter:
|
|
@copilot ensure conversion for codex and Claude |
- Created convert_gateway_config_codex.sh for Codex TOML format - Created convert_gateway_config_claude.sh for Claude JSON format - Updated start_mcp_gateway.sh with intelligent engine detection - Exports GH_AW_ENGINE variable to identify agent type - Codex converter outputs TOML with [mcp_servers] sections - Claude converter outputs clean JSON without Copilot-specific fields - Auto-detects engine from GH_AW_ENGINE or config file presence - Supports all three major agents: Copilot, Codex, and Claude Co-authored-by: pelikhan <[email protected]>
Done in commit b40ec39. Added converters for all three major agents: Codex (
[history]
persistence = "none"
[mcp_servers.server-name]
url = "http://localhost:8080/mcp/server-name"
[mcp_servers.server-name.headers]
Authorization = "apiKey"Claude (
Engine detection:
All three agents now supported with proper format conversion. |
The MCP gateway step (
sandbox.mcp) was not being generated despite configuration in workflows. The step should start a gateway process that proxies MCP servers through a unified HTTP endpoint, following the MCP Gateway Specification.Changes
Configuration parsing (
pkg/workflow/)SandboxConfigwithMCP *MCPGatewayRuntimeConfigfieldextractMCPGatewayConfig()to parsesandbox.mcpfrom frontmatterGateway shell script (
actions/setup/sh/start_mcp_gateway.sh)start_safe_inputs_server.sh)Agent-specific configuration converters (
actions/setup/sh/)convert_gateway_config_copilot.sh- Copilot CLI format (JSON withtypeandtoolsfields)convert_gateway_config_codex.sh- Codex format (TOML with[mcp_servers]sections)convert_gateway_config_claude.sh- Claude format (clean JSON without Copilot-specific fields)GH_AW_ENGINEenvironment variable or config file presenceStep generation (
pkg/workflow/mcp_servers.go)generateMCPGatewayStepInline()triggered byfeatures.mcp-gateway: trueGH_AW_ENGINEenvironment variable with engine ID (copilot/codex/claude)start_mcp_gateway.shscriptmcp-config.jsonvia stdin to gateway process/healthendpoint (30 attempts, 1s intervals)/tmp/gh-aw/mcp-logs/gateway/Example configuration:
The gateway lifecycle (start, health check, output capture, PID storage) is managed by the shell script, with agent-specific configuration conversion handled by dedicated converter scripts for each supported agent (Copilot, Codex, and Claude). The "Setup MCPs" step orchestrates MCP configuration generation, gateway initialization, and format conversion in a single cohesive step.
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.