Skip to main content
Glama

Knowledge Base MCP Server

by jeanibarz
The Unlicense
10
  • Linux
  • Apple

ナレッジベースMCPサーバー

この MCP サーバーは、さまざまなナレッジ ベースからコンテンツを一覧表示および取得するためのツールを提供します。

セットアップ手順

これらの手順では、システムに Node.js と npm がインストールされていることを前提としています。

Smithery経由でインストール

Smithery経由で Claude Desktop の Knowledge Base Server を自動的にインストールするには:

npx -y @smithery/cli install @jeanibarz/knowledge-base-mcp-server --client claude

手動インストール

前提条件

  • Node.js (バージョン 16 以上)
  • npm (ノード パッケージ マネージャー)
  1. リポジトリをクローンします。
    git clone <repository_url> cd knowledge-base-mcp-server
  2. 依存関係をインストールします:
    npm install
  3. 環境変数を設定します。
    • サーバーでは、 HUGGINGFACE_API_KEY環境変数を設定する必要があります。これは、知識ベースコンテンツの埋め込みを生成するために使用されるHugging Face推論APIのAPIキーです。Hugging Faceのウェブサイト( https://huggingface.co/ )から無料のAPIキーを入手できます。
    • サーバーでは、 KNOWLEDGE_BASES_ROOT_DIR環境変数を設定する必要があります。この変数は、ナレッジベースのサブディレクトリが配置されているディレクトリを指定します。この変数を設定しない場合、デフォルトで$HOME/knowledge_basesが使用されます。ここで、 $HOMEは現在のユーザーのホームディレクトリです。
    • サーバーは、FAISSインデックスへのパスを指定するためのFAISS_INDEX_PATH環境変数をサポートしています。設定されていない場合は、デフォルトで$HOME/knowledge_bases/.faissが使用されます。
    • サーバーは、埋め込み生成に使用するHugging Faceモデルを指定するためのHUGGINGFACE_MODEL_NAME環境変数をサポートしています。設定されていない場合は、デフォルトでsentence-transformers/all-MiniLM-L6-v2が使用されます。
    • これらの環境変数は、 .bashrcまたは.zshrcファイルで設定することも、MCP 設定で直接設定することもできます。
  4. サーバーを構築します。
    npm run build
  5. サーバーを MCP 設定に追加します。
    • /home/jean/.vscode-server/data/User/globalStorage/saoudrizwan.claude-dev/settings/にあるcline_mcp_settings.jsonファイルを編集します。
    • mcpServersオブジェクトに次の構成を追加します。
    "knowledge-base-mcp": { "command": "node", "args": [ "/path/to/knowledge-base-mcp-server/build/index.js" ], "disabled": false, "autoApprove": [], "env": { "KNOWLEDGE_BASES_ROOT_DIR": "/path/to/knowledge_bases", "HUGGINGFACE_API_KEY": "YOUR_HUGGINGFACE_API_KEY", }, "description": "Retrieves similar chunks from the knowledge base based on a query." },
    • /path/to/knowledge-base-mcp-serverサーバー ディレクトリへの実際のパスに置き換えます。
    • /path/to/knowledge_basesナレッジ ベース ディレクトリへの実際のパスに置き換えます。
  6. ナレッジ ベース ディレクトリを作成します。
    • 各ナレッジ ベース (例: companyit_supportonboarding ) のKNOWLEDGE_BASES_ROOT_DIR内にサブディレクトリを作成します。
    • これらのサブディレクトリ内に、ナレッジ ベースのコンテンツを含むテキスト ファイル (例: .txt.md ) を配置します。
  • サーバーは、指定されたナレッジ ベースのサブディレクトリ内のすべてのテキスト ファイル (例: .txt.md ) を再帰的に読み取ります。
  • サーバーは隠しファイルとディレクトリ ( .で始まるもの) をスキップします。
  • サーバーは各ファイルについてSHA256ハッシュを計算し、隠しサブディレクトリ.index内の同名のファイルに保存します。このハッシュは、前回のインデックス作成以降にファイルが変更されたかどうかを判断するために使用されます。
  • ファイルの内容は、 langchain/text_splitterMarkdownTextSplitterを使用してチャンクに分割されます。
  • 各チャンクの内容は、類似性検索に使用される FAISS インデックスに追加されます。
  • FAISSインデックスは、サーバーの起動時に自動的に初期化されます。ナレッジベースファイルの変更をチェックし、それに応じてインデックスを更新します。

使用法

サーバーは 2 つのツールを公開します。

  • list_knowledge_bases : 利用可能なナレッジベースを一覧表示します。
  • クエリに基づいてナレッジベースから類似のチャンクを取得しretrieve_knowledge 。オプションでナレッジベースを指定した場合は、そのナレッジベースのみが検索されます。指定しない場合は、利用可能なすべてのナレッジベースが対象となります。デフォルトでは、スコアがしきい値2未満のドキュメントチャンクが最大10個返されます。threshold thresholdを使用して、異なるしきい値を指定することもできます。

これらのツールは、MCP インターフェースを通じて使用できます。

retrieve_knowledgeツールは、FAISSインデックスを使用してセマンティック検索を実行します。インデックスは、サーバーの起動時またはナレッジベース内のファイルが変更されたときに自動的に更新されます。

retrieve_knowledgeツールの出力は、次の構造を持つマークダウン形式の文字列です。

## Semantic Search Results **Result 1:** [Content of the most similar chunk] **Source:** ```json { "source": "[Path to the file containing the chunk]" } ``` --- **Result 2:** [Content of the second most similar chunk] **Source:** ```json { "source": "[Path to the file containing the chunk]" } ``` > **Disclaimer:** The provided results might not all be relevant. Please cross-check the relevance of the information.

各結果には、最も類似したチャンクのコンテンツ、ソース ファイル、および類似度スコアが含まれます。

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

セマンティック検索機能を使用して、さまざまなナレッジ ベースからコンテンツを一覧表示および取得するためのツールを提供します。

  1. セットアップ手順
    1. Smithery経由でインストール
    2. 手動インストール
  2. 使用法

    Related MCP Servers

    • -
      security
      A
      license
      -
      quality
      Enables performing local web searches and extracting structured content from web pages using the Model Context Protocol, featuring customizable result limits and domain filtering.
      Last updated -
      5
      JavaScript
      MIT License
    • -
      security
      A
      license
      -
      quality
      Provides RAG capabilities for semantic document search using Qdrant vector database and Ollama/OpenAI embeddings, allowing users to add, search, list, and delete documentation with metadata support.
      Last updated -
      5
      4
      TypeScript
      Apache 2.0
    • -
      security
      A
      license
      -
      quality
      Allows AI models to interact with SourceSync.ai's knowledge management platform to organize, ingest, retrieve, and search content in knowledge bases.
      Last updated -
      14
      1
      TypeScript
      MIT License
      • Apple
      • Linux
    • -
      security
      A
      license
      -
      quality
      Enables semantic search across multiple Qdrant vector database collections, supporting multi-query capability and providing semantically relevant document retrieval with configurable result counts.
      Last updated -
      46
      TypeScript
      MIT License

    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/jeanibarz/knowledge-base-mcp-server'

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