Skip to main content
Glama

Visum Thinker MCP Server

MIT License
test-campoleone-singleton.mjsโ€ข8.43 kB
#!/usr/bin/env node import { spawn } from 'child_process'; console.log('๐Ÿš„ === TEST VISUM CAMPOLEONE SINGLETON ===\n'); const CAMPOLEONE_PROJECT = "H:\\go\\italferr2025\\Campoleone\\100625_Versione_base_v0.3_sub_ok_priv.ver"; let serverProcess; let responseBuffer = ''; let currentStep = 0; const testSequence = [ { name: 'initialize', description: 'Inizializzazione protocollo MCP', payload: { jsonrpc: "2.0", id: 1, method: "initialize", params: { protocolVersion: "2024-11-05", capabilities: {}, clientInfo: { name: "campoleone-test", version: "1.0.0" } } } }, { name: 'visum_launch_project', description: 'Caricamento progetto Campoleone', payload: { jsonrpc: "2.0", id: 2, method: "tools/call", params: { name: "visum_launch_project", arguments: { projectPath: CAMPOLEONE_PROJECT } } } }, { name: 'visum_network_stats', description: 'Prime statistiche rete (dovrebbe essere veloce)', payload: { jsonrpc: "2.0", id: 3, method: "tools/call", params: { name: "visum_network_stats", arguments: {} } } }, { name: 'visum_health_check', description: 'Controllo salute istanza (dovrebbe essere sana)', payload: { jsonrpc: "2.0", id: 4, method: "tools/call", params: { name: "visum_health_check", arguments: {} } } }, { name: 'visum_network_analysis', description: 'Analisi completa rete (usando istanza singleton)', payload: { jsonrpc: "2.0", id: 5, method: "tools/call", params: { name: "visum_network_analysis", arguments: { includeGeometry: true, sampleSize: 10 } } } }, { name: 'visum_network_stats_again', description: 'Statistiche rete ripetute (dovrebbe essere ultra-veloce)', payload: { jsonrpc: "2.0", id: 6, method: "tools/call", params: { name: "visum_network_stats", arguments: {} } } } ]; function startServer() { console.log('๐Ÿ”ง Avvio server MCP...\n'); serverProcess = spawn('node', ['build/index.js'], { stdio: ['pipe', 'pipe', 'pipe'] }); serverProcess.stdout.on('data', handleResponse); serverProcess.stderr.on('data', (data) => { const logMessage = data.toString(); console.log('๐Ÿ“ข Server:', logMessage.trim()); // Quando il server รจ pronto, inizia i test if (logMessage.includes('๐Ÿš€') && currentStep === 0) { setTimeout(() => executeNextStep(), 1000); } }); serverProcess.on('exit', (code) => { console.log('\n๐Ÿ”š Server terminato con codice:', code); }); } function handleResponse(data) { responseBuffer += data.toString(); // Cerca risposte JSON complete const lines = responseBuffer.split('\n'); for (let i = 0; i < lines.length - 1; i++) { const line = lines[i].trim(); if (line) { try { const response = JSON.parse(line); if (response.jsonrpc && response.id) { processResponse(response); responseBuffer = lines.slice(i + 1).join('\n'); break; } } catch (e) { // Non รจ JSON valido, continua } } } } function processResponse(response) { const step = testSequence[currentStep]; const stepNumber = currentStep + 1; console.log(`\nโœ… STEP ${stepNumber}: ${step.description} - COMPLETATO`); if (response.result) { // Estrai informazioni rilevanti dalla risposta if (step.name === 'initialize') { console.log(` ๐Ÿ”— Protocollo: ${response.result.protocolVersion}`); console.log(` ๐Ÿท๏ธ Server: ${response.result.serverInfo.name} v${response.result.serverInfo.version}`); } else if (step.name === 'visum_launch_project') { if (response.result.content && response.result.content[0]) { const text = response.result.content[0].text; if (text.includes('โœ…')) { console.log(' ๐Ÿš„ Progetto Campoleone caricato con SUCCESSO!'); // Estrai statistiche dal testo se disponibili const nodesMatch = text.match(/Nodi:\s*([0-9,]+)/); const linksMatch = text.match(/Link:\s*([0-9,]+)/); if (nodesMatch && linksMatch) { console.log(` ๐Ÿ“Š Rete: ${nodesMatch[1]} nodi, ${linksMatch[1]} link`); } } else { console.log(' โŒ Errore caricamento progetto:', text.slice(0, 100)); } } } else if (step.name.includes('visum_network_stats')) { if (response.result.content && response.result.content[0]) { const text = response.result.content[0].text; const timeMatch = text.match(/Tempo Esecuzione:\s*([0-9.]+)ms/); if (timeMatch) { const time = parseFloat(timeMatch[1]); console.log(` โšก Tempo esecuzione: ${time}ms ${time < 100 ? '(ULTRA-VELOCE!)' : time < 1000 ? '(veloce)' : '(normale)'}`); } // Estrai statistiche rete const nodesMatch = text.match(/Nodi:\s*([0-9,]+)/); const linksMatch = text.match(/Link:\s*([0-9,]+)/); if (nodesMatch && linksMatch) { console.log(` ๐Ÿ“Š Rete attiva: ${nodesMatch[1]} nodi, ${linksMatch[1]} link`); } } } else if (step.name === 'visum_health_check') { if (response.result.content && response.result.content[0]) { const text = response.result.content[0].text; if (text.includes('โœ…')) { console.log(' ๐Ÿ’š Istanza VisumPy SANA e operativa'); const perfMatch = text.match(/Performance:\s*(\w+)/); if (perfMatch) { console.log(` ๐Ÿš€ Performance: ${perfMatch[1]}`); } } else { console.log(' โš ๏ธ Istanza ha problemi:', text.slice(0, 50)); } } } else if (step.name === 'visum_network_analysis') { if (response.result.content && response.result.content[0]) { const text = response.result.content[0].text; if (text.includes('โœ…')) { console.log(' ๐Ÿ” Analisi rete completa COMPLETATA'); // Estrai tempo analisi e tool const analysisTimeMatch = text.match(/Tempo Analisi:\s*([0-9.]+)s/); const toolTimeMatch = text.match(/Tempo Esecuzione Tool:\s*([0-9.]+)ms/); if (analysisTimeMatch) console.log(` โฑ๏ธ Tempo analisi interna: ${analysisTimeMatch[1]}s`); if (toolTimeMatch) console.log(` โšก Tempo tool MCP: ${toolTimeMatch[1]}ms`); } } } } else if (response.error) { console.log(` โŒ ERRORE: ${response.error.message || response.error}`); } // Passa al prossimo step currentStep++; if (currentStep < testSequence.length) { const nextStep = testSequence[currentStep]; let delay = 1000; // Default 1 secondo // Tempi di attesa diversi per operazioni lunghe if (step.name === 'visum_launch_project') { delay = 5000; // 5 secondi dopo il caricamento del progetto console.log(' โณ Attendendo stabilizzazione istanza VisumPy...'); } else if (step.name === 'visum_network_analysis') { delay = 2000; // 2 secondi dopo analisi completa } setTimeout(() => executeNextStep(), delay); } else { console.log('\n๐ŸŽ‰ === TUTTI I TEST COMPLETATI ==='); console.log('โœ… Progetto Campoleone caricato e mantenuto in memoria'); console.log('โœ… Istanza VisumPy singleton operativa'); console.log('โœ… Performance ottimizzate per chiamate successive'); console.log('\n๐Ÿ’ก L\'istanza resta attiva per successive interrogazioni!'); console.log('๐Ÿ“ Usa Ctrl+C per terminare il server quando hai finito.\n'); // Lascia il server attivo invece di chiuderlo console.log('๐Ÿ”„ Server ancora attivo. Puoi fare altre interrogazioni...'); } } function executeNextStep() { const step = testSequence[currentStep]; const stepNumber = currentStep + 1; console.log(`\n๐Ÿ“จ STEP ${stepNumber}: ${step.description}`); if (step.name === 'visum_launch_project') { console.log('โณ ATTENZIONE: Questo step puรฒ richiedere 60-90 secondi per il primo caricamento...'); } serverProcess.stdin.write(JSON.stringify(step.payload) + '\n'); } // Gestione interruzione da parte dell'utente process.on('SIGINT', () => { console.log('\n\n๐Ÿ›‘ Interruzione richiesta dall\'utente'); if (serverProcess) { console.log('๐Ÿ”š Terminando il server...'); serverProcess.kill(); } process.exit(0); }); // Avvia il test startServer();

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