mcp-lucene-server

Apache 2.0
  • Linux
  • Apple

Integrations

  • Utilizes Apache Lucene for full-text search and indexing capabilities, enabling efficient document management, complex querying with Lucene query syntax, and document filtering based on metadata.

  • Supports containerization of the application using Docker, with instructions for building and running the server as a Docker container.

  • Built with Spring Boot for application setup and deployment, providing RESTful API endpoints for document management operations including upsert, delete, list, and query functionalities.

MCP 루씬 서버

설명

MCP 루씬 서버는 아파치 루씬을 사용하여 효율적인 검색 기능을 제공하도록 설계된 모델 컨텍스트 프로토콜(MCP)의 Java 기반 구현입니다. 이 서버를 사용하면 루씬의 강력한 인덱싱 및 검색 기능을 활용하여 문서를 관리하고 쿼리할 수 있습니다. Spring Boot를 사용하여 구축되어 간편한 설정 및 배포가 가능합니다.

특징

  • MCP 준수: 핵심 모델 컨텍스트 프로토콜을 구현합니다.
  • Lucene 기반: Apache Lucene을 활용하여 전체 텍스트 검색 및 인덱싱을 수행합니다.
  • RESTful API: 서버와 상호작용하기 위한 RESTful API를 제공합니다.
  • 문서 관리:
    • Upsert: Lucene 인덱스에 문서를 추가하거나 업데이트합니다.
    • 삭제: Lucene 인덱스에서 문서를 삭제합니다.
    • 목록: 인덱스에서 문서 목록을 검색합니다.
  • 질의:
    • Lucene 쿼리 구문을 사용하여 복잡한 쿼리를 지원합니다.
    • 필터링: 문서 메타데이터를 기준으로 쿼리를 필터링합니다.
  • 상태: 서버 상태를 확인하세요.
  • Spring Boot: Spring Boot로 구축되어 설치와 배포가 간편합니다.
  • Docker화: Docker를 사용하여 애플리케이션을 컨테이너화하는 방법에 대한 지침이 포함되어 있습니다.

목차

시작하기

필수 조건

설치

  1. 저장소를 복제합니다.지엑스피1( your-username GitHub 사용자 이름으로 바꾸세요)
  2. Maven을 사용하여 프로젝트를 빌드합니다.
    mvn clean install

서버 실행

도커 없이
  1. Spring Boot 애플리케이션을 실행합니다.
    java -jar target/mcp-lucene-server-0.0.1-SNAPSHOT.jar
    ( .jar 파일의 정확한 이름은 프로젝트 버전에 따라 약간 다를 수 있습니다.)
  2. 서버는 기본적으로 8080 포트에서 시작됩니다.
도커를 사용하여
  1. Docker가 설치되어 있는지 확인하세요. 공식 Docker 웹사이트( https://docs.docker.com/get-docker/ )의 지침을 따르세요.
  2. Docker 이미지를 빌드합니다. 터미널에서 프로젝트의 루트 디렉토리로 이동하여 다음을 실행합니다.
    docker build -t mcp-lucene-server .
  3. Docker 컨테이너를 실행합니다.
    docker run -p 8080:8080 mcp-lucene-server
    이렇게 하면 호스트 머신의 포트 8080 컨테이너 내부의 포트 8080 에 매핑됩니다.

용법

API 엔드포인트

서버는 다음과 같은 API 엔드포인트를 제공합니다.

  • GET /mcp/v1/status
    • 서버의 상태를 반환합니다.
  • POST /mcp/v1/upsert
    • 하나 이상의 문서를 업서트(삽입 또는 업데이트)합니다.
    • 요청 본문:
      { "documents": [ { "id": "doc1", "text": "This is the text of document 1.", "metadata": { "category": "example", "language": "english" } }, { "id": "doc2", "text": "This is document 2's text.", "metadata": { "category": "sample", "language": "spanish" } } ] }
  • POST /mcp/v1/query
    • Lucene 인덱스를 쿼리합니다.
    • 요청 본문:
      { "queries": [ { "query": "document", "top_k": 10, "filter": { "language": "english" } }, { "query": "text search", "filter": { "category": "example" } } ] }
    • query : Lucene 쿼리 문자열.
    • top_k : (선택 사항) 반환할 결과의 최대 개수(기본값: 10).
    • filter : (선택 사항) 필터링 기준이 되는 메타데이터 필드와 값의 맵입니다.
  • POST /mcp/v1/delete
    • Lucene 인덱스에서 문서를 삭제합니다.
    • 요청 본문:
      { "ids": ["doc1", "doc2"] }
  • GET /mcp/v1/list
    • Lucene 인덱스의 문서를 나열합니다.
    • 요청 본문:
      { "ids": ["doc1", "doc2"] }

예시

서버 상태 가져오기:

curl http://localhost:8080/mcp/v1/status

문서 업데이트:

curl -X POST http://localhost:8080/mcp/v1/upsert -H 'Content-Type: application/json' -d '{ "documents": [ { "id": "doc1", "text": "This is the text of document 1.", "metadata": { "category": "example", "language": "english" } }, { "id": "doc2", "text": "This is document 2''s text.", "metadata": { "category": "sample", "language": "spanish" } } ] }'

쿼리 문서:

curl -X POST http://localhost:8080/mcp/v1/query -H 'Content-Type: application/json' -d '{ "queries": [ { "query": "document text", "top_k": 5, "filter": { "language": "english" } } ] }'

문서 삭제:

curl -X POST http://localhost:8080/mcp/v1/delete -H 'Content-Type: application/json' -d '{ "ids": ["doc1"] }'

문서 목록:

curl -X POST http://localhost:8080/mcp/v1/list -H 'Content-Type: application/json' -d '{ "ids": ["doc1", "doc2"] }'

구성

서버는 Spring Boot의 애플리케이션 속성을 사용하여 구성할 수 있습니다. 주요 속성은 다음과 같습니다.

  • server.port : 서버가 수신하는 포트(기본값: 8080).
  • lucene.index.path : Lucene 인덱스 디렉터리 경로입니다. 인덱싱된 데이터가 저장되는 위치입니다. 설정하지 않으면 기본 위치가 사용됩니다. 영구 저장 위치로 설정하는 것이 좋습니다.

src/main/resources 디렉토리의 application.properties 또는 application.yml 파일에서 이러한 속성을 설정하거나 환경 변수를 사용하여 설정할 수 있습니다.

예제 application.properties :

server.port=8080 lucene.index.path=/루씬/인덱스 경로

특허

이 프로젝트는 Apache 2.0 라이선스 에 따라 라이선스가 부여되었습니다.

-
security - not tested
A
license - permissive license
-
quality - not tested

mcp-lucene-server

  1. 설명
    1. 특징
      1. 목차
        1. 시작하기
          1. 필수 조건
          2. 설치
          3. 서버 실행
        2. 용법
          1. API 엔드포인트
          2. 예시
        3. 구성
          1. 특허

            Related MCP Servers

            • A
              security
              A
              license
              A
              quality
              A Model Context Protocol (MCP) server that provides search and crawl functionality using Search1API.
              Last updated -
              5
              206
              111
              TypeScript
              MIT License
              • Apple
            • A
              security
              A
              license
              A
              quality
              An MCP server implementation that integrates the Tavily Search API, providing optimized search capabilities for LLMs.
              Last updated -
              1
              TypeScript
              MIT License
              • Apple
            • A
              security
              A
              license
              A
              quality
              Provides an MCP protocol interface for interacting with Elasticsearch 7.x databases, supporting comprehensive search functionality including aggregations, highlighting, and sorting.
              Last updated -
              3
              1
              Python
              Apache 2.0
            • -
              security
              F
              license
              -
              quality
              An MCP server that integrates with SerpApi to retrieve search results from multiple search engines including Google, Bing, Yahoo, and others, enabling fast access to both live and archived search data.
              Last updated -
              Python

            View all related MCP servers

            ID: 2dlbo0wmkw