Skip to main content
Glama
railway-sandbox-mcp

railway-sandbox-mcp

by erwinkn

railway-sandbox-mcp

一个小型 MCP 桥接器,让 ChatGPT 可以将 Railway Sandboxes 作为隔离的开发/执行环境来驱动。

架构

两个长期运行的 Railway 服务均通过 Railway 的 GitHub 集成从本 GitHub 仓库部署:

Railway 服务

GitHub 分支

Railway 根目录

配置即代码文件

用途

sandbox-mcp

main

/

/railway.json

由 Railway Sandbox SDK 提供支持的 Node MCP 服务器

tunnel-client

main

/tunnel-client

/tunnel-client/railway.json

OpenAI 安全 MCP 隧道客户端

tunnel-client Dockerfile 继承官方 ghcr.io/openai/tunnel-client:latest 镜像,仅包装其入口点,使上游健康/就绪服务器绑定到 Railway 注入的 PORT。部署生命周期由 Railway 负责,而 OpenAI 仍是上游镜像提供方。

ChatGPT
  |
  v
OpenAI Secure MCP Tunnel
  ^
  | outbound HTTPS
  |
tunnel-client (Railway)
  |
  | Railway private network
  v
sandbox-mcp:8080/mcp (Railway)
  |
  v
Railway Sandbox SDK
  |
  v
Ephemeral isolated Linux sandboxes with outbound Internet

两个 Railway 服务都不需要公共域名。

Related MCP server: Gemini-Cloud-Agent-MCP

配置即代码

部署行为已提交到本仓库:

  • /railway.json 定义了 MCP 服务的构建器、监视路径、启动命令、健康检查和重启策略。

  • /tunnel-client/railway.json 定义了 tunnel-client 的 Docker 构建、监视路径、就绪检查和重启策略。

  • /tunnel-client/Dockerfile 选择官方 OpenAI tunnel-client 镜像,并将其健康监听器适配到 Railway 注入的 PORT。

  • /.github/workflows/ci.yml 在推送和拉取请求时验证 Node 服务和 Railway 配置文件,并构建 tunnel-client 镜像。

以代码形式提交的 Railway 配置会覆盖每个部署在仪表板中对应的构建/部署值。

一次性 Railway 服务接线

源关联、触发分支和自定义配置文件路径属于 Railway 服务元数据,而不是 railway.json 中的字段,因此请在 Railway 中配置一次:

sandbox-mcp

  • 源仓库:erwinkn/railway-sandbox-mcp

  • 分支:main

  • 根目录:/

  • 配置文件路径:/railway.json

  • GitHub 自动部署:启用

  • 等待 CI:启用

tunnel-client

  • 源仓库:erwinkn/railway-sandbox-mcp

  • 分支:main

  • 根目录:/tunnel-client

  • 配置文件路径:/tunnel-client/railway.json

  • GitHub 自动部署:启用

  • 等待 CI:启用

  • 无自定义启动命令;继承仓库 Dockerfile 入口点

服务特定的监视路径意味着仅 MCP 的更改不会重建隧道客户端,仅隧道的更改也不会重建 MCP 服务器。

必需的环境变量

sandbox-mcp

  • RAILWAY_API_TOKEN:具有访问已启用 Sandboxes 的环境权限的 Railway API 令牌。

  • RAILWAY_ENVIRONMENT_ID:由 Railway 自动注入。

tunnel-client

  • MCP_SERVER_URL=http://sandbox-mcp.railway.internal:8080/mcp

  • CONTROL_PLANE_TUNNEL_ID=tunnel_...

  • CONTROL_PLANE_API_KEY=...:具有隧道读取和使用权限的受限 OpenAI 运行时密钥。

  • LOG_LEVEL=info

  • LOG_FORMAT=json

tunnel-client 在 Railway 注入的端口上暴露 /healthz、/readyz 和 /metrics。Railway 使用 /readyz 作为部署健康检查,因此成功的 tunnel-client 部署既验证了隧道启动,也验证了下游 MCP 的就绪状态。

部署流程

推送到 main 会运行 GitHub Actions。启用 Railway 的 等待 CI 后,Railway 会等待 CI 通过,然后仅自动部署监视模式与更改文件匹配的服务。

MCP 工具

  • sandbox_create

  • sandbox_list

  • sandbox_get

  • sandbox_exec

  • sandbox_read_file

  • sandbox_list_files

  • sandbox_write_file

  • sandbox_write_files

  • sandbox_checkpoint

  • sandbox_destroy

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables ChatGPT to execute shell commands and control Docker inside isolated, disposable sandbox microVMs without exposing the host shell or Docker daemon.
      9 npm
      2
      MIT
    • F
      license
      Not graded
      quality
      B
      maintenance
      Enables AI clients to manage and execute development commands within isolated Railway sandboxes, providing a remote shell, file read/write, and sandbox lifecycle management for running tests, builds, and repository operations.
      -