filesystem-gitignore
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@filesystem-gitignorelist all source files in my project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ποΈ MCP Filesystem Server
Un servidor MCP (Model Context Protocol) profesional que proporciona operaciones de sistema de archivos mientras respeta automΓ‘ticamente los patrones de .gitignore.
π― ΒΏQuΓ© problema resuelve?
Cuando Claude trabaja con proyectos que tienen venv/, node_modules/, o .git/, intentar leer todo el directorio puede:
β οΈ Agotar el lΓmite de tokens leyendo 50k+ archivos innecesarios
β±οΈ Ser extremadamente lento al procesar directorios gigantes
π€― Ser confuso mezclando cΓ³digo fuente con dependencias
Este servidor resuelve eso respetando .gitignore automΓ‘ticamente, igual que Git. Claude solo ve lo que realmente importa: tu cΓ³digo.
Related MCP server: file-system-mcp-server
β¨ CaracterΓsticas
β Respeta
.gitignoreautomΓ‘ticamente: Excluyevenv/,node_modules/,__pycache__/, etc.β Optimizado para tokens: Solo lee archivos relevantes de tu proyecto
β Operaciones completas: Leer, escribir, listar, buscar, y crear archivos/directorios
β Seguridad por diseΓ±o: Solo accede a directorios explΓcitamente permitidos
β Caracteres especiales: Maneja espacios,
#,@, y otros caracteres en nombresβ Cache inteligente: Cachea patrones
.gitignorecon invalidaciΓ³n automΓ‘ticaβ Type-safe: Completamente tipado con dataclasses y type hints
β Production-ready: Tests, logging, manejo de errores robusto
ποΈ Arquitectura
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MCP Protocol Layer β
β (server.py - Adaptador que traduce MCP β FileSystemService)β
ββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββ
β Business Logic Layer β
β(filesystem_service.py - Orquesta validaciΓ³n + operaciones) β
ββββββββ¬βββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββ
β β
βΌ βΌ
ββββββββββββββββββββ ββββββββββββββββββββββββ
β Path Validation β β .gitignore Manager β
β (path_validator) β β (ignore_manager) β
β β β β
β - URL decoding β β - Pattern matching β
β - Security check β β - Intelligent cache β
ββββββββββββββββββββ ββββββββββββββββββββββββ
β β
ββββββββββββββββ¬ββββββββββββββββ
β
ββββββββββββββββΌβββββββββββββββββββ
β Data Access Layer β
β (filesystem_operations.py) β
β β
β - Pure I/O operations β
β - No business logic β
βββββββββββββββββββββββββββββββββββResponsabilidades por capa:
MCP Protocol Layer (
server.py):Traduce requests MCP a llamadas del service
Serializa responses a JSON
Maneja el protocolo stdio
Business Logic Layer (
filesystem_service.py):Orquesta validaciΓ³n + filtering + operaciones
Punto de entrada pΓΊblico del sistema
Combina mΓΊltiples componentes para cada operaciΓ³n
Support Components:
path_validator: Normaliza y valida paths (seguridad)ignore_manager: Cache y matching de.gitignorefilesystem_operations: I/O puro, sin lΓ³gica de negocio
Foundation:
config.py: ConfiguraciΓ³n centralizadaerrors.py: Excepciones tipadasmodels.py: Dataclasses para type safety
Beneficios de esta arquitectura:
β Cada capa es testeable independientemente
β FΓ‘cil cambiar implementaciΓ³n de una capa sin afectar otras
β SeparaciΓ³n clara de responsabilidades
β CΓ³digo reutilizable (el service puede usarse fuera de MCP)
π Requisitos
Python 3.10+
Compatible con clientes MCP como Claude Desktop, Zed, Sourcegraph Cody y otros que implementen el estΓ‘ndar Model Context Protocol.
π InstalaciΓ³n RΓ‘pida
# 1. Clonar y navegar al proyecto
cd "C:\DesarrolloPython\MCP FileSystem"
# 2. Instalar dependencias de desarrollo
make.bat install-dev
# 3. Ejecutar tests para verificar
make.bat testConfigurar Claude Desktop
Edita el archivo de configuraciΓ³n:
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"filesystem-gitignore": {
"command": "python",
"args": [
"-m",
"mcp_filesystem"
],
"env": {
"ALLOWED_DIRECTORIES": "C:\\DesarrolloPython;C:\\MisProyectos"
}
}
}
}Notas:
Usa paths absolutos
Windows: separa directorios con
;Unix/Mac: separa directorios con
:
Reinicia Claude Desktop para aplicar cambios.
π§ Uso
Herramientas Disponibles
1. read_file - Leer archivo de texto
read_file(path="C:\\DesarrolloPython\\proyecto\\src\\main.py")2. write_file - Escribir archivo
write_file(
path="C:\\DesarrolloPython\\nuevo_archivo.py",
content="print('Hello, World!')"
)3. list_directory - Listar contenido (no recursivo)
# Por defecto respeta .gitignore
list_directory(path="C:\\DesarrolloPython\\proyecto")
# Forzar mostrar TODO (incluso venv)
list_directory(path="C:\\DesarrolloPython\\proyecto", respect_gitignore=False)4. directory_tree - Γrbol recursivo
directory_tree(
path="C:\\DesarrolloPython\\proyecto",
max_depth=5,
respect_gitignore=True # Default
)5. search_files - Buscar archivos
search_files(
path="C:\\DesarrolloPython",
pattern="config", # Case-insensitive
respect_gitignore=True
)6. get_file_info - InformaciΓ³n detallada
get_file_info(path="C:\\DesarrolloPython\\proyecto\\README.md")7. create_directory - Crear directorio
create_directory(path="C:\\DesarrolloPython\\nuevo_proyecto\\src")π Decisiones de DiseΓ±o
ΒΏCΓ³mo se maneja .gitignore?
Parseo con pathspec: Usamos la librerΓa
pathspecque implementa el mismo algoritmo que GitCache inteligente:
Cada
.gitignorese parsea una sola vez y se cacheaEl cache se invalida automΓ‘ticamente cuando el
.gitignorecambia (detecta pormtime)Cache por directorio (cada dir tiene su propio
.gitignore)
Matching preciso:
Convierte paths a formato POSIX (forward slashes)
Agrega
/al final de directorios (convenciΓ³n de Git)Usa
gitwildmatchpara matching exacto
ΒΏCΓ³mo se optimiza el consumo de tokens?
Filtrado temprano: Los archivos ignorados ni siquiera se listan
Control de profundidad:
directory_treelimita profundidad mΓ‘xima (default: 5)Sin lectura de contenido: Solo lista nombres, no lee contenidos
Respeto opcional: Todas las herramientas tienen
respect_gitignoreflag (default:True)
ComparaciΓ³n:
# β Sin .gitignore (50k+ archivos en venv):
directory_tree("C:\\proyecto") # π₯ Consume 100k+ tokens
# β
Con .gitignore (solo archivos de proyecto):
directory_tree("C:\\proyecto") # β
~2k tokensSeguridad: ΒΏPor quΓ© directorios permitidos?
Previene acceso a archivos sensibles del sistema
Claude solo puede trabajar en tus proyectos
ValidaciΓ³n en cada operaciΓ³n (no se puede "escapar" con
../../../)
π§ͺ Testing
# Ejecutar todos los tests
make.bat test
# Solo tests unitarios
make.bat test-unit
# Solo tests de integraciΓ³n
make.bat test-integration
# Con reporte de coverage
make.bat test-covπ οΈ Desarrollo
# Formatear cΓ³digo
make.bat format
# Linters
make.bat lint
# Limpiar archivos generados
make.bat cleanπ Troubleshooting
"ALLOWED_DIRECTORIES environment variable must be set"
SoluciΓ³n: Configura la variable de entorno en Claude Desktop config.
"Access denied"
Causa: El path no estΓ‘ en ALLOWED_DIRECTORIES
SoluciΓ³n: Agrega el directorio a la lista.
No respeta .gitignore
Verifica:
ΒΏExiste
.gitignoreen el directorio?ΒΏLos patrones estΓ‘n bien escritos?
ΒΏEstΓ‘s usando
respect_gitignore=True? (es el default)
Consume muchos tokens
SoluciΓ³n:
Crea/mejora tu
.gitignoreReduce
max_depthendirectory_tree
# .gitignore recomendado para Python:
venv/
env/
__pycache__/
*.pyc
.git/
.pytest_cache/
.mypy_cache/
htmlcov/π Referencias
π€ Contribuciones
Β‘Las contribuciones son bienvenidas!
Antes de hacer PR:
β Ejecuta
make.bat test(todos los tests deben pasar)β Ejecuta
make.bat lint(sin warnings)β Ejecuta
make.bat format(cΓ³digo formateado)β Agrega tests para nueva funcionalidad
π Licencia
MIT License - Γsalo libremente.
Desarrollado con β€οΈ para optimizar la interacciΓ³n de Claude con proyectos reales
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
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/mvecchiett/mcp-filesystem-gitignore'
If you have feedback or need assistance with the MCP directory API, please join our Discord server