Skip to main content
Glama

mcp-lucene-server

Apache 2.0
  • Linux
  • Apple

MCP Lucene サーバー

説明

MCP Luceneサーバーは、Apache Luceneを用いた効率的な検索・取得機能を提供するために設計された、モデルコンテキストプロトコル(MCP)のJavaベースの実装です。このサーバーでは、Luceneの強力なインデックス作成機能と検索機能を活用し、ドキュメントの管理とクエリを実行できます。Spring Bootを使用して構築されているため、セットアップとデプロイが簡単です。

特徴

  • **MCP コンプライアンス:**コア モデル コンテキスト プロトコルを実装します。
  • **Lucene 搭載:**フルテキスト検索とインデックス作成に Apache Lucene を活用します。
  • **RESTful API:**サーバーと対話するための RESTful API を提供します。
  • ドキュメント管理:
    • Upsert: Lucene インデックス内のドキュメントを追加または更新します。
    • 削除: Lucene インデックスからドキュメントを削除します。
    • **リスト:**インデックスからドキュメントのリストを取得します。
  • クエリ:
    • Lucene クエリ構文を使用した複雑なクエリをサポートします。
    • フィルタリング: ドキュメントのメタデータに基づいてクエリをフィルタリングします。
  • **ステータス:**サーバーのステータスを確認します。
  • Spring Boot: Spring Boot を使用して構築されているため、セットアップとデプロイメントが簡単です。
  • Docker 化: Docker を使用してアプリケーションをコンテナー化する手順が含まれています。

目次

はじめる

前提条件

インストール

  1. リポジトリをクローンします。
    git clone [https://github.com/your-username/mcp-lucene-server.git](https://github.com/your-username/mcp-lucene-server.git) cd mcp-lucene-server
    ( your-usernameを GitHub ユーザー名に置き換えてください)
  2. Maven を使用してプロジェクトをビルドします。
    mvn clean install

サーバーの実行

Dockerなし
  1. Spring Boot アプリケーションを実行します。
    java -jar target/mcp-lucene-server-0.0.1-SNAPSHOT.jar
    ( .jarファイルの正確な名前は、プロジェクトのバージョンによって若干異なる場合があります。)
  2. デフォルトでは、サーバーはポート8080で起動します。
Dockerを使用
  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
    • 1 つ以上のドキュメントをアップサート (挿入または更新) します。
    • リクエスト本文:
      { "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=/path/to/lucene/index

ライセンス

このプロジェクトは、Apache 2.0 ライセンスに基づいてライセンスされます。

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

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/VivekKumarNeu/MCP-Lucene-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server