Skip to main content
Glama

mcp-sandbox-server

一个远程 MCP(模型上下文协议)服务器,为 AI 代理提供对沙箱主机的经过认证的 shell 和文件访问权限——此外还提供一条安全、受限的路径,用于在它本不应拥有完全访问权限的独立生产主机上触发部署。

功能

  • 核心 MCP 工具(run_command、read_file、write_file、list_directory)通过 Streamable HTTP 暴露,使代理可以直接在沙箱上构建和测试代码。

  • 一个极简的 OAuth 2.1 授权服务器,从零构建:支持动态客户端注册(RFC 7591)、由单一管理员凭据保护的授权端点,以及带 PKCE 的令牌端点。之所以存在,是因为 MCP 客户端(如 claude.ai 的连接器界面)期望完整的 OAuth 流程,而不是粘贴的 bearer token——因此服务器必须支持它,即使只是单管理员场景。

  • 一个通往第二台更敏感主机的受限网关(biscuit_status、biscuit_logs、biscuit_deploy 等)。与其仅依赖工具代码来约束代理的行为边界,真正的边界被下放到更底层:目标主机上 authorized_keys 中通过 command="..." 限制的专用 SSH 密钥,确保无论客户端通过该密钥发送什么,都只能执行一个固定的、白名单内的脚本。这里的工具代码只是构造字面操作字符串——它并非安全边界,强制命令才是。

Related MCP server: ssh-mcp

构建原因

有趣的约束在于:同一个代理需要两种截然不同的信任级别——在可丢弃的沙箱上拥有完全、不受限制的 shell 权限,但在运行着实时服务的主机上只能执行少量预先批准、以读取为主的操作。与其试图对代理的行为进行沙箱化(通过提示词、工具描述等方式),设计将真正的边界下沉到操作系统层面强制执行的位置——无论代理决定发送什么,都受强制 SSH 命令和带路径穿越检查的白名单脚本约束。

技术栈

Node.js、Express、@modelcontextprotocol/sdk、Zod。无数据库——认证状态持久化在服务器旁边的一个小型 JSON 文件中。

说明

这是一个经过精简和标识符脱敏的生产环境真实服务器副本。真实主机名、IP 地址和内部项目名称均已替换为占位符(your-production-server-ip、project-a/project-b/project-c 等)。

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables AI agents to securely execute commands on remote hosts via SSH and SFTP, with persistent shells, file transfers, screenshots, and an audit log.
    5
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables AI agents to execute SSH commands and transfer files via SFTP through a centralized HTTP gateway with per-client authorization, layered command policies, audit logging, rate limiting, circuit breakers, and connection pooling.
    8
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables AI agents to remotely execute shell commands and transfer files on SSH hosts, including jump-host tunneling, background tasks, resumable transfers, and optional approval of destructive commands, while SSH credentials remain in the local process. It runs over stdio or a streamable HTTP daemon and supports auditing, allow/deny lists, and multiple authentication methods.
    ISC
  • A
    license
    A
    quality
    A
    maintenance
    Enables AI agents to inspect and manage remote hosts over SSH with tiered blast-radius containment that classifies and blocks destructive commands, plus forensic post-flight assertions that verify ports, processes, files, and HTTP health. It also provides long-running background task envelopes and atomic SFTP file editing with automatic backups, unified diffs, and one-click rollback.
    12
    MIT