Skip to main content
Glama

Visum Thinker MCP Server

MIT License
claude-emulator.mjsβ€’8.41 kB
#!/usr/bin/env node // πŸ€– EMULATORE CLAUDE - Test MCP Visum Tools import { spawn } from 'child_process'; import readline from 'readline'; console.log('πŸ€– EMULATORE CLAUDE PER TEST MCP VISUM'); console.log('═'.repeat(50)); console.log('πŸ’¬ Scrivi i comandi come se fossi Claude'); console.log('πŸ”§ I tool Visum verranno testati direttamente via MCP'); console.log('❌ Premi CTRL+C per uscire'); console.log('═'.repeat(50)); class ClaudeEmulator { constructor() { this.mcpServer = null; this.requestId = 1; this.rl = readline.createInterface({ input: process.stdin, output: process.stdout, prompt: 'πŸ€– Claude> ' }); this.commands = new Map([ ['check-visum', { tool: 'check_visum', args: {} }], ['status-visum', { tool: 'get_visum_status', args: {} }], ['launch-visum', { tool: 'visum_launch', requiresArgs: true, argPrompt: 'Percorso progetto (.ver):' }], ['analyze-network', { tool: 'visum_network_analysis', requiresArgs: true, argPrompt: 'Tipo analisi (basic/detailed/topology/performance):' }], ['export-network', { tool: 'visum_export_network', requiresArgs: true, argPrompt: 'Elementi da esportare (nodes,links,zones):' }], ['connectivity-stats', { tool: 'visum_connectivity_stats', args: {} }], ['python-script', { tool: 'visum_python_analysis', requiresArgs: true, argPrompt: 'Script Python:' }], ['val-script', { tool: 'visum_val_script', requiresArgs: true, argPrompt: 'Script VAL:' }] ]); } async startMCPServer() { console.log('\nπŸš€ Avvio server MCP...'); this.mcpServer = spawn('node', ['build/index.js'], { stdio: ['pipe', 'pipe', 'pipe'], cwd: process.cwd() }); this.mcpServer.stderr.on('data', (data) => { const message = data.toString().trim(); if (message.includes('running')) { console.log('βœ…', message); this.initializeMCP(); } }); this.mcpServer.stdout.on('data', (data) => { const output = data.toString().trim(); if (output) { try { const response = JSON.parse(output); this.handleMCPResponse(response); } catch (e) { console.log('πŸ“¨ Raw output:', output); } } }); this.mcpServer.on('error', (error) => { console.error('❌ Errore server MCP:', error.message); }); } async initializeMCP() { console.log('πŸ”§ Inizializzazione MCP...'); const initRequest = { jsonrpc: "2.0", id: this.requestId++, method: "initialize", params: { protocolVersion: "2024-11-05", capabilities: {}, clientInfo: { name: "claude-emulator", version: "1.0.0" } } }; this.sendMCPRequest(initRequest); setTimeout(() => { console.log('\nβœ… Claude Emulator pronto!'); this.showHelp(); this.rl.prompt(); }, 1000); } sendMCPRequest(request) { if (this.mcpServer && this.mcpServer.stdin.writable) { this.mcpServer.stdin.write(JSON.stringify(request) + '\n'); } } handleMCPResponse(response) { console.log('\nπŸ“¨ RISPOSTA MCP:'); console.log('═'.repeat(20)); if (response.result && response.result.content) { // Risposta tool response.result.content.forEach(content => { if (content.type === 'text') { console.log(content.text); } }); } else if (response.result && response.result.tools) { // Lista tool console.log(`πŸ› οΈ ${response.result.tools.length} tool disponibili`); const visumTools = response.result.tools.filter(t => t.name.startsWith('visum_')); console.log(`πŸ”§ ${visumTools.length} tool Visum trovati`); } else if (response.error) { // Errore console.log('❌ ERRORE:', response.error.message); if (response.error.data) { console.log('πŸ“‹ Dettagli:', response.error.data); } } else { // Altra risposta console.log('πŸ“‹ Risposta:', JSON.stringify(response, null, 2)); } console.log('═'.repeat(20)); this.rl.prompt(); } showHelp() { console.log('\nπŸ“‹ COMANDI DISPONIBILI:'); console.log('═'.repeat(25)); console.log('πŸ”§ check-visum - Verifica installazione Visum'); console.log('πŸ“Š status-visum - Status connessione Visum'); console.log('πŸš€ launch-visum - Lancia Visum con progetto'); console.log('πŸ“ˆ analyze-network - Analisi rete dettagliata'); console.log('πŸ“€ export-network - Export elementi rete'); console.log('πŸ“Š connectivity-stats - Statistiche connettivitΓ '); console.log('🐍 python-script - Esegui script Python'); console.log('πŸ“œ val-script - Esegui script VAL'); console.log('❓ help - Mostra questo aiuto'); console.log('πŸšͺ exit - Esci dall\'emulatore'); } async handleCommand(input) { const command = input.trim().toLowerCase(); if (command === 'help' || command === '?') { this.showHelp(); return; } if (command === 'exit' || command === 'quit') { console.log('πŸ‘‹ Chiusura emulatore Claude...'); if (this.mcpServer) { this.mcpServer.kill(); } process.exit(0); } if (this.commands.has(command)) { const cmd = this.commands.get(command); await this.executeToolCommand(cmd, command); } else { console.log(`❌ Comando non riconosciuto: ${command}`); console.log('πŸ’‘ Usa "help" per vedere i comandi disponibili'); } } async executeToolCommand(cmd, commandName) { console.log(`\nπŸ”§ Esecuzione: ${cmd.tool}`); let args = cmd.args || {}; // Se servono argomenti, chiedili if (cmd.requiresArgs) { args = await this.getCommandArgs(cmd, commandName); } const toolRequest = { jsonrpc: "2.0", id: this.requestId++, method: "tools/call", params: { name: cmd.tool, arguments: args } }; console.log('πŸ“€ Invio richiesta MCP...'); this.sendMCPRequest(toolRequest); } async getCommandArgs(cmd, commandName) { return new Promise((resolve) => { if (commandName === 'launch-visum') { this.rl.question('πŸ“ Percorso progetto Visum (.ver): ', (projectPath) => { resolve({ projectPath: projectPath.trim(), visible: true }); }); } else if (commandName === 'analyze-network') { this.rl.question('πŸ“Š Tipo analisi (basic/detailed/topology/performance): ', (analysisType) => { resolve({ analysisType: analysisType.trim() || 'detailed', exportPath: 'C:\\temp\\mcp_analysis' }); }); } else if (commandName === 'export-network') { this.rl.question('πŸ“€ Elementi (nodes,links,zones): ', (elements) => { const elementList = elements.trim().split(',').map(e => e.trim()).filter(e => e); resolve({ elements: elementList.length > 0 ? elementList : ['nodes', 'links'], outputDir: 'C:\\temp\\mcp_export', method: 'python' }); }); } else if (commandName === 'python-script') { console.log('🐍 Scrivi script Python (termina con una riga vuota):'); let script = ''; const collectScript = () => { this.rl.question('>>> ', (line) => { if (line.trim() === '') { resolve({ script }); } else { script += line + '\\n'; collectScript(); } }); }; collectScript(); } else if (commandName === 'val-script') { this.rl.question('πŸ“œ Script VAL: ', (script) => { resolve({ script: script.trim() }); }); } else { resolve({}); } }); } start() { this.startMCPServer(); this.rl.on('line', (input) => { this.handleCommand(input); }); this.rl.on('close', () => { console.log('\\nπŸ‘‹ Arrivederci!'); if (this.mcpServer) { this.mcpServer.kill(); } process.exit(0); }); } } // Avvia emulatore console.log('🎯 Avvio Claude Emulator per test Visum...'); const emulator = new ClaudeEmulator(); emulator.start();

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