Glean Chatbot
Glean Chatbot
社内の契約ドキュメントの小規模なセットを Glean にインデックス登録し、それらのドキュメントに基づいて Search + Chat で質問に回答し、同じフローを MCP ツール(ask_glean)として公開します。
要件
Python 3.10+
Glean インスタンス
Indexing API トークン
Search と Chat のスコープを持つ Client API トークン
Related MCP server: search-context
セットアップ
リポジトリをクローンして移動します:
git clone <your-repo-url>
cd glean-chatbot依存関係をインストールします:
pip install -r requirements.txtサンプルから
.envを作成し、値を入力します:
# macOS / Linux
cp .env.example .env
# Windows (PowerShell)
copy .env.example .env変数 | 必須 | 目的 |
| 必須 | インスタンス名( |
| 必須 | Indexing API トークン |
| 必須 | Client API トークン(Search + Chat) |
| 必須* |
|
| 任意 | データソース名(デフォルトは |
| 任意 | Glean UI での表示名 |
| 任意 | すべてのドキュメントの |
.env は config.py(python-dotenv 経由)によって自動的に読み込まれます。source する必要はありません。
実行
ドキュメントのインデックス登録
python scripts/index_documents.py
# optional: wait until Search can find them
python scripts/index_documents.py --verifyCLI から質問する
python scripts/ask.py "Who owns the Enronry Tony contract?"
python scripts/ask.py "What must OKLightning Tony deliver before go-live?" --top-k 3MCP (Cursor)
プロジェクト設定は .cursor/mcp.json にあります(src/mcp_server.py の絶対パス + 環境変数)。編集後は Cursor を再起動するか MCP を再読み込みしてください。ツールは ask_glean です。
サーバー単体のスモークテスト:
python src/mcp_server.pyテスト
python tests/test_pipeline.pyネットワークは使用しません。Search/Chat をモックします。
仕組み
scripts/index_documents.py は Indexing API 経由で data/documents.json をプッシュします。クエリ時には、src/pipeline.py が Search を呼び出し、ヒットがある場合のみ、そのヒットをクローズドブックのコンテキストとして Chat を呼び出し、回答と出典を返します。CLI と MCP はどちらも同じパイプラインを呼び出します。結果は自社ドキュメントに限定されます。Search が何も返さない場合は、回答を捏造するのではなく、類似したドキュメントのタイトルを提案します。
注意事項 / 制限事項
共有サンドボックスは
datasourcesFilterを無視するため、ドキュメント ID の接頭辞(CUSTOM_<DATASOURCE>_Contract_)でクライアント側のフィルタリングをしています。インデックス登録は非同期です。ドキュメントが検索可能になるまで数分かかる場合があります。
デモ用ドキュメントは
allowAnonymousAccess: trueを使用しています。本番環境では有効にしないでください。ドキュメントの
viewURLはGLEAN_URL_REGEXに一致する必要があります。一致しない場合、インデックス登録が拒否されます。
API のトレードオフと本番運用に関する注意点については DESIGN_NOTE.md を参照してください。
This server cannot be deployed
Maintenance
Related MCP Connectors
Cited answers from your organisation's documents. GDPR-compliant, hosted in Germany.
Ask your organization's connected business data in plain language, with each person's permissions.
Answer questions using your semantic layer and company knowledge graph.
Find recorded calls and meetings, read transcripts, and ask questions grounded in your recordings.
Related MCP Servers
AlicenseNot gradedqualityDmaintenanceEnables AI assistants and developer tools to securely access and interact with an organization's enterprise knowledge, documents, and people through natural language while respecting existing access permissions.166MIT- AlicenseAqualityFmaintenanceEnables semantic search across documentation stored in Gemini FileSearchStores, returning AI-generated answers with source citations.11MIT

Rememberizer MCP Serverofficial
AlicenseNot gradedqualityDmaintenanceEnables querying and managing personal/team internal knowledge from sources like Slack, Gmail, and Drive through semantic search and retrieval.Apache 2.0- FlicenseNot gradedqualityDmaintenanceEnables searching a knowledge base and asking grounded questions with hybrid retrieval, reranking, and cited answers.-