Skip to main content
Glama

Visum Thinker MCP Server

MIT License
simulate-claude.mjs5.54 kB
// Simulazione di Claude che interroga l'MCP per lanciare Visum import { spawn } from 'child_process'; console.log("🤖 SIMULAZIONE CLAUDE - Interrogazione MCP Server\n"); class ClaudeSimulator { constructor() { this.requestId = 1; } async sendMCPRequest(method, params = {}) { return new Promise((resolve) => { const child = spawn('node', ['enhanced-visum-mcp.mjs'], { stdio: ['pipe', 'pipe', 'pipe'], cwd: process.cwd() }); let output = ''; let stderr = ''; child.stdout.on('data', (data) => { output += data.toString(); }); child.stderr.on('data', (data) => { stderr += data.toString(); }); child.on('close', () => { try { const lines = output.trim().split('\n'); const jsonLine = lines.find(line => line.startsWith('{')); if (jsonLine) { const response = JSON.parse(jsonLine); resolve({ success: true, response, stderr, fullOutput: output }); } else { resolve({ success: false, error: 'No JSON response found', output, stderr }); } } catch (error) { resolve({ success: false, error: error.message, output, stderr }); } }); const request = { jsonrpc: "2.0", id: this.requestId++, method: method, params: params }; console.log(`📤 Claude invia: ${method}`); child.stdin.write(JSON.stringify(request) + '\n'); child.stdin.end(); setTimeout(() => { child.kill(); resolve({ success: false, error: 'Timeout after 15 seconds' }); }, 15000); }); } // Simula Claude che chiede di lanciare Visum async simulateVisumLaunch() { console.log("🎭 Claude: 'Puoi avviare Visum per me?'\n"); // Prima verifica se Visum è già attivo console.log("👤 Claude: Prima controllo se Visum è già attivo..."); const checkResult = await this.sendMCPRequest("tools/call", { name: "check_visum", arguments: {} }); if (checkResult.success) { const content = checkResult.response.result?.content?.[0]?.text; console.log("📥 MCP risponde:"); if (content?.includes("✅")) { console.log("✅ Visum è già disponibile!"); return await this.testNetworkAnalysis(); } else { console.log("❌ Visum non è disponibile"); console.log("\n👤 Claude: Ora provo a inizializzare Visum..."); return await this.initializeVisum(); } } else { console.log("❌ Errore nella verifica:", checkResult.error); return false; } } async initializeVisum() { const initResult = await this.sendMCPRequest("tools/call", { name: "initialize_visum", arguments: {} }); if (initResult.success) { const content = initResult.response.result?.content?.[0]?.text; console.log("📥 MCP risponde:"); if (content?.includes("✅")) { console.log("✅ Visum inizializzato con successo!"); return await this.testNetworkAnalysis(); } else { console.log("❌ Inizializzazione fallita"); console.log("Contenuto risposta:", content?.substring(0, 200) + "..."); return false; } } else { console.log("❌ Errore nell'inizializzazione:", initResult.error); return false; } } async testNetworkAnalysis() { console.log("\n👤 Claude: Ora analizzo la rete di trasporto..."); const analysisResult = await this.sendMCPRequest("tools/call", { name: "analyze_network", arguments: {} }); if (analysisResult.success) { const content = analysisResult.response.result?.content?.[0]?.text; console.log("📥 MCP risponde:"); if (content?.includes("✅")) { console.log("✅ Analisi della rete completata!"); // Estrai i risultati const nodesMatch = content.match(/Nodes:\*\* (\w+)/); const linksMatch = content.match(/Links:\*\* (\w+)/); const zonesMatch = content.match(/Zones:\*\* (\w+)/); if (nodesMatch && linksMatch && zonesMatch) { console.log(`📊 Risultati: ${nodesMatch[1]} nodi, ${linksMatch[1]} link, ${zonesMatch[1]} zone`); } return true; } else { console.log("❌ Analisi fallita"); console.log("Errore:", content?.substring(0, 200) + "..."); return false; } } else { console.log("❌ Errore nell'analisi:", analysisResult.error); return false; } } async runFullSimulation() { console.log("🚀 AVVIO SIMULAZIONE COMPLETA\n"); // Simula la sequenza tipica di Claude const success = await this.simulateVisumLaunch(); console.log("\n📊 RISULTATO SIMULAZIONE:"); if (success) { console.log("🎉 ✅ Simulazione completata con successo!"); console.log(" Claude è riuscito a:"); console.log(" - Verificare Visum"); console.log(" - Inizializzare la connessione"); console.log(" - Analizzare la rete di trasporto"); } else { console.log("❌ Simulazione fallita"); console.log(" Problemi rilevati nell'interazione MCP"); } return success; } } // Esegui la simulazione const claude = new ClaudeSimulator(); claude.runFullSimulation().then((success) => { console.log(`\n🏁 Simulazione terminata: ${success ? 'SUCCESSO' : 'FALLIMENTO'}`); }).catch(console.error);

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/multiluca2020/visum-thinker-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server