SVN MCP Server
Un servidor MCP para integrarse y gestionar repositorios Subversion (SVN), permitiendo que agentes de IA realicen tareas de control de versiones.
Documentación
SVN MCP Server
Un servidor MCP (Model Context Protocol) completo para la integración con Subversion (SVN), diseñado para permitir que los agentes de IA gestionen repositorios SVN de manera eficiente.
🎯 Características
- ✅ Operaciones básicas del repositorio: info, status, log, diff, checkout, update
- ✅ Gestión de archivos: add, commit, delete, revert
- ✅ Herramientas de mantenimiento: cleanup
- 🔄 Gestión de ramas: (En desarrollo)
- 🔄 Operaciones avanzadas: merge, switch, properties (En desarrollo)
- 🔄 Herramientas de análisis: blame, detección de conflictos (En desarrollo)
- 🔄 Operaciones por lotes: (En desarrollo)
📋 Requisitos
- Node.js >= 18.0.0
- Subversion (SVN) instalado y disponible en el PATH
- TypeScript (para desarrollo)
🔍 Detección de la instalación de SVN
Comprueba si SVN está instalado
# Basic command to check SVN
svn --version
# Check the full path of the executable
where svn # Windows
which svn # Linux/Mac
# Check the full SVN client
svn --version --verbose
Salida esperada si SVN está correctamente instalado:
svn, version 1.14.x (r1876290)
compiled Apr 13 2023, 17:22:07 on x86_64-pc-mingw32
Copyright (C) 2023 The Apache Software Foundation.
This software consists of contributions made by many people;
see the NOTICE file for more information.
Subversion is open source software, see http://subversion.apache.org/
❌ Errores comunes si SVN NO está instalado:
# Windows
'svn' is not recognized as an internal or external command
# Linux/Mac
svn: command not found
bash: svn: command not found
🛠️ Diagnósticos avanzados
# Check the system PATH
echo $PATH # Linux/Mac
echo %PATH% # Windows CMD
$env:PATH # Windows PowerShell
# Search for SVN executables on the system
find / -name "svn" 2>/dev/null # Linux
Get-ChildItem -Path C:\ -Name "svn.exe" -Recurse -ErrorAction SilentlyContinue # Windows PowerShell
# Check the specific client version
svn --version | head -1 # Get just the first line with the version
💾 Instalación de SVN en Windows
Opción 1: Gestores de paquetes
# Using Chocolatey (Recommended)
choco install subversion
# Using winget
winget install CollabNet.Subversion
# Using Scoop
scoop install subversion
Opción 2: Instaladores oficiales
-
TortoiseSVN (incluye el cliente de línea de comandos):
https://tortoisesvn.net/downloads.html ✅ Includes GUI and CLI clients ✅ Windows Explorer integration -
SlikSVN (solo línea de comandos):
https://sliksvn.com/download/ ✅ Lightweight (CLI only) ✅ Ideal for automation -
CollabNet Subversion:
https://www.collab.net/downloads/subversion ✅ Enterprise version ✅ Commercial support available
Opción 3: Visual Studio o Git para Windows
# If you have Git for Windows installed, it can include SVN
git svn --version
# Visual Studio can also include SVN
# Go to: Visual Studio Installer > Modify > Individual Components > Subversion
🐧 Instalación de SVN en Linux
# Ubuntu/Debian
sudo apt-get update
sudo apt-get install subversion
# CentOS/RHEL/Fedora
sudo yum install subversion # CentOS 7
sudo dnf install subversion # CentOS 8/Fedora
# Arch Linux
sudo pacman -S subversion
# Alpine Linux
sudo apk add subversion
🍎 Instalación de SVN en macOS
# Homebrew (Recommended)
brew install subversion
# MacPorts
sudo port install subversion
# From Xcode Command Line Tools (may already be included)
xcode-select --install
🔧 Configuración de SVN después de la instalación
Comprueba la configuración global
# Show current configuration
svn config --list
# Configure the global user
svn config --global auth:username your_username
# Configure the default editor
svn config --global editor "code --wait" # VS Code
svn config --global editor "notepad" # Windows Notepad
svn config --global editor "nano" # Linux/Mac nano
Comprueba el acceso al repositorio
# Test connection to a repository (without checking out)
svn list https://svn.example.com/repo/trunk
# Test with specific credentials
svn list https://svn.example.com/repo/trunk --username user --password password
🚀 Instalación
Desde NPM
npm install -g @grec0/mcp-svn
Desarrollo local
git clone https://github.com/gcorroto/mcp-svn.git
cd mcp-svn
npm install
npm run build
⚙️ Configuración
Variables de entorno
| Variable | Descripción | Valor por defecto |
|---|---|---|
SVN_PATH | Ruta al ejecutable de SVN | svn |
SVN_WORKING_DIRECTORY | Directorio local de la copia de trabajo | process.cwd() |
SVN_URL (alias: SVN_REPOSITORY_URL) | URL del repositorio. Habilita flujos de trabajo solo con URL y resolución de destino /trunk/... | - |
SVN_USERNAME | Usuario de autenticación | - |
SVN_PASSWORD | Contraseña de autenticación | - |
SVN_TIMEOUT | Tiempo de espera en milisegundos | 30000 |
SVN_WORKING_DIRECTORY y SVN_URL son independientes: configura uno o ambos. Con ambos configurados, las operaciones locales (svn_status, svn_commit, ...) se ejecutan en la copia de trabajo, y las herramientas compatibles con URL (svn_cat, svn_list, svn_info, svn_log, svn_diff) se pueden invocar con:
- una URL completa (
https://svn.example.com/repo/trunk/file.sql) - una ruta relativa al repositorio que comience con
/(/trunk/file.sql) — combinada conSVN_URL - una ruta local — resuelta contra la copia de trabajo
Ejemplo de configuración de MCP
{
"mcpServers": {
"svn": {
"command": "npx",
"args": ["@grec0/mcp-svn"],
"env": {
"SVN_PATH": "svn",
"SVN_WORKING_DIRECTORY": "C:/path/to/working/copy",
"SVN_URL": "https://svn.example.com/repo",
"SVN_USERNAME": "your_username",
"SVN_PASSWORD": "your_password"
}
}
}
}
🛠️ Herramientas disponibles
Operaciones básicas
svn_health_check
Comprueba el estado de salud del sistema SVN y de la copia de trabajo.
svn_health_check()
svn_info
Obtiene información detallada sobre la copia de trabajo o un archivo específico.
svn_info(path?: string)
svn_status
Muestra el estado de los archivos en la copia de trabajo.
svn_status(path?: string, showAll?: boolean)
svn_log
Muestra el historial de confirmaciones del repositorio.
svn_log(path?: string, limit?: number, revision?: string)
svn_diff
Muestra las diferencias entre revisiones de archivos.
svn_diff(path?: string, oldRevision?: string, newRevision?: string)
Operaciones de repositorio
svn_checkout
Descarga (checkout) un repositorio SVN.
svn_checkout(
url: string,
path?: string,
revision?: number | "HEAD",
depth?: "empty" | "files" | "immediates" | "infinity",
force?: boolean,
ignoreExternals?: boolean
)
svn_update
Actualiza la copia de trabajo desde el repositorio.
svn_update(
path?: string,
revision?: number | "HEAD" | "BASE" | "COMMITTED" | "PREV",
force?: boolean,
ignoreExternals?: boolean,
acceptConflicts?: "postpone" | "base" | "mine-conflict" | "theirs-conflict" | "mine-full" | "theirs-full"
)
Gestión de archivos
svn_add
Añade archivos al control de versiones.
svn_add(
paths: string | string[],
force?: boolean,
noIgnore?: boolean,
parents?: boolean,
autoProps?: boolean,
noAutoProps?: boolean
)
svn_commit
Confirma los cambios en el repositorio.
svn_commit(
message: string,
paths?: string[],
file?: string,
force?: boolean,
keepLocks?: boolean,
noUnlock?: boolean
)
svn_delete
Elimina archivos del control de versiones.
svn_delete(
paths: string | string[],
message?: string,
force?: boolean,
keepLocal?: boolean
)
svn_revert
Revierte los cambios locales en los archivos.
svn_revert(paths: string | string[])
Herramientas de mantenimiento
svn_cleanup
Limpia la copia de trabajo de operaciones interrumpidas.
svn_cleanup(path?: string)
📖 Ejemplos de uso
Comprobar el estado del sistema
// Check that SVN is available and the working copy is valid
const healthCheck = await svn_health_check();
Obtener información del repositorio
// General working copy information
const info = await svn_info();
// Information about a specific file
const fileInfo = await svn_info("src/main.js");
Mostrar el estado de los archivos
// Status of all files
const status = await svn_status();
// Status including remote information
const fullStatus = await svn_status(null, true);
Descargar un repositorio
const checkout = await svn_checkout(
"https://svn.example.com/repo/trunk",
"local-copy",
"HEAD",
"infinity",
false,
false
);
Confirmar cambios
// Add files
await svn_add(["src/new-file.js", "docs/readme.md"], { parents: true });
// Commit
await svn_commit(
"Add new feature and documentation",
["src/new-file.js", "docs/readme.md"]
);
🧪 Pruebas
# Run tests
npm test
# Tests with coverage
npm run test -- --coverage
# Tests in watch mode
npm run test -- --watch
🏗️ Desarrollo
Scripts disponibles
# Build TypeScript
npm run build
# Development mode
npm run dev
# Watch mode
npm run watch
# MCP Inspector
npm run inspector
# Tests
npm test
# Publish a new version
npm run release:patch
npm run release:minor
npm run release:major
Estructura del proyecto
svn-mcp/
├── package.json
├── tsconfig.json
├── jest.config.js
├── index.ts
├── common/
│ ├── types.ts # TypeScript types
│ ├── utils.ts # SVN utilities
│ └── version.ts # Package version
├── tools/
│ └── svn-service.ts # Main SVN service
├── tests/
│ └── integration.test.ts # Integration tests
└── README.md
📊 Estado de desarrollo
Consulta el archivo SVN_MCP_IMPLEMENTATION.md para la lista de verificación completa de implementación.
Progreso actual: Etapa 1 completada (Operaciones básicas) ✅
Próximas etapas:
- Gestión de ramas (branching)
- Operaciones avanzadas (merge, switch)
- Herramientas de análisis
- Operaciones por lotes
🐛 Solución de problemas
SVN no encontrado
Error: SVN is not available in the system PATH
Solución: Instala SVN y asegúrate de que esté en el PATH del sistema.
No es una copia de trabajo
Error: Failed to get SVN info: svn: warning: W155007: '.' is not a working copy
Solución: Navega a un directorio que sea una copia de trabajo de SVN o ejecuta primero el checkout.
Problemas de autenticación
Error: svn: E170001: Authentication failed
Solución: Configura las variables de entorno SVN_USERNAME y SVN_PASSWORD.
Tiempos de espera agotados en operaciones largas
Error: Command timeout after 30000ms
Solución: Aumenta el valor de SVN_TIMEOUT.
📄 Licencia
Licencia MIT: consulta LICENSE para más detalles.
🤝 Contribuciones
- Haz un fork del proyecto
- Crea una rama de características (
git checkout -b feature/new-feature) - Confirma tus cambios (
git commit -am 'Add new feature') - Sube los cambios a la rama (
git push origin feature/new-feature) - Abre un Pull Request
📞 Soporte
- Problemas: GitHub Issues
- Documentación: Project Wiki
- Email: soporte@grec0.dev