AnEntrypoint/gm-exec
GitHub: AnEntrypoint/gm-exec
一个基于 Bun 的多语言代码执行工具,通过 MCP 服务器与 CLI 提供带超时与后台化能力的轻量级沙箱执行环境。
Stars: 123 | Forks: 14
# gm-exec
## 注意:如果您正在寻找 mcp-repl 或 glootie 或 GM...,现在位于:http://github.com/anEntrypoint/gm
代码执行工具,适用于 MCP 客户端和 CLI。支持多语言(JS/TS、Python、Go、Rust、C、C++、Deno、Java、Bash)。基于 Bun 构建,使用 PM2 进行进程隔离。
## MCP 服务器
将以下内容添加到您的 MCP 客户端配置中:
```
{
"mcpServers": {
"gm-exec": {
"command": "bunx",
"args": ["gm-exec", "--mcp"]
}
}
}
```
或全局安装:
```
bun install -g gm-exec
gm-exec --mcp
```
## 命令行界面
```
bunx gm-exec-cli exec --cwd=/app "console.log('hello')"
bunx gm-exec-cli bash --cwd=/app "npm install && npm test"
bunx gm-exec-cli exec --lang=python --cwd=/app "print('hello')"
bunx gm-exec-cli exec --file=script.js
```
### 命令
```
gm-exec-cli exec [options]
Execute code (waits up to 15s, then backgrounds)
--lang= nodejs (default), python, go, rust, c, cpp, java, deno
--cwd= Working directory
--file= Read code from file
gm-exec-cli bash [--cwd=] Execute bash commands, same 15s ceiling
gm-exec-cli status Poll status + drain output of a background task
gm-exec-cli close Delete a background task
gm-exec-cli runner start Start the runner manually (PM2, no autorestart)
gm-exec-cli runner stop Stop the runner
gm-exec-cli runner status Show runner PM2 status
```
### 后台执行
命令有 15 秒的硬性限制。如果在此之后仍在运行,进程将转为后台,并为您提供一个任务 ID 和监控说明:
```
Backgrounded after 15s — task still running.
Task ID: task_3
Watch output:
gm-exec-cli status task_3
gm-exec-cli close task_3
gm-exec-cli runner stop
```
运行器会在每个命令前自动启动,并在命令结束后自动停止——除非任务被转入后台,此时运行器将持续保持活跃,直到您显式停止它。
## 支持的语言
| 语言 | 运行时 |
|------|--------|
| JavaScript / TypeScript | Node.js / Bun |
| Python | python3 |
| Go | go run |
| Rust | rustc |
| C | gcc |
| C++ | g++ |
| Java | javac + java |
| Deno | deno run |
| bash / sh / zsh | shell |
## 要求
- [Bun](https://bun.sh) ≥ 1.0
```
curl -fsSL https://bun.sh/install | bash
```
标签:Bash, Bun, C, C++, CMS安全, Deno, glootie, GM, gm-exec, gm-exec-cli, Go, JavaScript, JS文件枚举, mcp-repl, MCP服务器, MITM代理, PM2, Python, Ruby工具, Rust, SEO, SOC Prime, TypeScript, 代码执行, 任务ID, 任务管理, 可视化界面, 后台执行, 命令行接口, 多语言支持, 安全插件, 安全测试框架, 工作目录, 应用安全, 开发工具, 数据擦除, 文件执行, 无后门, 日志审计, 状态监控, 网络流量审计, 自定义脚本, 进程隔离, 逆向工具