glean-company-docs
Halcyon Docs Chatbot
ローカルドキュメントコーパスに対する根拠付き質問応答。Glean の Indexing、Search、Chat API 上に構築され、単一の MCP ツールとして公開されています。
Web UI はありません。チャットインターフェースは MCP クライアント(Cursor、Claude Desktop、その他任意のクライアント)です。
仕組み
data/Halcyon Shared Drive/ -> Indexing API -> Search API -> Chat API -> {answer, sources, diagnostics}Search は Chat の前に実行され、Chat は検索を行いません。パッセージは明示的に取得されて渡されます。関連性の下限(質問に対する用語の重複)をクリアするものが何もない場合、回答は正直に「インデックスされたコンテンツが見つかりません」となり、Chat は呼び出されません。
Related MCP server: mcp-business-bot
セットアップ
Poetry と Python 3.12+ が必要です。
poetry config virtualenvs.in-project true # keeps the venv at ./.venv
poetry install
cp .env.example .env # then fill in the tokens.env は gitignore されています。実際のトークンをコミットしないでください。
変数 | 使用箇所 | 備考 |
| 両方 | SDK が |
| インデックス時のみ | クエリパスでは読み込まれない |
| 検索 + チャット | スコープは Chat/Search、タイプは Global |
| 両方 | 共有サンドボックス。ドキュメント ID の名前空間を分けるために使用 |
| インデックス時のみ | コーパスのルート( |
| 検索 + チャット | 実行時のメールアドレス。Global トークンに必須 |
オプション(デフォルト値付き): GLEAN_DOC_ID_PREFIX(halcyon)、GLEAN_TOP_K(5)、GLEAN_MAX_SNIPPET_SIZE(2000)、GLEAN_MIN_TERM_OVERLAP(0.30)、GLEAN_CHAT_TIMEOUT_MS(60000)。
2つのトークンは構造的に分離されています。Settings.for_indexing() は GLEAN_INDEXING_TOKEN を読み取り、Settings.for_query() は GLEAN_CLIENT_TOKEN を読み取り、インデックス用の変数には一切触れません。
使用方法
poetry run python -m glean_chat_bot # the MCP server, on stdio
poetry run glean-index --dry-run # extract and report, send nothing
poetry run glean-index # extract and bulk-push
poetry run glean-index --process-now # ask Glean to process immediately (1 per 3h)
poetry run pytest # contract tests: no network, no tokens
poetry run pytest -m live # the eval set, against real Gleanデバッグログには -v を追加します。
インデックス作成は非同期です。glean-index は Glean がドキュメントを受け入れるとすぐに戻りますが、検索可能になるまでには数分かかります。回答に依存する前に、Glean 管理コンソールで完全なカバレッジを確認してください。
MCP クライアント設定
{
"mcpServers": {
"glean-company-docs": {
"command": "/absolute/path/to/glean-chat-bot/.venv/bin/python",
"args": ["-m", "glean_chat_bot"],
"env": {
"GLEAN_INSTANCE": "support-lab",
"GLEAN_CLIENT_TOKEN": "...",
"GLEAN_ACT_AS": "you@example.com",
"GLEAN_DATASOURCE": "interviewds3"
}
}
}
}1つのツール、ask_company_docs(question, top_k=None, include_citations=True) -> dict が {answer, sources, diagnostics} を返します。diagnostics は何が検索され、何が返ってきたかを報告するため、呼び出し元のモデルは「何も一致しなかった」と「自分の言い回しが悪かった」を区別し、それに応じて再試行できます。
構成
glean_chat_bot/
__main__.py `python -m glean_chat_bot`, the MCP server: one tool over query.ask.ask()
client.py indexing and query client factories, the ActAs header
extraction.py one adapter per file type, path signals, walk
indexing.py the whole write path, behind the `glean-index` command
models.py Passage, Source, Answer, ExtractedDoc (pydantic)
query/ search.py (search -> Passage, the relevance floor)
chat.py (chat -> answer + resolved citations)
ask.py (ask() — the single orchestration function)
utils/ config.py (env loading, one Settings, two constructors)
logging.py (log format, timing wrapper on every Glean call)
data/ the corpus
docs/ extraction notes
tests/ test_contract.py (the invariants, offline)
eval_cases.py + test_eval_live.py (the eval set, `-m live`)依存関係とパッケージングには Poetry、lint とフォーマットには Ruff を使用しています。コミット前に poetry run ruff check . と poetry run ruff format . を実行してください。
未実装
グループおよびユーザー権限、部門フィルタリング、鮮度アノテーション、コンテンツハッシュマニフェスト、クエリ書き換えと適応的リトライ、ストリーミング、会話メモリ、リトライとバックオフ、Docker、CI。
This server cannot be deployed
Maintenance
Related MCP Connectors
Query your own PDFs and documents from any MCP client. Every answer cites the page it came from.
Query any docs site via MCP. Submit a URL, ask questions, get cited answers.
One governed MCP endpoint for 40+ business systems. Read-only, source-cited answers.
Read-only hosted MCP over CanonicAI's cited Answers corpus on canonicai.com.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables document-based Q&A with multi-modal RAG, hybrid retrieval, knowledge graph reasoning, and multi-agent orchestration via MCP tools.4MIT
- FlicenseNot gradedqualityDmaintenanceEnables querying company knowledge base using RAG, providing accurate answers from internal documents via MCP.-
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to query and manage a document knowledge base via MCP, with RAG-powered search and grounded answers with citations.MIT
- AlicenseAqualityBmaintenanceEnables coding agents to query a team knowledge base via MCP, performing semantic search and asking questions that return grounded, citation-backed answers from ingested documents.4MIT