GG

github/gh-aw-mcpg

开发工具官方

本页由 AI 翻译,技术细节请以原文为准。 查看原文

184 stars 58 forks 质量 82 趋势 37MIT

GitHub/GH-AW-MCPG 是一个从 https://github.com/github/gh-aw-mcpg. 导入的 MCP 服务器候选。

概览

GitHub/GH-AW-MCPG 是一个从 https://github.com/github/gh-aw-mcpg. 导入的 MCP 服务器候选。

概述(AI 翻译)

模型上下文协议(MCP)服务器的网关。

该网关通过 sandbox.mcp 配置与 GitHub 代理工作流程一起使用,为运行在沙盒环境中的 AI 代理提供 MCP 服务器访问。

快速启动

  1. 拉取 Docker 镜像(如果有的话):

  2. 创建配置文件(config.json):

注意:对于 JSON 标准配置,gateway 部分是必填,且必须包含 port、domain,以及恰好 agentId 或 agentIds 中的一个。上述数值为示例;省略 gateway 或任何这些必填字段——启动时将无法通过模式验证。其他所有 [gateway 字段为可选,存在时会进行验证。可选服务器字段包括 entrypoint、entrypointArgs、mounts、args、connectTimeout 和 toolTimeout;完整的服务器字段参考请参见 docs/CONFIGURATION.md。

在寻找完整的例子吗?参见config.example.toml、config.example-payload-threshold.toml和example-http-config.json。

  1. 运行容器:

[!注] CLI要求--config或--config-stdin;管道JSON配置需要--config-stdin。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

MCP Gateway

A gateway for Model Context Protocol (MCP) servers.

This gateway is used with GitHub Agentic Workflows via the sandbox.mcp configuration to provide MCP server access to AI agents running in sandboxed environments.

Quick Start

  1. Pull the Docker image (when available):

    docker pull ghcr.io/github/gh-aw-mcpg:latest
    
  2. Create a configuration file (config.json):

    {
      "gateway": {
        "port": 8000,
        "domain": "${MCP_GATEWAY_DOMAIN}",
        "agentId": "${MCP_GATEWAY_AGENT_ID}"
      },
      "mcpServers": {
        "github": {
          "type": "stdio",
          "container": "ghcr.io/github/github-mcp-server:latest",
          "env": {
            "GITHUB_PERSONAL_ACCESS_TOKEN": ""
          }
        }
      }
    }
    

    Note: for JSON stdin configuration the gateway section is required, and it must include port, domain, and exactly one of agentId or agentIds. The values shown above are examples; omitting gateway — or any of these required fields — fails schema validation at startup. All other gateway fields are optional and are validated when present. Optional server fields include entrypoint, entrypointArgs, mounts, args, connectTimeout, and toolTimeout; see docs/CONFIGURATION.md for the complete server-field reference.

    Looking for complete examples? See config.example.toml, config.example-payload-threshold.toml, and example-http-config.json.

  3. Run the container:

    docker run --rm -i \
      -e MCP_GATEWAY_PORT=8000 \
      -e MCP_GATEWAY_DOMAIN=localhost \
      -e MCP_GATEWAY_AGENT_ID=your-agent-id \
      -v /var/run/docker.sock:/var/run/docker.sock \
      -v /path/to/logs:/tmp/gh-aw/mcp-logs \
      -p 8000:8000 \
      ghcr.io/github/gh-aw-mcpg:latest < config.json
    

[!NOTE] The CLI requires either --config or --config-stdin; piping JSON configuration requires --config-stdin. The container entrypoint script (run_containerized.sh) automatically adds --config-stdin when it starts awmg. If you run awmg directly (outside the container) and want to pipe JSON config, you must pass --config-stdin explicitly.

Inside the container, the gateway starts in routed mode on http://0.0.0.0:8000, proxying MCP requests to your configured backend servers. When running awmg directly without --listen, the default listen address is http://127.0.0.1:3000.

Required flags:

  • -i: Enables stdin for passing JSON configuration
  • -v /var/run/docker.sock: Required when using the default Docker runtime
  • Dockerless Podman mode ("gateway": {"dockerless": true}) does not use the Docker socket; grant the container the capabilities required for nested containers (for example, --privileged)
  • -p 8000:8000: Port mapping must match MCP_GATEWAY_PORT
在 GitHub 查看完整 README

安装

docker run --rm -i \
新手?先看 mcpskill.org 教程 →

配置

{ "gateway": { "port": 8000, "domain": "${MCP_GATEWAY_DOMAIN}", "agentId": "${MCP_GATEWAY_AGENT_ID}" }, "mcpServers": { "github": { "type": "stdio", "container": "ghcr.io/github/github-mcp-server:latest", "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "" } } } }