Fix browser-info timeout y clipboard en Windows
- Agregar case 'getClientInfo' faltante en websocket-server switch - Clipboard: usar execSync input en vez de embeber token en shell string
This commit is contained in:
@@ -25058,10 +25058,10 @@ mcpServer.setRequestHandler(CallToolRequestSchema, async (request) => {
|
||||
if (request.params.name === "_webmcp_get-token") {
|
||||
const token = await generateNewRegistrationToken();
|
||||
try {
|
||||
execSync(`printf '%s' '${token}' | clip.exe`, { stdio: "ignore" });
|
||||
execSync("clip.exe", { input: token, stdio: ["pipe", "ignore", "ignore"] });
|
||||
} catch (e) {
|
||||
try {
|
||||
execSync(`printf '%s' '${token}' | xclip -selection clipboard`, { stdio: "ignore" });
|
||||
execSync("xclip -selection clipboard", { input: token, stdio: ["pipe", "ignore", "ignore"] });
|
||||
} catch (e2) {
|
||||
}
|
||||
}
|
||||
@@ -25735,6 +25735,9 @@ wss.on("connection", (ws, req) => {
|
||||
case "clientInfoResponse":
|
||||
handleToolResponse(data);
|
||||
break;
|
||||
case "getClientInfo":
|
||||
handleGetClientInfo(ws, clientChannel, data);
|
||||
break;
|
||||
case "clearRegistry":
|
||||
handleClearRegistry(ws, data);
|
||||
break;
|
||||
@@ -26094,6 +26097,32 @@ function handleClientInfo(ws, data) {
|
||||
clientMetadata.set(ws, { userAgent, url: url2, hostname: hostname3, language, screenWidth, screenHeight, timestamp });
|
||||
console.error(`Client info stored for ${hostname3}: ${url2}`);
|
||||
}
|
||||
function handleGetClientInfo(ws, callerChannel, data) {
|
||||
const { id } = data;
|
||||
const clients = [];
|
||||
for (const [channelPath, channelClients] of Object.entries(channels)) {
|
||||
if (channelPath === MCP_PATH2 || channelPath === REGISTER_PATH) continue;
|
||||
for (const clientWs of channelClients) {
|
||||
const meta3 = clientMetadata.get(clientWs) || {};
|
||||
clients.push({
|
||||
channel: channelPath,
|
||||
userAgent: meta3.userAgent || "unknown",
|
||||
url: meta3.url || "unknown",
|
||||
hostname: meta3.hostname || "unknown",
|
||||
language: meta3.language || "unknown",
|
||||
screenWidth: meta3.screenWidth || 0,
|
||||
screenHeight: meta3.screenHeight || 0,
|
||||
connectedSince: meta3.timestamp || 0
|
||||
});
|
||||
}
|
||||
}
|
||||
const text = clients.length > 0 ? JSON.stringify(clients, null, 2) : "No hay navegadores conectados";
|
||||
ws.send(JSON.stringify({
|
||||
id,
|
||||
type: "toolResponse",
|
||||
result: { content: [{ type: "text", text }] }
|
||||
}));
|
||||
}
|
||||
function handleClearRegistry(ws, data) {
|
||||
const { id } = data;
|
||||
let toolCount = Object.keys(toolsRegistry).length;
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user