MCP Local RAG
AI 에이전트가 임베딩 API로 보내지 않고, 여러분의 PDF, Word, Markdown, 텍스트 파일을 로컬에서 검색하게 합니다.
429 GitHub 스타제작 shinpr라이선스 MIT업데이트 19일 전
설치 방법
이 MCP는 로컬 방식이에요. 내 컴퓨터에서 실행돼요.
PC에 설치한 앱(Claude Desktop, Claude Code, Cursor, VS Code 등)에서 쓸 수 있어요. 앱을 고르세요:
터미널에 붙여 넣기:
claude mcp add local-rag -- npx -y mcp-local-rag
채워야 할 것
| 이름 | 설명 | 필수 |
|---|---|---|
BASE_DIR | Base directory for document storage (defaults to current working directory). Ignored when BASE_DIRS is set. | 아니요 |
BASE_DIRS | JSON array of base directories (e.g. '["/a","/b"]'). Takes precedence over BASE_DIR. | 아니요 |
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"]'). | 아니요 |
DB_PATH | Path to LanceDB database directory (defaults to ./lancedb/) | 아니요 |
CACHE_DIR | Directory where Transformers.js models are cached (defaults to ./models/) | 아니요 |
HF_ENDPOINT | Hugging Face model download endpoint. Set this to a mirror URL when direct downloads are blocked (defaults to https://huggingface.co). | 아니요 |
MODEL_NAME | Embedding model name (defaults to Xenova/all-MiniLM-L6-v2) | 아니요 |
MAX_FILE_SIZE | Maximum file size in bytes (defaults to 104857600 / 100MB) | 아니요 |
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) | 아니요 |
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 | 아니요 |
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. | 아니요 |
CHUNK_MIN_LENGTH | Minimum chunk length in characters (1-10000, defaults to 50). Chunks shorter than this threshold are filtered out during ingestion. | 아니요 |
STORE_IMAGES | Store supported PDF and DOCX images during ingestion and return them with matched chunks (defaults to false). | 아니요 |
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. | 아니요 |
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. | 아니요 |
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. | 아니요 |
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. | 아니요 |
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. | 아니요 |
RAG_RERANK_CMD | External reranker command template. Use {query} and {top} for query text and result count; unset disables reranking. | 아니요 |
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. | 아니요 |
준비 끝! 이제 테스트해 보세요
앱을 다시 시작하고 아래 요청 중 하나를 채팅에 붙여 넣으세요:
설정된 폴더의 모든 문서를 동기화하고, 끝나면 알려 주십시오.
API 문서가 인증에 대해 무엇이라고 설명하는지 알려 주십시오.
무엇인가요
이 서버는 여러분의 컴퓨터에서 문서를 색인하고 의미와 정확한 키워드로 검색합니다. 결과에는 원문 구절과, 가능한 경우 제목, 줄 번호, 페이지 번호가 포함됩니다. 모델을 처음 내려받은 뒤에는 색인과 검색이 오프라인에서 작동합니다.
할 수 있는 일
sync_start: 색인을 폴더와 맞춰 최신 상태로 만듭니다sync_status: 실행 중인 동기화를 확인합니다ingest_file: 파일 하나를 추가하거나 바꿉니다ingest_data: 클라이언트가 가진 텍스트, Markdown, HTML을 추가합니다query_documents: 의미와 키워드 일치로 검색합니다read_chunk_neighbors: 결과 주변의 텍스트를 읽습니다list_files: 파일과 색인 상태를 보여 줍니다delete_file: 색인된 파일을 제거합니다
언제 쓰나요
- ›비공개 문서 폴더에 대해 질문하고 싶을 때
- ›오류 코드나 API 이름처럼 정확한 일치와 의미 검색이 모두 필요할 때
- ›답변에 확인할 수 있도록 페이지나 줄 참조가 필요할 때
필요한 것
함께 쓰면 좋은 스킬
MCP일까, 스킬일까?
MCP는 에이전트에게 손을 주고, 스킬은 그 손을 제대로 쓰는 법을 알려 줘요. 함께 쓰면 결과가 좋아지고 토큰도 덜 들어요.
자주 묻는 질문
데이터가 클라우드로 보내집니까?
아닙니다. 임베딩 API를 쓰지 않으며, 모델을 내려받은 후에는 오프라인에서 작동합니다.
어떤 파일을 지원합니까?
PDF, DOCX, TXT, Markdown, 그리고 클라이언트가 전달한 HTML이나 텍스트입니다. Excel, PowerPoint, 이미지, 소스 코드 파일은 지원하지 않습니다.
API 키가 필요합니까?
아닙니다. API 키, Docker, Python, 외부 데이터베이스가 필요하지 않습니다.
명령줄이 있습니까?
예. npx mcp-local-rag의 ingest, query, sync, list, status, delete 명령을 쓸 수 있습니다.
파일 접근은 어떻게 제한합니까?
BASE_DIR가 파일 작업의 보안 경계이며, MCP 파일 경로는 절대 경로이면서 설정된 루트 안에 있어야 합니다.
모델을 바꿀 수 있습니까?
예. MODEL_NAME으로 바꿀 수 있습니다. 모델을 바꾸면 새 DB_PATH에 새 색인을 만드십시오.
작동하지 않을 때
- ›모든 프로젝트가 각자 색인을 만들지 않도록 BASE_DIR, DB_PATH, CACHE_DIR를 절대 경로로 설정하십시오.
- ›처음 동기화는 모델을 내려받는 동안 1~2분 걸릴 수 있습니다.
- ›Hugging Face 다운로드가 막혀 있으면 HF_ENDPOINT를 미러 URL로 설정하십시오.
매주 새 스킬 5개. 읽는 데 1분.