ต้นแบบ · รุ่นทดลอง: มีทุก server ในทะเบียนทางการ อัปเดตทุก 30 นาที รีวิวและบัญชีผู้ใช้จะมาในขั้นถัดไป
PopNx MCPที่รวม MCP สำหรับคนใช้ AI · อธิบายเป็นภาษาคน

MCP Local Rag

โดย shinprรุ่น 0.23.2i★ –iรันบนเครื่อง
ชื่อใน registryio.github.shinpr/mcp-local-rag

ติดตั้ง

ภาพรวม

คำอธิบายจากผู้ทำ (ภาษาอังกฤษตามต้นฉบับ)

Easy-to-setup local RAG server with minimal configuration

สามเสาของ PopNx MCP

สามเรื่องนี้ไม่รวมเป็นคะแนนเดียว เพราะความเห็น การวัด และความนิยม เป็นคนละเรื่องกัน

ใช้ทำอะไรได้

ตัวนี้ยังไม่ได้เรียบเรียงเป็นภาษาไทย ด้านล่างคือข้อเท็จจริงที่เราอ่านจาก registry

  • การเชื่อมต่อ: รันบนเครื่อง
  • ช่องทาง (transport): stdio
  • หมวด: ค้นข้อมูลและความจำของ AI

ติดตั้ง

เลือกโปรแกรม AI ที่คุณใช้ แล้วคัดลอกค่าตั้งไปวาง

ก่อนติดตั้ง

  • ผลตรวจเบื้องต้น: ผ่าน 1 จาก 1 ข้อ
  • รันในเครื่องคุณด้วยสิทธิ์ของผู้ใช้คุณ (ไฟล์ อินเทอร์เน็ต แอปต่าง ๆ)
  • ค่าที่คุณต้องใส่เอง: BASE_DIR, BASE_DIRS, IGNORE_PATHS, DB_PATH, CACHE_DIR, HF_ENDPOINT, MODEL_NAME, MAX_FILE_SIZE, RAG_MAX_DISTANCE, RAG_GROUPING, RAG_MAX_FILES, CHUNK_MIN_LENGTH, STORE_IMAGES, EMBED_TITLE_PREFIX, EMBED_HEADING_PREFIX, RAG_DEVICE, RAG_DTYPE, RAG_HYBRID_WEIGHT, RAG_RERANK_CMD, RAG_RERANK_TIMEOUT_MS

ต้องเตรียมก่อน

  • npmติดตั้ง Node.js (มีคำสั่ง npx) ในเครื่อง

คุณใช้แอปไหน

เลือกแอปด้านบน เราจำไว้ให้ ครั้งหน้าปุ่มจะขึ้นว่า “ติดตั้งลง …”

เปิด Claude Desktop → Settings → Developer → Edit Config แล้ววางค่านี้ในไฟล์ claude_desktop_config.json

{
  "mcpServers": {
    "local-rag": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-local-rag"
      ],
      "env": {
        "BASE_DIR": "ใส่ค่าของคุณ",
        "BASE_DIRS": "ใส่ค่าของคุณ",
        "IGNORE_PATHS": "ใส่ค่าของคุณ",
        "DB_PATH": "ใส่ค่าของคุณ",
        "CACHE_DIR": "ใส่ค่าของคุณ",
        "HF_ENDPOINT": "ใส่ค่าของคุณ",
        "MODEL_NAME": "ใส่ค่าของคุณ",
        "MAX_FILE_SIZE": "ใส่ค่าของคุณ",
        "RAG_MAX_DISTANCE": "ใส่ค่าของคุณ",
        "RAG_GROUPING": "ใส่ค่าของคุณ",
        "RAG_MAX_FILES": "ใส่ค่าของคุณ",
        "CHUNK_MIN_LENGTH": "ใส่ค่าของคุณ",
        "STORE_IMAGES": "ใส่ค่าของคุณ",
        "EMBED_TITLE_PREFIX": "ใส่ค่าของคุณ",
        "EMBED_HEADING_PREFIX": "ใส่ค่าของคุณ",
        "RAG_DEVICE": "ใส่ค่าของคุณ",
        "RAG_DTYPE": "ใส่ค่าของคุณ",
        "RAG_HYBRID_WEIGHT": "ใส่ค่าของคุณ",
        "RAG_RERANK_CMD": "ใส่ค่าของคุณ",
        "RAG_RERANK_TIMEOUT_MS": "ใส่ค่าของคุณ"
      }
    }
  }
}

พิมพ์คำสั่งนี้ใน Terminal

claude mcp add local-rag --env BASE_DIR='ใส่ค่าของคุณ' --env BASE_DIRS='ใส่ค่าของคุณ' --env IGNORE_PATHS='ใส่ค่าของคุณ' --env DB_PATH='ใส่ค่าของคุณ' --env CACHE_DIR='ใส่ค่าของคุณ' --env HF_ENDPOINT='ใส่ค่าของคุณ' --env MODEL_NAME='ใส่ค่าของคุณ' --env MAX_FILE_SIZE='ใส่ค่าของคุณ' --env RAG_MAX_DISTANCE='ใส่ค่าของคุณ' --env RAG_GROUPING='ใส่ค่าของคุณ' --env RAG_MAX_FILES='ใส่ค่าของคุณ' --env CHUNK_MIN_LENGTH='ใส่ค่าของคุณ' --env STORE_IMAGES='ใส่ค่าของคุณ' --env EMBED_TITLE_PREFIX='ใส่ค่าของคุณ' --env EMBED_HEADING_PREFIX='ใส่ค่าของคุณ' --env RAG_DEVICE='ใส่ค่าของคุณ' --env RAG_DTYPE='ใส่ค่าของคุณ' --env RAG_HYBRID_WEIGHT='ใส่ค่าของคุณ' --env RAG_RERANK_CMD='ใส่ค่าของคุณ' --env RAG_RERANK_TIMEOUT_MS='ใส่ค่าของคุณ' -- npx -y mcp-local-rag

เติมค่าที่เว้นว่างไว้ก่อนรัน

เปิดใน Cursor

หรือคัดลอกค่าตั้งเอง

วางในไฟล์ .cursor/mcp.json ของโปรเจกต์ หรือ ~/.cursor/mcp.json

{
  "mcpServers": {
    "local-rag": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-local-rag"
      ],
      "env": {
        "BASE_DIR": "ใส่ค่าของคุณ",
        "BASE_DIRS": "ใส่ค่าของคุณ",
        "IGNORE_PATHS": "ใส่ค่าของคุณ",
        "DB_PATH": "ใส่ค่าของคุณ",
        "CACHE_DIR": "ใส่ค่าของคุณ",
        "HF_ENDPOINT": "ใส่ค่าของคุณ",
        "MODEL_NAME": "ใส่ค่าของคุณ",
        "MAX_FILE_SIZE": "ใส่ค่าของคุณ",
        "RAG_MAX_DISTANCE": "ใส่ค่าของคุณ",
        "RAG_GROUPING": "ใส่ค่าของคุณ",
        "RAG_MAX_FILES": "ใส่ค่าของคุณ",
        "CHUNK_MIN_LENGTH": "ใส่ค่าของคุณ",
        "STORE_IMAGES": "ใส่ค่าของคุณ",
        "EMBED_TITLE_PREFIX": "ใส่ค่าของคุณ",
        "EMBED_HEADING_PREFIX": "ใส่ค่าของคุณ",
        "RAG_DEVICE": "ใส่ค่าของคุณ",
        "RAG_DTYPE": "ใส่ค่าของคุณ",
        "RAG_HYBRID_WEIGHT": "ใส่ค่าของคุณ",
        "RAG_RERANK_CMD": "ใส่ค่าของคุณ",
        "RAG_RERANK_TIMEOUT_MS": "ใส่ค่าของคุณ"
      }
    }
  }
}

เบราว์เซอร์จะถามก่อนเปิดแอป จากนั้นแอปแสดงค่าตั้งให้ตรวจแล้วกดยืนยัน ช่อง key เว้นว่างไว้ให้คุณใส่เอง

เปิดใน VS Code

หรือคัดลอกค่าตั้งเอง

วางในไฟล์ .vscode/mcp.json ของโปรเจกต์

{
  "servers": {
    "local-rag": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "mcp-local-rag"
      ],
      "env": {
        "BASE_DIR": "ใส่ค่าของคุณ",
        "BASE_DIRS": "ใส่ค่าของคุณ",
        "IGNORE_PATHS": "ใส่ค่าของคุณ",
        "DB_PATH": "ใส่ค่าของคุณ",
        "CACHE_DIR": "ใส่ค่าของคุณ",
        "HF_ENDPOINT": "ใส่ค่าของคุณ",
        "MODEL_NAME": "ใส่ค่าของคุณ",
        "MAX_FILE_SIZE": "ใส่ค่าของคุณ",
        "RAG_MAX_DISTANCE": "ใส่ค่าของคุณ",
        "RAG_GROUPING": "ใส่ค่าของคุณ",
        "RAG_MAX_FILES": "ใส่ค่าของคุณ",
        "CHUNK_MIN_LENGTH": "ใส่ค่าของคุณ",
        "STORE_IMAGES": "ใส่ค่าของคุณ",
        "EMBED_TITLE_PREFIX": "ใส่ค่าของคุณ",
        "EMBED_HEADING_PREFIX": "ใส่ค่าของคุณ",
        "RAG_DEVICE": "ใส่ค่าของคุณ",
        "RAG_DTYPE": "ใส่ค่าของคุณ",
        "RAG_HYBRID_WEIGHT": "ใส่ค่าของคุณ",
        "RAG_RERANK_CMD": "ใส่ค่าของคุณ",
        "RAG_RERANK_TIMEOUT_MS": "ใส่ค่าของคุณ"
      }
    }
  }
}

เบราว์เซอร์จะถามก่อนเปิดแอป จากนั้นแอปแสดงค่าตั้งให้ตรวจแล้วกดยืนยัน ช่อง key เว้นว่างไว้ให้คุณใส่เอง

ตัวนี้รันในเครื่องคุณ แต่ ChatGPT ต่อได้เฉพาะ server บนอินเทอร์เน็ต ลองเลือกแอปอื่น

ตัวเลือกเก็บในคุกกี้บนเครื่องนี้ ไม่ต้องมีบัญชี

ค่าที่ต้องใส่เอง

  • BASE_DIR env
    Base directory for document storage (defaults to current working directory). Ignored when BASE_DIRS is set.
  • BASE_DIRS env
    JSON array of base directories (e.g. '["/a","/b"]'). Takes precedence over BASE_DIR.
  • IGNORE_PATHS env
    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 env
    Path to LanceDB database directory (defaults to ./lancedb/)
  • CACHE_DIR env
    Directory where Transformers.js models are cached (defaults to ./models/)
  • HF_ENDPOINT env
    Hugging Face model download endpoint. Set this to a mirror URL when direct downloads are blocked (defaults to https://huggingface.co).
  • MODEL_NAME env
    Embedding model name (defaults to Xenova/all-MiniLM-L6-v2)
  • MAX_FILE_SIZE env
    Maximum file size in bytes (defaults to 104857600 / 100MB)
  • RAG_MAX_DISTANCE env
    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 env
    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 gr…
  • RAG_MAX_FILES env
    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. U…
  • CHUNK_MIN_LENGTH env
    Minimum chunk length in characters (1-10000, defaults to 50). Chunks shorter than this threshold are filtered out during ingestion.
  • STORE_IMAGES env
    Store supported PDF and DOCX images during ingestion and return them with matched chunks (defaults to false).
  • EMBED_TITLE_PREFIX env
    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 a…
  • EMBED_HEADING_PREFIX env
    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 env
    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 initializ…
  • RAG_DTYPE env
    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…
  • RAG_HYBRID_WEIGHT env
    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 env
    External reranker command template. Use {query} and {top} for query text and result count; unset disables reranking.
  • RAG_RERANK_TIMEOUT_MS env
    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.

ค่าตั้งนี้สร้างจากข้อมูลใน registry ของผู้ทำ ถ้าไม่ตรงกับ README ให้เชื่อ README

ทำอะไรได้บ้าง

รันในเครื่องคุณ รายการเครื่องมือจะขึ้นในแอป AI หลังติดตั้ง

ผลตรวจเบื้องต้นi

เราตรวจจากข้อมูลที่ใครก็เปิดดูได้ ยังไม่ได้อ่านโค้ด ข้อที่ไม่เกี่ยวกับตัวนี้ไม่นับในตัวหาร · ตรวจเมื่อ 7 พ.ย. 2569

  • ✓ ผ่าน

    ตัวตนผู้ทำตรงกับ repo

    ชื่อใน registry ยืนยันด้วยบัญชี GitHub shinpr ซึ่งเป็นเจ้าของ repo

  • … ยังไม่ตรวจ

    ยังมีคนดูแล

    ยังไม่ได้อ่านข้อมูล repo จาก GitHub

  • … ยังไม่ตรวจ

    มีสัญญาอนุญาต (license)

    ยังไม่ได้อ่านข้อมูล repo จาก GitHub

  • – ไม่เกี่ยว

    endpoint ตอบ

    ตัวนี้รันบนเครื่องคุณ ไม่มี endpoint บนอินเทอร์เน็ต

  • – ไม่เกี่ยว

    ล็อกอินแบบ OAuth

    ตัวนี้รันบนเครื่อง ใช้ค่าที่ตั้งในเครื่องแทน

  • … ยังไม่ตรวจ

    คำอธิบายเครื่องมือไม่มีคำสั่งแอบแฝง

    รันในเครื่องคุณ เราอ่านรายการเครื่องมือได้เฉพาะตัวที่มี endpoint บนอินเทอร์เน็ต

เทียบกับตัวอื่นในหมวด ค้นข้อมูลและความจำของ AIi

  • ดาวมากกว่า 0% ของอีก 7277 ตัวในหมวดนี้
  • ส่งรุ่นใหม่เข้า registry ล่าสุดกว่า 94% ของอีก 7277 ตัวในหมวดนี้
  • ผลตรวจเบื้องต้นดีกว่าหรือเท่ากับ 100% ของอีก 7277 ตัวในหมวดนี้

เทียบกับทุก server ที่ยังใช้งานในหมวดนี้ทั้งทะเบียน ดาวนับเฉพาะเมื่อผู้ลงทะเบียนเป็นเจ้าของ repo

คำถามที่พบบ่อย

MCP Local Rag ปลอดภัยไหม?

จากการตรวจเบื้องต้นของเรา ผ่าน 1 จาก 1 ข้อที่ตรวจได้ เรายังไม่ได้อ่านโค้ด ก่อนใส่กุญแจหรือ token ให้ดูว่า server ขอสิทธิ์อะไร และเลือกกุญแจที่ทำได้เท่าที่จำเป็น

ต้องใช้กุญแจหรือรหัสอะไรบ้าง?

registry ไม่ได้ระบุว่าต้องใช้กุญแจ แต่บางตัวจะขอให้ล็อกอินตอนใช้ครั้งแรก

ตัวนี้รันบนเครื่องหรือบนคลาวด์?

รันบนเครื่องของคุณ โปรแกรม AI จะเปิด server ขึ้นมาเองเมื่อใช้ ข้อมูลไม่ต้องผ่านเซิร์ฟเวอร์ของผู้ทำ (ยกเว้นตัวที่ไปเรียกบริการออนไลน์ต่อ)

ยังมีคนดูแลอยู่ไหม?

repo บน GitHub มีการแก้โค้ดล่าสุด – และส่งรุ่นล่าสุด (0.23.2) เข้า registry เมื่อวานซืน

ใช้กับโปรแกรมไหนได้บ้าง?

โปรแกรมที่รองรับ MCP เช่น Claude Desktop, Claude Code, Cursor และ VS Code ตัวนี้ต้องมี Node.js ในเครื่องด้วย

มีตัวไหนใช้แทนได้บ้าง?

ในหมวดเดียวกันมี Context7, Codebase Memory, Exa

ตัวที่ใช้แทนได้

server หมวดเดียวกันจากผู้ทำคนอื่น เรียงตามดาว

อ่านการ์ด:★ ดาว GitHubiสามเสา: รีวิว · ผลตรวจ · การใช้งานiอัปเดต = วันที่ส่งรุ่นล่าสุดเข้า registryi

Context7

โดย upstash

ส่งคู่มือการใช้ไลบรารีและเฟรมเวิร์กรุ่นล่าสุดให้ AI อ่านก่อนตอบ ช่วยให้โค้ดที่ AI เขียนไม่ใช้คำสั่งเก่าที่เลิกใช้แล้ว

บนเครื่องหรือคลาวด์★ 64,224MITอัปเดต เมื่อวาน
ติดตั้ง

Codebase Memory

โดย DeusData

Codebase knowledge graph for AI agents — 162 languages, sub-ms queries, 99% fewer tokens.

รันบนเครื่อง★ 48,148MITอัปเดต 21 วันที่ผ่านมา
ติดตั้ง

Exa

โดย exa-labs

Connect AI agents to Exa for web search, content fetching, and multi-step research.

รันบนคลาวด์★ 5,213MITอัปเดต เดือนที่แล้ว
ติดตั้ง

README จากผู้ทำ

เปิดอ่าน README

ส่วนนี้คัดจาก repo ของผู้ทำตามต้นฉบับ PopNx MCP ไม่ได้ตรวจหรือรับรองเนื้อหา ตัด HTML รูปภาพ และสคริปต์ออกแล้ว ลิงก์จะพาออกนอกเว็บ

MCP Local RAG

English | 简体中文 | Deutsch | Español | Português (Brasil) | Français

Search private documents from an MCP client or the terminal without sending them to an embedding API.

mcp-local-rag indexes PDF, DOCX, Markdown, and text files on your machine. Search combines semantic similarity with keyword matching, so queries can match both intent and exact technical terms such as API names, class names, and error codes. Results include source passages and, where available, headings, line numbers, or page numbers so you can check and cite the original document.

No API key, Docker, Python, or external database is required. After the initial model download, text ingestion and search work offline.

Quick Start

Requirements
  • Node.js 22.20 or later
  • Internet access on first use to download the npm package and embedding model
  • A directory containing the documents you want to search

Set BASE_DIR to that directory. It is also the security boundary for file operations. Replace /absolute/path/to/your/documents below with the directory's absolute path.

Use one of the examples below, or register npx -y mcp-local-rag and set BASE_DIR using your client's MCP configuration format.

Set DB_PATH and CACHE_DIR to absolute paths as well. Relative paths resolve from the server's working directory, so starting the server from different projects creates a separate index and model cache in each.

Claude Code

Run this command:

claude mcp add local-rag --scope user --env BASE_DIR=/absolute/path/to/your/documents -- npx -y mcp-local-rag

Codex

Add to ~/.codex/config.toml:

[mcp_servers.local-rag]

command = "npx" args = ["-y", "mcp-local-rag"]

[mcp_servers.local-rag.env] BASE_DIR = "/absolute/path/to/your/documents"

OpenCode

Add to ~/.config/opencode/opencode.json (or opencode.jsonc):

{

"$schema": "https://opencode.ai/config.json", "mcp": { "local-rag": { "type": "local", "command": ["npx", "-y", "mcp-local-rag"], "environment": { "BASE_DIR": "/absolute/path/to/your/documents" } } } }

Cursor

Add to ~/.cursor/mcp.json:

{

"mcpServers": { "local-rag": { "command": "npx", "args": ["-y", "mcp-local-rag"], "env": { "BASE_DIR": "/absolute/path/to/your/documents" } } } }

Restart the client, then ask it to build the index:

Sync all documents in the configured root and wait until it finishes.

The first sync downloads the default embedding model (about 90 MB) and may take 1–2 minutes before ingestion starts. Later runs use the local cache.

Once the sync completes:

What does the API documentation say about authentication?
CLI Quick Start

To use the CLI without an MCP client:

npx mcp-local-rag ingest ./docs/

npx mcp-local-rag query "authentication API"

The CLI uses the current directory as its document root by default. Run both commands from the same directory so they use the same default index, or set BASE_DIR and DB_PATH explicitly.

Supported Content

InputHow to ingest
PDF, DOCX, TXT, MarkdownFile ingestion or directory sync
HTML already fetched by the clientingest_data
Plain text or Markdown held in memoryingest_data with a stable source identifier

HTML fetching is not built into the server. An MCP client can fetch a page and pass its HTML to ingest_data.

Excel, PowerPoint, standalone images, and source-code file extensions are not supported by file ingestion. PDFs can optionally use a local vision model to describe figures, but this is not OCR or image search.

Using the Index

Sync after adding, editing, or removing documents. For searches and follow-up reading, ask your MCP client:

Find the documented behavior of ERR_CONNECTION_REFUSED.

Read the surrounding chunks for that result.

You can also ingest a single file or HTML already fetched by the client. To refresh an existing entry, ingest the document again using the same path or source identifier. sync skips unchanged files. MCP file paths must be absolute and inside a configured document root.

PDF section headings may be inaccurate. Check the original page when you need the exact heading.

MCP Tools

ToolPurpose
sync_startReconcile the index with all configured roots or one path
sync_statusPoll a running sync job
ingest_fileIngest or replace one file
ingest_dataIngest text, Markdown, or HTML already held by the client
query_documentsSearch with semantic matching and keyword boost
read_chunk_neighborsRead surrounding chunks from a search result
list_filesShow supported files and their ingestion state
delete_fileDelete an indexed file or an ingest_data item
statusShow index and search status

CLI

Use the CLI to update the index, narrow searches, or remove indexed content:

npx mcp-local-rag sync ./docs/

npx mcp-local-rag query "auth" --scope /docs/api --scope /docs/guide npx mcp-local-rag read-neighbors --file-path /abs/path.md --chunk-index 5 npx mcp-local-rag list npx mcp-local-rag status npx mcp-local-rag delete ./docs/old.pdf npx mcp-local-rag delete --source "https://example.com/docs"

ingest imports the selected files; sync also removes entries for deleted files and skips unchanged files. Use --scope to restrict search results to a path prefix, repeating it to include multiple prefixes.

Global options such as --db-path, --cache-dir, and --model-name go before the subcommand. Subcommand options go after it:

npx mcp-local-rag --db-path ./my-db query "authentication"

Run npx mcp-local-rag --help for the complete command reference.

query writes its results to stdout as JSON, best match first, so it can be piped into another tool. The field-by-field contract is in docs/schema/query-output.schema.json.

If you move a project and want to keep its index, stop the MCP server and other database writers, move the files and database together without changing the directory layout, then run:

npx mcp-local-rag --db-path /new/project/lancedb relocate --from /old/project --to /new/project

Update BASE_DIR/BASE_DIRS, DB_PATH, and any other moved paths in your MCP configuration, then restart the client.

Agent Skills

Agent Skills provide query and ingestion guidance for AI assistants:

npx mcp-local-rag skills install --claude-code

npx mcp-local-rag skills install --claude-code --global npx mcp-local-rag skills install --codex

Installed skills cover query formulation, result refinement, and HTML ingestion. Ask the assistant to use the mcp-local-rag skill explicitly if it does not activate automatically.

Advanced Options

Start with the defaults. Open the sections below when you need different document roots, better results for your corpus, or searchable PDF figures.

Storage and Document Roots

The MCP server reads environment variables. The CLI accepts the listed variables and flags. Keep the same DB_PATH when commands should use the same index.

Environment VariableCLI FlagDefaultDescription
BASE_DIR--base-dirCurrent directoryOne document root; the CLI flag is repeatable on ingest, list, and sync
BASE_DIRSN/A(unset)JSON array of document roots; takes precedence over BASE_DIR
IGNORE_PATHSN/A(unset)JSON array of glob patterns for files to keep out of the index
DB_PATH--db-path./lancedb/Vector database location
CACHE_DIR--cache-dir./models/Model cache directory
HF_ENDPOINTN/Ahttps://huggingface.coHugging Face model download endpoint; use a mirror URL when direct downloads are blocked
MAX_FILE_SIZE--max-file-size104857600 (100MB)Maximum file size in bytes

File operations stay within configured roots. For multiple directories, set BASE_DIRS='["/absolute/docs","/absolute/specs"]' or repeat CLI --base-dir. Precedence: CLI roots, BASE_DIRS, BASE_DIR, then the current directory. Only the highest-priority source is used; roots from different sources are not merged. Invalid BASE_DIRS is an error. Relative DB_PATH and CACHE_DIR are resolved from the working directory.

To keep files out of the index, set IGNORE_PATHS to a JSON array of glob patterns, for example IGNORE_PATHS='["plugs/**","**/*.draft.md"]'. Each pattern is matched against the file's path relative to the root that contains it, written with / on every OS. * and ** do not match names that start with ., so write such directories out, as in ".obsidian/**". ingest, list, and sync skip matching files when they scan a directory, and sync removes any that are already indexed. Invalid IGNORE_PATHS is an error.

Models and Search Tuning

Choose an embedding model for your documents’ language and subject. Compare settings using questions you actually ask and check which source passages are returned. The model must support mean pooling and L2 normalization, which this tool uses to produce embeddings.

Environment VariableCLI FlagDefaultDescription
MODEL_NAME--model-nameXenova/all-MiniLM-L6-v2Hugging Face embedding model
CHUNK_MIN_LENGTH--chunk-min-length50Minimum length in characters (1–10000) for ordinary chunks; a fragment of content split to fit the model's token limit can be shorter
EMBED_TITLE_PREFIXN/AfalseAdd the document title to each chunk's embedding input
EMBED_HEADING_PREFIXN/AfalseAdd the heading hierarchy to each chunk's embedding input when it fits
RAG_DEVICEN/AcpuONNX Runtime execution device
RAG_DTYPEN/Afp32Embedding dtype passed to the selected model

Both prefix options default to false and work independently. Try EMBED_TITLE_PREFIX when a passage needs the document’s overall topic, or EMBED_HEADING_PREFIX when it needs its section’s topic. Enabling both is not always better. They affect embeddings, not the returned text or keyword index; heading context is omitted when it would exceed the input budget.

When changing embedding models, build a fresh index at a new DB_PATH. Vectors from different models are not comparable, even when their dimensions match. After changing RAG_DTYPE or either prefix option, re-ingest all indexed documents before searching. sync skips unchanged files.

The CLI does not read MCP client configuration. When sharing an index, use the same model, RAG_DTYPE, and prefix settings for ingestion and search. A change to RAG_DEVICE alone does not require a new index.

###

ตัดมาแค่ช่วงต้น อ่านต่อใน repo

ถาม PopNx