glean-company-docs
Halcyon Docs Chatbot
로컬 문서 코퍼스에 대한 근거 기반 질의응답으로, Glean의 Indexing, Search 및 Chat API를 기반으로 구축되었으며 단일 MCP 도구로 노출됩니다.
웹 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가 |
| 인덱싱 전용 | 쿼리 경로에서는 절대 로드되지 않음 |
| search + chat | Chat/Search 범위, 유형 Global |
| 둘 다 | 공유 샌드박스이므로 문서 ID를 네임스페이스화 |
| 인덱싱 전용 | 코퍼스 루트( |
| search + chat | 대신 수행할 이메일, 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).
두 토큰은 구조적으로 분리되어 있습니다. 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"
}
}
}
}하나의 도구, 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, 린트 및 포맷에는 Ruff를 사용합니다. 커밋 전에 poetry run ruff check . 및 poetry run ruff format .을 실행하세요.
아직 구축되지 않음
그룹 및 사용자 권한, 부서 필터링, 신선도 주석, 콘텐츠 해시 매니페스트, 쿼리 재작성 및 적응형 재시도, 스트리밍, 대화 메모리, 재시도 및 백오프, Docker, CI.
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