Skip to main content
Glama
vurtnec

LanceDB Node

by vurtnec

LanceDB Node.js 벡터 검색

LanceDB와 Ollama의 임베딩 모델을 사용한 벡터 검색을 위한 Node.js 구현입니다.

개요

이 프로젝트에서는 다음 방법을 보여줍니다.

  • LanceDB 데이터베이스에 연결

  • Ollama를 사용하여 사용자 정의 임베딩 함수 만들기

  • 저장된 문서에 대한 벡터 유사성 검색 수행

  • 검색 결과 처리 및 표시

Related MCP server: MCP Tooling Lab

필수 조건

  • Node.js(v14 이상)

  • Ollama는 nomic-embed-text 모델을 사용하여 로컬로 실행 중입니다.

  • 읽기/쓰기 권한이 있는 LanceDB 저장 위치

설치

  1. 저장소를 복제합니다

  2. 종속성 설치:

지엑스피1

종속성

  • @lancedb/lancedb : Node.js용 LanceDB 클라이언트

  • apache-arrow : 열 형식 데이터 처리용

  • node-fetch : Ollama에 API 호출을 하기 위해

용법

벡터 검색 테스트 스크립트를 실행합니다.

pnpm test-vector-search

또는 직접 실행:

node test-vector-search.js

구성

스크립트는 다음에 연결됩니다.

  • 구성된 경로의 LanceDB

  • http://localhost:11434/api/embeddings 에서 Ollama API를 확인하세요.

MCP 구성

Claude Desktop을 MCP 서비스로 통합하려면 MCP 구성 JSON에 다음을 추가하세요.

{
  "mcpServers": {
    "lanceDB": {
      "command": "node",
      "args": [
        "/path/to/lancedb-node/dist/index.js",
        "--db-path",
        "/path/to/your/lancedb/storage"
      ]
    }
  }
}

경로를 실제 설치 경로로 바꾸세요.

  • /path/to/lancedb-node/dist/index.js - 컴파일된 index.js 파일의 경로

  • /path/to/your/lancedb/storage - LanceDB 스토리지 디렉토리 경로

사용자 정의 임베딩 함수

이 프로젝트에는 다음을 수행하는 사용자 지정 OllamaEmbeddingFunction 이 포함되어 있습니다.

  • Ollama API에 텍스트를 보냅니다.

  • 768차원의 임베딩을 수신합니다.

  • LanceDB와 함께 사용할 수 있도록 포맷합니다.

벡터 검색 예제

이 예제에서는 "ai-rag" 테이블에서 "성공 기준을 정의하는 방법"을 검색하여 유사도 점수와 함께 결과를 표시합니다.

특허

MIT 라이센스

기여하다

기여를 환영합니다! 풀 리퀘스트를 제출해 주세요.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables semantic search and retrieval of information from technical documentation PDFs using RAG-powered natural language queries with Ollama embeddings and LLMs.
    6
    -
  • F
    license
    B
    quality
    D
    maintenance
    A Node.js-based MCP server that enables AI agents to generate embeddings, index documents, and perform semantic vector searches using OpenAI and Chroma. It facilitates the creation of retrieval-augmented generation (RAG) pipelines for internal knowledge assistants and document-based workflows.
    3
    -
  • A
    license
    Not graded
    quality
    C
    maintenance
    Local offline semantic search over documents (txt, md, pdf, docx, pptx, csv). Indexes folders into a LanceDB vector database with multilingual embeddings and supports hybrid vector + keyword search via Reciprocal Rank Fusion. No API keys, no cloud, no Docker required.
    29
    AGPL 3.0