MCP Local RAG
Permite que tu agente de IA busque en tus archivos PDF, Word, Markdown y de texto de forma local, sin enviarlos a una API de embeddings.
429 estrellas en GitHubpor shinprLicencia MITActualizado hace 19 días
Cómo instalar
Este MCP es local: se ejecuta en tu computadora.
Funciona en las apps instaladas en tu PC (Claude Desktop, Claude Code, Cursor, VS Code…). Elige tu app:
Pega en la terminal:
claude mcp add local-rag -- npx -y mcp-local-rag
Qué completar
| Nombre | Qué es | Obligatorio |
|---|---|---|
BASE_DIR | Base directory for document storage (defaults to current working directory). Ignored when BASE_DIRS is set. | No |
BASE_DIRS | JSON array of base directories (e.g. '["/a","/b"]'). Takes precedence over BASE_DIR. | No |
IGNORE_PATHS | JSON array of glob patterns for files to keep out of the index, each matched against the file's path relative to its root (e.g. '["plugs/**","**/*.draft.md"]'). | No |
DB_PATH | Path to LanceDB database directory (defaults to ./lancedb/) | No |
CACHE_DIR | Directory where Transformers.js models are cached (defaults to ./models/) | No |
HF_ENDPOINT | Hugging Face model download endpoint. Set this to a mirror URL when direct downloads are blocked (defaults to https://huggingface.co). | No |
MODEL_NAME | Embedding model name (defaults to Xenova/all-MiniLM-L6-v2) | No |
MAX_FILE_SIZE | Maximum file size in bytes (defaults to 104857600 / 100MB) | No |
RAG_MAX_DISTANCE | Maximum distance threshold for filtering search results. Results with distance greater than this value will be excluded. Lower values mean stricter filtering (e.g., 0.5 for high relevance only) | No |
RAG_GROUPING | Grouping mode for quality filtering. 'similar' returns only the most similar group (stops at first distance jump). 'related' includes related groups (stops at second distance jump). Unset means no grouping filter | No |
RAG_MAX_FILES | Maximum number of files to keep in search results. Results are filtered to include only chunks from the top N best-scoring files. For example, 1 returns only the single best-matching file's chunks. Unset means no file filtering. | No |
CHUNK_MIN_LENGTH | Minimum chunk length in characters (1-10000, defaults to 50). Chunks shorter than this threshold are filtered out during ingestion. | No |
STORE_IMAGES | Store supported PDF and DOCX images during ingestion and return them with matched chunks (defaults to false). | No |
EMBED_TITLE_PREFIX | Embed each chunk together with its document title, which can help when passages don't restate the topic the title names (defaults to false). After changing it, use a new DB_PATH or delete the index and re-ingest. | No |
EMBED_HEADING_PREFIX | Add section headings to chunk embeddings when they fit (defaults to false). Independent of EMBED_TITLE_PREFIX. Re-ingest documents after changing it. | No |
RAG_DEVICE | Execution device for the embedder (defaults to cpu). Passed straight to ONNX Runtime; see the Transformers.js device source for the supported backend names. If the requested device fails to initialize, the server throws an error. | No |
RAG_DTYPE | Embedding quantization dtype for the embedder (defaults to fp32). Opt-in and pass-through; accepts any dtype the chosen model provides (fp32, fp16, q8, int8, ...). If the model has no variant for the requested dtype, the server throws an error. Changing this changes the embedding space — re-ingest existing data. | No |
RAG_HYBRID_WEIGHT | Keyword boost factor for hybrid search (0.0-1.0, defaults to 0.6). 0 means semantic similarity only; higher values increase the keyword-match contribution to the final score. | No |
RAG_RERANK_CMD | External reranker command template. Use {query} and {top} for query text and result count; unset disables reranking. | No |
RAG_RERANK_TIMEOUT_MS | Time budget per rerank call in milliseconds (100-600000, defaults to 10000). On timeout the spawned command is killed and the pre-rerank ordering is returned. | No |
¡Listo! Ahora pruébalo
Reinicia la app y pega uno de estos pedidos en el chat:
Sincroniza todos los documentos de la carpeta configurada y avísame cuando termine.
¿Qué dice la documentación de la API sobre la autenticación?
Qué es
Este servidor indexa documentos en tu computadora y los busca por significado y por palabras clave exactas. Los resultados incluyen el fragmento de origen y, cuando está disponible, los encabezados, números de línea o números de página. Después de la primera descarga del modelo, la indexación y la búsqueda funcionan sin conexión.
Qué puede hacer
sync_start: actualiza el índice según tu carpetasync_status: revisa una sincronización en cursoingest_file: agrega o reemplaza un archivoingest_data: agrega texto, Markdown o HTML que tiene el clientequery_documents: busca por significado y por coincidencia de palabras claveread_chunk_neighbors: lee el texto alrededor de un resultadolist_files: muestra los archivos y su estado en el índicedelete_file: quita un archivo indexado
Cuándo usarlo
- ›Cuando quieres hacer preguntas sobre una carpeta de documentos privados
- ›Cuando necesitas coincidencias exactas, como códigos de error o nombres de API, además de búsqueda por significado
- ›Cuando quieres respuestas con referencias de página o línea para poder revisar la fuente
Qué necesitas
Skills que combinan
¿MCP o skill?
El MCP da las manos al agente. La skill enseña la forma correcta de usarlas. Juntos, el resultado es mejor y gasta menos tokens.
google-cloud-solution-rag-enterprise-search-gke-sqldbDiseña un sistema de búsqueda empresarial privado que responde preguntas a partir de tus documentos, usando vectores de AlloyDB, un modelo abierto y GKE.xerj-knowledgeAyuda a tu agente a buscar en tus documentos, notas, PDF, hojas de cálculo y correos locales, y a citar el archivo y la página de donde sale cada respuesta.doc-readerPermite a tu agente leer el texto de archivos PDF, Word y Excel, diapositivas de PowerPoint, imágenes y otros muchos tipos de documentos mediante una sola herramienta.Preguntas frecuentes
¿Mis datos se envían a la nube?
No. No usa una API de embeddings, y después de descargar el modelo funciona sin conexión.
¿Qué archivos son compatibles?
PDF, DOCX, TXT y Markdown, además de HTML o texto que pase el cliente. No se admiten Excel, PowerPoint, imágenes ni archivos de código fuente.
¿Necesito una API key?
No. No se necesita API key, Docker, Python ni una base de datos externa.
¿Hay línea de comandos?
Sí. Puedes usar npx mcp-local-rag ingest, query, sync, list, status y delete.
¿Cómo limita el acceso a archivos?
BASE_DIR es el límite de seguridad para las operaciones con archivos, y las rutas de archivo MCP deben ser absolutas y estar dentro de una raíz configurada.
¿Puedo cambiar el modelo?
Sí, con MODEL_NAME. Al cambiar de modelo, crea un índice nuevo en un DB_PATH nuevo.
Si no funciona
- ›Configura BASE_DIR, DB_PATH y CACHE_DIR como rutas absolutas para que cada proyecto no cree su propio índice.
- ›La primera sincronización puede tardar de 1 a 2 minutos mientras se descarga el modelo.
- ›Si las descargas de Hugging Face están bloqueadas, configura HF_ENDPOINT con la URL de un espejo.
5 skills nuevas por semana. 1 minuto de lectura.