远程子代理MCP服务器
](https://www.npmjs.com/package/remote-subagents)  
MCP(模型上下文协议)服务器,使您的本地AI代理能够使用E2B沙箱生成短暂的远程子代理。
特性
- 短暂的沙盒:每个任务都在隔离的E2B云环境中运行
- 安全执行:风险操作发生在远程,而不是在您的机器上
- Claude代码集成:子代理使用Claude代码执行复杂任务
- 可配置超时:沙盒、安装和执行阶段的可定制超时
- 结构化日志记录:JSON格式的日志,便于解析和监控
- 优雅关闭:终止时正确清理沙盒
目录
建筑
┌─────────────────────────────────────────────────────────────────┐
│ MCP Client │
│ (Claude Desktop / claude-code) │
└─────────────────────────────┬───────────────────────────────────┘
│ MCP Protocol (stdio)
▼
┌─────────────────────────────────────────────────────────────────┐
│ Remote Sub-agents Server │
│ ┌─────────────┐ ┌──────────────┐ ┌────────────────────────┐ │
│ │ Metrics │ │ Logging │ │ Shutdown Handler │ │
│ └─────────────┘ └──────────────┘ └────────────────────────┘ │
│ ┌─────────────────────────────────────────────────────────────┐│
│ │ spawn_remote_agent Tool ││
│ │ • Input validation (Zod) ││
│ │ • Shell argument escaping ││
│ │ • Sandbox lifecycle management ││
│ └─────────────────────────────────────────────────────────────┘│
└─────────────────────────────┬───────────────────────────────────┘
│ E2B API
▼
┌─────────────────────────────────────────────────────────────────┐
│ E2B Cloud Sandbox │
│ ┌─────────────────────────────────────────────────────────────┐│
│ │ 1. npm install @anthropic-ai/claude-code ││
│ │ 2. claude --dangerously-skip-permissions -p "" ││
│ │ 3. Return stdout/stderr ││
│ └─────────────────────────────────────────────────────────────┘│
│ (Auto-terminated) │
└─────────────────────────────────────────────────────────────────┘请求流
- MCP客户端发送
spawn_remote_agent工具调用 - 服务器使用Zod模式验证输入
- E2B沙盒已创建,并配置了超时
- Claude Code已安装在沙盒中
- 使用正确转义的参数执行任务
- 结果(stdout/stderr)返回给客户端
- 沙盒已终止并清理干净
快速开始
# Clone the repository
git clone https://github.com/GeorgePearse/remote-subagents.git
cd remote-subagents
# Install dependencies
npm install
# Create .env file
cat > .env debug.log获取帮助
贡献
我们欢迎捐款!请遵循以下指南:
入门指南
- 复刻仓库
- 创建要素分支:
git checkout -b feature/my-feature - 进行更改
- 运行测试:
npm test - 用描述性消息提交
- 推送并创建拉取请求
代码风格
- 对所有新代码使用TypeScript
- 遵循现有代码格式(Prettier)
- 为公共功能添加JSDoc注释
- 编写新功能的单元测试
提交消息
使用常规提交格式:
feat: add retry logic for sandbox creation
fix: handle unicode characters in task description
docs: update configuration section
test: add edge cases for shell escaping拉取请求流程
- 必要时更新文档
- 为新功能添加测试
- 确保所有测试通过
- 请求维护人员审查
许可证
MIT许可证-请参阅 许可证 了解详情。
