mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-11 02:33:51 +08:00
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:
@@ -12,7 +12,7 @@ import {
|
||||
} from '@modelcontextprotocol/sdk/types.js';
|
||||
import { getAllToolSchemas, executeTool, executeToolWithProgress } from '../tools/index.js';
|
||||
import type { ToolSchema, ToolResult } from '../types/tool.js';
|
||||
import { getProjectRoot, getAllowedDirectories } from '../utils/path-validator.js';
|
||||
import { getProjectRoot, getAllowedDirectories, isSandboxDisabled } from '../utils/path-validator.js';
|
||||
|
||||
const SERVER_NAME = 'ccw-tools';
|
||||
const SERVER_VERSION = '6.2.0';
|
||||
@@ -169,9 +169,14 @@ async function main(): Promise<void> {
|
||||
// Log server start (to stderr to not interfere with stdio protocol)
|
||||
const projectRoot = getProjectRoot();
|
||||
const allowedDirs = getAllowedDirectories();
|
||||
const sandboxDisabled = isSandboxDisabled();
|
||||
console.error(`${SERVER_NAME} v${SERVER_VERSION} started`);
|
||||
console.error(`Project root: ${projectRoot}`);
|
||||
console.error(`Allowed directories: ${allowedDirs.join(', ')}`);
|
||||
if (sandboxDisabled) {
|
||||
console.error(`Sandbox: DISABLED (CCW_DISABLE_SANDBOX=true)`);
|
||||
} else {
|
||||
console.error(`Allowed directories: ${allowedDirs.join(', ')}`);
|
||||
}
|
||||
if (!process.env[ENV_PROJECT_ROOT]) {
|
||||
console.error(`[Warning] ${ENV_PROJECT_ROOT} not set, using process.cwd()`);
|
||||
console.error(`[Tip] Set ${ENV_PROJECT_ROOT} in your MCP config to specify project directory`);
|
||||
|
||||
Reference in New Issue
Block a user