diff --git a/src/cli/commands/mcp.ts b/src/cli/commands/mcp.ts index d365b4c..a371fdc 100644 --- a/src/cli/commands/mcp.ts +++ b/src/cli/commands/mcp.ts @@ -19,7 +19,7 @@ export const mcpCommand = new Command('mcp') .description('启动 MCP 服务器') .argument('[host]', '服务器地址', 'stdio') .option('-p, --port ', 'HTTP 端口(仅 HTTP 传输)', '3001') - .option('--cwd ', '工作目录(工具调用的相对路径基准)', process.cwd()) + .option('--cwd ', '工作目录(工具调用的相对路径基准)', process.env.TTRPG_MCP_CWD || process.cwd()) .action(mcpServeAction) ) .addCommand( diff --git a/src/data-loader/file-index.ts b/src/data-loader/file-index.ts index 08f2b83..2e05e10 100644 --- a/src/data-loader/file-index.ts +++ b/src/data-loader/file-index.ts @@ -16,9 +16,9 @@ function ensureIndexLoaded(): Promise { if (indexLoadPromise) return indexLoadPromise; indexLoadPromise = (async () => { - // 尝试 CLI 环境:从 /__FILE_INDEX.json 加载 + // 尝试 CLI 环境:从 /__CONTENT_INDEX.json 加载 try { - const response = await fetch("/__FILE_INDEX.json"); + const response = await fetch("/__CONTENT_INDEX.json"); if (response.ok) { const index = await response.json(); fileIndex = { ...fileIndex, ...index };