cambios mcp remoto

This commit is contained in:
Jordan Diaz
2026-04-17 20:03:02 +00:00
parent d41a94b57d
commit 2ac01acd61
15 changed files with 344 additions and 123 deletions

View File

@@ -5,6 +5,7 @@ import { withAuth, getSessionCredentials } from "../../auth/index.js";
import { handleToolError, validateRequired } from "../helpers/errorHandler.js";
import { withAuthParams } from "../helpers/authSchema.js";
import { LOCAL_SERVER_URL } from "../../config/index.js";
import { resolveCurrentAcaiUser } from "../helpers/sessionHelpers.js";
export function registerCompileModuleTool(server) {
server.tool(
@@ -44,11 +45,16 @@ Pass the full path to the index-base.tpl file and the project directory.`,
? { project: projectSlug, relativePath, project_dir: projectDir }
: { file: filePath, project_dir: projectDir };
// Call the Python server compile endpoint
// Call the Python server compile endpoint. Inyectar X-Acai-User
// cuando hay sesion HTTP activa para que el endpoint autenticado
// resuelva el proyecto dentro de /opt/acai/webs/<user>/.
const acaiUser = resolveCurrentAcaiUser();
const headers = { "Content-Type": "application/json" };
if (acaiUser) headers["X-Acai-User"] = acaiUser;
const response = await axios.post(
`${LOCAL_SERVER_URL}/api/compile-module`,
payload,
{ headers: { "Content-Type": "application/json" }, timeout: 30000 }
{ headers, timeout: 30000 }
);
if (response.data?.ok) {