Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 22, 2025

Enables custom command or container-based execution for the MCP gateway, matching the configuration pattern used for MCP server tools.

Changes

Core types and parsing

  • Added Command field to MCPGatewayConfig struct
  • Updated parseMCPGatewayTool() to extract command configuration
  • Extended JSON schema with command field and updated descriptions

Gateway step generation

  • Refactored generateMCPGatewayStartStep() into three execution modes:
    • generateContainerStartCommands() - Docker-based execution with full container control
    • generateCommandStartCommands() - Custom command with args and environment
    • generateDefaultAWMGCommands() - Existing awmg binary fallback

Validation

  • Enforces mutual exclusivity between command and container
  • Restricts entrypointArgs to container mode only

Testing

  • 14 new tests covering all execution modes and validation rules

Usage

Container mode with full Docker configuration:

sandbox:
  mcp:
    container: "ghcr.io/githubnext/gh-aw-mcpg:latest"
    args: ["--rm", "-i", "-v", "/var/run/docker.sock:/var/run/docker.sock"]
    entrypointArgs: ["--routed", "--listen", "0.0.0.0:8000", "--config-stdin"]
    port: 8000
    env:
      DOCKER_API_VERSION: "1.44"

Custom command mode:

sandbox:
  mcp:
    command: "/usr/local/bin/mcp-gateway"
    args: ["--port", "9000", "--verbose"]
    env:
      LOG_LEVEL: "debug"

Default mode (no command/container) continues to use awmg binary as before.

Original prompt

Add support in configuration of sandbox.mcp to configure a command or container that execute. The data structure is similar to configuring a mcp server tool: command, args, container, env, ... When this configuration is selected, the compiler generates a step that invokes the tool configure to launch the gateway.

sandbox:
  mcp:
     container: ...
     command: ... # or conatiner, not both
     args: ...
     entrypointArgs: ... # if container
     env:
       ...: ...

For example:

sandbox:
  mcp:
    container: "ghcr.io/githubnext/gh-aw-mcpg:latest"
    args:
      ["--rm", "-i", "-v", "/var/run/docker.sock:/var/run/docker.sock", "-p", "8000:8000", "--entrypoint", "/app/flowguard-go"]
    entrypointArgs: 
      ["--routed", "--listen", "0.0.0.0:8000", "--config-stdin"]
    port: 8000
    env: 
      "DOCKER_API_VERSION": "1.44" 

The env should be populated from the secrets required by the mcp servers.


💡 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.

Copilot AI and others added 3 commits December 22, 2025 17:03
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>
Copilot AI changed the title [WIP] Add support for mcp configuration to execute commands or containers Add command/container execution support to sandbox.mcp configuration Dec 22, 2025
Copilot AI requested a review from pelikhan December 22, 2025 17:15
@pelikhan pelikhan marked this pull request as ready for review December 22, 2025 17:17
@pelikhan pelikhan merged commit bc2b27f into main Dec 22, 2025
4 checks passed
@pelikhan pelikhan deleted the copilot/add-sandbox-mcp-configuration branch December 22, 2025 17:17
github-actions bot added a commit that referenced this pull request Dec 22, 2025
…on modes

Add documentation for the new command field and clarify MCP gateway execution modes.

Changes:
- Add command field to sandbox.mcp configuration options
- Clarify that command and container are mutually exclusive
- Update container field from required to optional
- Document three execution modes: custom command, container, and default awmg
- Add practical examples for each execution mode
- Update How It Works section to reflect all execution modes

Addresses features from #7294

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
pelikhan pushed a commit that referenced this pull request Dec 22, 2025
…on modes (#7305)

Add documentation for the new command field and clarify MCP gateway execution modes.

Changes:
- Add command field to sandbox.mcp configuration options
- Clarify that command and container are mutually exclusive
- Update container field from required to optional
- Document three execution modes: custom command, container, and default awmg
- Add practical examples for each execution mode
- Update How It Works section to reflect all execution modes

Addresses features from #7294

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants