cambios mcp remoto
This commit is contained in:
@@ -105,6 +105,7 @@ const readProjectAcaiFallback = () => {
|
||||
forge_host: forgeHost,
|
||||
tokenHash: data.tokenHash || process.env.ACAI_TOKEN_HASH || null,
|
||||
mode,
|
||||
project_dir: projectDir || null,
|
||||
profileName: "acai-file",
|
||||
role: resolveEffectiveRole(data.role),
|
||||
};
|
||||
@@ -142,6 +143,7 @@ const resolveLocalProjectFallback = async () => {
|
||||
forge_host: forgeHost,
|
||||
tokenHash: info.tokenHash || process.env.ACAI_TOKEN_HASH || null,
|
||||
mode,
|
||||
project_dir: info.project_dir || projectDir || null,
|
||||
profileName: "project-info",
|
||||
role: resolveEffectiveRole(info.role),
|
||||
};
|
||||
@@ -313,8 +315,8 @@ export const setSessionUserToken = (userToken, sessionId) => {
|
||||
* @param {string} sessionId - The session ID (SSE transport session)
|
||||
* @param {string} mcpSessionId - Optional MCP-Session-Id for persistence across SSE reconnections
|
||||
*/
|
||||
export const setCredentials = async ({ website, web_url, api_web_url, forge_host, token, tokenHash, profileName, role }, sessionId, mcpSessionId = null) => {
|
||||
console.error(`[Credentials] setCredentials(${sessionId}) - website=${website}, web_url=${web_url}, api_web_url=${api_web_url}, forge_host=${forge_host || ""}, hasToken=${!!token}, hasTokenHash=${!!tokenHash}, profile=${profileName || "manual"}, role=${role || 'default'}, hasMcpSessionId=${!!mcpSessionId}`);
|
||||
export const setCredentials = async ({ website, web_url, api_web_url, forge_host, token, tokenHash, profileName, role, project_dir }, sessionId, mcpSessionId = null) => {
|
||||
console.error(`[Credentials] setCredentials(${sessionId}) - website=${website}, web_url=${web_url}, api_web_url=${api_web_url}, forge_host=${forge_host || ""}, hasToken=${!!token}, hasTokenHash=${!!tokenHash}, profile=${profileName || "manual"}, role=${role || 'default'}, project_dir=${project_dir || ""}, hasMcpSessionId=${!!mcpSessionId}`);
|
||||
|
||||
const creds = {
|
||||
website,
|
||||
@@ -323,6 +325,7 @@ export const setCredentials = async ({ website, web_url, api_web_url, forge_host
|
||||
forge_host: forge_host || null,
|
||||
token,
|
||||
tokenHash,
|
||||
project_dir: project_dir || null,
|
||||
profileName: profileName || "manual",
|
||||
role: role || DEFAULT_ROLE,
|
||||
};
|
||||
|
||||
@@ -1,18 +1,32 @@
|
||||
import axios from "axios";
|
||||
import { LOCAL_SERVER_URL, getLocalServerHeaders } from "../config/index.js";
|
||||
|
||||
export async function fetchProjectInfo(projectName) {
|
||||
/**
|
||||
* Resuelve info de un proyecto contra el server Python local.
|
||||
*
|
||||
* @param {string|Object} projectName - nombre del proyecto o query object (ej. { project_dir })
|
||||
* @param {string|null} acaiUser - usuario Acai propietario del proyecto. Si se pasa,
|
||||
* se reenvia como header `X-Acai-User` para aislar la busqueda a
|
||||
* `/opt/acai/webs/<user>/`. Nginx valida el secret y añade este header
|
||||
* automaticamente; en modo stdio no se propaga y la logica original se
|
||||
* mantiene.
|
||||
*/
|
||||
export async function fetchProjectInfo(projectName, acaiUser = null) {
|
||||
const params = typeof projectName === "string" ? { project: projectName } : (projectName || {});
|
||||
const headers = getLocalServerHeaders();
|
||||
if (acaiUser) headers["X-Acai-User"] = acaiUser;
|
||||
const response = await axios.get(`${LOCAL_SERVER_URL}/api/project-info`, {
|
||||
params,
|
||||
headers: getLocalServerHeaders(),
|
||||
headers,
|
||||
});
|
||||
return response.data; // { success, web_url, token, tokenHash, domain, project_dir }
|
||||
}
|
||||
|
||||
export async function fetchProjectsList() {
|
||||
export async function fetchProjectsList(acaiUser = null) {
|
||||
const headers = getLocalServerHeaders();
|
||||
if (acaiUser) headers["X-Acai-User"] = acaiUser;
|
||||
const response = await axios.get(`${LOCAL_SERVER_URL}/api/mcp/projects`, {
|
||||
headers: getLocalServerHeaders(),
|
||||
headers,
|
||||
});
|
||||
return response.data; // { success, projects: [...] }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user