Skip to main content
Glama
gcorroto

SVN MCP Server

by gcorroto

svn_diagnose

Diagnose and resolve specific Subversion (SVN) command issues to maintain repository integrity and workflow efficiency.

Instructions

Diagnosticar problemas específicos con comandos SVN

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • index.ts:68-112 (handler)
    MCP server.tool registration and inline handler for 'svn_diagnose'. Calls SvnService.diagnoseCommands(), formats results with status icons, error lists, and hardcoded suggestions, returns markdown text content.
    server.tool(
      "svn_diagnose",
      "Diagnosticar problemas específicos con comandos SVN",
      {},
      async () => {
        try {
          const result = await getSvnService().diagnoseCommands();
          const data = result.data!;
          
          const statusLocalIcon = data.statusLocal ? '✅' : '❌';
          const statusRemoteIcon = data.statusRemote ? '✅' : '❌';
          const logIcon = data.logBasic ? '✅' : '❌';
          
          let diagnosticText = `🔍 **Diagnóstico de Comandos SVN**\n\n` +
            `**Directorio de Trabajo:** ${data.workingCopyPath}\n\n` +
            `${statusLocalIcon} **Status Local:** ${data.statusLocal ? 'Funciona' : 'Falló'}\n` +
            `${statusRemoteIcon} **Status Remoto:** ${data.statusRemote ? 'Funciona' : 'Falló'}\n` +
            `${logIcon} **Log Básico:** ${data.logBasic ? 'Funciona' : 'Falló'}\n`;
          
          if (data.errors.length > 0) {
            diagnosticText += `\n**Errores Detectados:**\n`;
            data.errors.forEach((error, index) => {
              diagnosticText += `${index + 1}. ${error}\n`;
            });
          }
          
          // Añadir sugerencias basadas en los errores
          if (!data.statusRemote || !data.logBasic) {
            diagnosticText += `\n**Posibles Soluciones:**\n`;
            diagnosticText += `• Verificar conexión a internet\n`;
            diagnosticText += `• Verificar credenciales de SVN\n`;
            diagnosticText += `• Ejecutar 'svn cleanup' si hay problemas de lock\n`;
            diagnosticText += `• Verificar que el working copy esté actualizado\n`;
          }
    
          return {
            content: [{ type: "text", text: diagnosticText }],
          };
        } catch (error: any) {
          return {
            content: [{ type: "text", text: `❌ **Error en diagnóstico:** ${error.message}` }],
          };
        }
      }
    );
  • Core logic of svn_diagnose: SvnService.diagnoseCommands() method tests 'svn status', 'svn status --show-updates', and 'svn log --limit 1'. Uses categorizeError helper to classify failures (e.g., no SVN, network, auth) and collects errors/suggestions.
    async diagnoseCommands(): Promise<SvnResponse<{
      statusLocal: boolean;
      statusRemote: boolean;
      logBasic: boolean;
      workingCopyPath: string;
      errors: string[];
      suggestions: string[];
    }>> {
      const results = {
        statusLocal: false,
        statusRemote: false,
        logBasic: false,
        workingCopyPath: this.config.workingDirectory!,
        errors: [] as string[],
        suggestions: [] as string[]
      };
    
      try {
        // Probar svn status local
        try {
          await executeSvnCommand(this.config, ['status']);
          results.statusLocal = true;
        } catch (error: any) {
          const errorMsg = this.categorizeError(error, 'status local');
          results.errors.push(errorMsg.message);
          if (errorMsg.suggestion) {
            results.suggestions.push(errorMsg.suggestion);
          }
        }
    
        // Probar svn status con --show-updates
        try {
          await executeSvnCommand(this.config, ['status', '--show-updates']);
          results.statusRemote = true;
        } catch (error: any) {
          const errorMsg = this.categorizeError(error, 'status remoto');
          results.errors.push(errorMsg.message);
          if (errorMsg.suggestion) {
            results.suggestions.push(errorMsg.suggestion);
          }
        }
    
        // Probar svn log básico
        try {
          await executeSvnCommand(this.config, ['log', '--limit', '1']);
          results.logBasic = true;
        } catch (error: any) {
          const errorMsg = this.categorizeError(error, 'log básico');
          results.errors.push(errorMsg.message);
          if (errorMsg.suggestion) {
            results.suggestions.push(errorMsg.suggestion);
          }
        }
    
        // Agregar sugerencias generales basadas en los resultados
        if (!results.statusRemote && !results.logBasic && results.statusLocal) {
          results.suggestions.push('Los comandos remotos fallan pero el local funciona. Revisa la conectividad de red y credenciales SVN.');
        }
    
        return {
          success: true,
          data: results,
          command: 'diagnostic',
          workingDirectory: this.config.workingDirectory!
        };
    
      } catch (error: any) {
        results.errors.push(`Error general: ${error.message}`);
        return {
          success: false,
          data: results,
          error: error.message,
          command: 'diagnostic',
          workingDirectory: this.config.workingDirectory!
        };
      }
    }
  • Private helper categorizeError used by diagnoseCommands to classify SVN errors (installation, network, auth like E215004/E170001, locks, etc.) and provide specific suggestions.
    private categorizeError(error: any, commandType: string): { message: string; suggestion?: string } {
      const baseMessage = `${commandType} falló`;
      
      // SVN no encontrado en el sistema
      if ((error.message.includes('spawn') && error.message.includes('ENOENT')) ||
          error.code === 127) {
        return {
          message: `${baseMessage}: SVN no está instalado o no se encuentra en el PATH`,
          suggestion: 'Instala SVN (subversion) o verifica que esté en el PATH del sistema'
        };
      }
      
      // Errores de conectividad
      if (error.message.includes('E175002') || 
          error.message.includes('Unable to connect') ||
          error.message.includes('Connection refused') ||
          error.message.includes('Network is unreachable')) {
        return {
          message: `${baseMessage}: Sin conectividad al servidor SVN`,
          suggestion: 'Verifica tu conexión a internet y que el servidor SVN esté accesible'
        };
      }
      
      // Errores de autenticación - demasiados intentos
      if (error.message.includes('E215004') || 
          error.message.includes('No more credentials') ||
          error.message.includes('we tried too many times')) {
        return {
          message: `${baseMessage}: Demasiados intentos de autenticación fallidos`,
          suggestion: 'Las credenciales pueden estar incorrectas o cachadas. Limpia el cache de credenciales SVN y verifica SVN_USERNAME y SVN_PASSWORD'
        };
      }
      
      // Errores de autenticación generales
      if (error.message.includes('E170001') || 
          error.message.includes('Authentication failed') ||
          error.message.includes('authorization failed')) {
        return {
          message: `${baseMessage}: Error de autenticación`,
          suggestion: 'Verifica tus credenciales SVN (SVN_USERNAME y SVN_PASSWORD)'
        };
      }
      
      // Working copy no válido
      if (error.message.includes('E155007') || 
          error.message.includes('not a working copy')) {
        return {
          message: `${baseMessage}: No es un working copy válido`,
          suggestion: 'Asegúrate de estar en un directorio con checkout de SVN o ejecuta svn checkout primero'
        };
      }
      
      // Working copy bloqueado
      if (error.message.includes('E155036') || 
          error.message.includes('working copy locked')) {
        return {
          message: `${baseMessage}: Working copy bloqueado`,
          suggestion: 'Ejecuta "svn cleanup" para desbloquear el working copy'
        };
      }
      
      // Error genérico con código 1 (frecuente en comandos remotos)
      if (error.code === 1) {
        return {
          message: `${baseMessage}: Comando falló con código 1 (posible problema de red/autenticación)`,
          suggestion: 'Revisa conectividad de red, credenciales SVN, y que el repositorio sea accesible'
        };
      }
      
      // Error genérico
      return {
        message: `${baseMessage}: ${error.message}`,
        suggestion: undefined
      };
    }
  • index.ts:69-72 (registration)
    Tool registration call: server.tool('svn_diagnose', description, empty schema).
    "svn_diagnose",
    "Diagnosticar problemas específicos con comandos SVN",
    {},
    async () => {

Latest Blog Posts

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/gcorroto/mcp-svn'

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