Skip to main content
Glama
gcorroto

SVN MCP Server

by gcorroto

svn_info

Retrieve detailed information about SVN working copies or specific files to manage repository data and track version control status.

Instructions

Obtener información detallada del working copy o archivo específico

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoRuta específica a consultar (opcional)

Implementation Reference

  • Core handler method in SvnService that executes the 'svn info' command on the specified path or working directory, parses the output, and returns structured SvnInfo data.
    async getInfo(path?: string): Promise<SvnResponse<SvnInfo>> {
      try {
        const args = ['info'];
        if (path) {
          // Check if it's a URL or a local path
          if (validateSvnUrl(path)) {
            // It's a URL, add it directly without normalization
            args.push(path);
          } else if (validatePath(path)) {
            // It's a local path, normalize it
            args.push(normalizePath(path));
          } else {
            throw new SvnError(`Invalid path or URL: ${path}`);
          }
        }
    
        const response = await executeSvnCommand(this.config, args);
        const info = parseInfoOutput(cleanOutput(response.data as string));
    
        return {
          success: true,
          data: info,
          command: response.command,
          workingDirectory: response.workingDirectory,
          executionTime: response.executionTime
        };
    
      } catch (error: any) {
        this.handleSvnError(error, 'get SVN info');
      }
    }
  • index.ts:115-149 (registration)
    MCP server registration of the 'svn_info' tool, including input schema and wrapper handler that calls SvnService.getInfo and formats markdown response.
    server.tool(
      "svn_info",
      "Obtener información detallada del working copy o archivo específico",
      {
        path: z.string().optional().describe("Ruta específica a consultar (opcional)")
      },
      async (args) => {
        try {
          const result = await getSvnService().getInfo(args.path);
          const info = result.data!;
          
          const infoText = `📋 **Información SVN**\n\n` +
            `**Ruta:** ${info.path}\n` +
            `**URL:** ${info.url}\n` +
            `**URL Relativa:** ${info.relativeUrl}\n` +
            `**Raíz del Repositorio:** ${info.repositoryRoot}\n` +
            `**UUID:** ${info.repositoryUuid}\n` +
            `**Revisión:** ${info.revision}\n` +
            `**Tipo de Nodo:** ${info.nodeKind}\n` +
            `**Último Autor:** ${info.lastChangedAuthor}\n` +
            `**Última Revisión:** ${info.lastChangedRev}\n` +
            `**Última Fecha:** ${info.lastChangedDate}\n` +
            `**Raíz Working Copy:** ${info.workingCopyRootPath}\n` +
            `**Tiempo de Ejecución:** ${formatDuration(result.executionTime || 0)}`;
    
          return {
            content: [{ type: "text", text: infoText }],
          };
        } catch (error: any) {
          return {
            content: [{ type: "text", text: `❌ **Error:** ${error.message}` }],
          };
        }
      }
    );
  • Input schema for the 'svn_info' tool using Zod: optional path parameter.
    {
      path: z.string().optional().describe("Ruta específica a consultar (opcional)")
    },
  • TypeScript interface defining the structure of SVN info output data.
    export interface SvnInfo {
      path: string;
      workingCopyRootPath: string;
      url: string;
      relativeUrl: string;
      repositoryRoot: string;
      repositoryUuid: string;
      revision: number;
      nodeKind: 'file' | 'directory';
      schedule: string;
      lastChangedAuthor: string;
      lastChangedRev: number;
      lastChangedDate: string;
      textLastUpdated?: string;
      checksum?: string;
    }
  • Helper function that parses the raw output from 'svn info' command into structured SvnInfo object.
    export function parseInfoOutput(output: string): SvnInfo {
      const lines = output.split('\n');
      const info: Partial<SvnInfo> = {};
      
      for (const line of lines) {
        const [key, ...valueParts] = line.split(': ');
        const value = valueParts.join(': ').trim();
        
        switch (key.trim()) {
          case 'Path':
            info.path = value;
            break;
          case 'Working Copy Root Path':
            info.workingCopyRootPath = value;
            break;
          case 'URL':
            info.url = value;
            break;
          case 'Relative URL':
            info.relativeUrl = value;
            break;
          case 'Repository Root':
            info.repositoryRoot = value;
            break;
          case 'Repository UUID':
            info.repositoryUuid = value;
            break;
          case 'Revision':
            info.revision = parseInt(value, 10);
            break;
          case 'Node Kind':
            info.nodeKind = value as 'file' | 'directory';
            break;
          case 'Schedule':
            info.schedule = value;
            break;
          case 'Last Changed Author':
            info.lastChangedAuthor = value;
            break;
          case 'Last Changed Rev':
            info.lastChangedRev = parseInt(value, 10);
            break;
          case 'Last Changed Date':
            info.lastChangedDate = value;
            break;
          case 'Text Last Updated':
            info.textLastUpdated = value;
            break;
          case 'Checksum':
            info.checksum = value;
            break;
        }
      }
      
      return info as SvnInfo;
    }

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