diff --git a/.eslintignore b/.eslintignore index 8109e6bec48..61e76e59ae5 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,3 @@ public/serviceWorker.js -app/mcp/mcp_config.json \ No newline at end of file +app/mcp/mcp_config.json +app/mcp/mcp_config.default.json \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index ff009b17848..d3e4193eef2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,7 +42,7 @@ COPY --from=builder /app/.next/static ./.next/static COPY --from=builder /app/.next/server ./.next/server RUN mkdir -p /app/app/mcp && chmod 777 /app/app/mcp -COPY --from=builder /app/app/mcp/mcp_config.json /app/app/mcp/ +COPY --from=builder /app/app/mcp/mcp_config.default.json /app/app/mcp/mcp_config.json EXPOSE 3000 diff --git a/app/mcp/actions.ts b/app/mcp/actions.ts index b4611d93409..e8b1ad1d00f 100644 --- a/app/mcp/actions.ts +++ b/app/mcp/actions.ts @@ -365,6 +365,8 @@ export async function getMcpConfigFromFile(): Promise { // 更新 MCP 配置文件 async function updateMcpConfig(config: McpConfigData): Promise { try { + // 确保目录存在 + await fs.mkdir(path.dirname(CONFIG_PATH), { recursive: true }); await fs.writeFile(CONFIG_PATH, JSON.stringify(config, null, 2)); } catch (error) { throw error; diff --git a/app/mcp/mcp_config.default.json b/app/mcp/mcp_config.default.json new file mode 100644 index 00000000000..da39e4ffafe --- /dev/null +++ b/app/mcp/mcp_config.default.json @@ -0,0 +1,3 @@ +{ + "mcpServers": {} +}