feat(mcp): 添加 CCW_DISABLE_SANDBOX 环境变量支持禁用工作空间访问限制

- 在 path-validator.ts 中添加 isSandboxDisabled() 函数
- 修改 validatePath() 在沙箱禁用时跳过路径限制检查
- MCP server 启动日志显示沙箱状态
- /api/mcp-install-ccw API 支持 disableSandbox 参数
- Dashboard UI 添加禁用沙箱的复选框选项
- 添加中英文 i18n 翻译支持
This commit is contained in:
catlog22
2026-01-20 11:50:23 +08:00
parent eea859dd6f
commit c1d12384c3
6 changed files with 69 additions and 11 deletions

View File

@@ -1171,13 +1171,17 @@ export async function handleMcpRoutes(ctx: RouteContext): Promise<boolean> {
return { error: 'projectPath is required', status: 400 };
}
// Check if sandbox should be disabled
const disableSandbox = body.disableSandbox === true;
// Generate CCW MCP server config
// Use cmd /c to inherit Claude Code's working directory
const ccwMcpConfig = {
const ccwMcpConfig: Record<string, any> = {
command: "cmd",
args: ["/c", "npx", "-y", "ccw-mcp"],
env: {
CCW_ENABLED_TOOLS: "all"
CCW_ENABLED_TOOLS: "all",
...(disableSandbox && { CCW_DISABLE_SANDBOX: "1" })
}
};