Skip to main content
Glama
cmacdonald0514

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}

搜索先于 Chat 运行,Chat 从不检索:段落被显式检索并传入。如果没有内容通过相关性下限(与问题的词项重叠),答案就是诚实的"未找到索引内容",并且永远不会调用 Chat。

Related MCP server: faq-rag

设置

需要 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。切勿提交真实令牌。

变量

使用方

说明

GLEAN_INSTANCE

两者

SDK 构建 https://{instance}-be.glean.com

GLEAN_INDEXING_TOKEN

仅索引

绝不在查询路径上加载

GLEAN_CLIENT_TOKEN

搜索 + 聊天

作用域为 Chat/Search,类型为 Global

GLEAN_DATASOURCE

两者

共享沙箱,因此用于对文档 ID 进行命名空间隔离

GLEAN_DOCS_ROOT

仅索引

语料库根目录(data/Halcyon Shared Drive

GLEAN_ACT_AS

搜索 + 聊天

要模拟的邮箱;Global 令牌必需

可选,带默认值:GLEAN_DOC_ID_PREFIXhalcyon)、GLEAN_TOP_K5)、GLEAN_MAX_SNIPPET_SIZE2000)、GLEAN_MIN_TERM_OVERLAP0.30)、GLEAN_CHAT_TIMEOUT_MS60000)。

两个令牌在结构上是分离的:Settings.for_indexing() 读取 GLEAN_INDEXING_TOKENSettings.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 用于 lint 和格式化。提交前运行 poetry run ruff check .poetry run ruff format .

尚未构建

组和用户权限、部门过滤、新鲜度标注、内容哈希清单、查询重写和自适应重试、流式传输、对话记忆、重试和退避、Docker、CI。

F
license - not found
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables answering natural-language questions from FAQ documents using vector search and LLM generation via an MCP tool.
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables hybrid document search (BM25 and dense) over a configurable corpus via MCP tools, returning passages and sources for AI agents to cite in answers.
    MIT

View all related MCP servers

Related MCP Connectors

  • Query any docs site via MCP. Submit a URL, ask questions, get cited answers.

  • Google AI Overview answers and cited sources via the Apify Google AI Overview API, hosted MCP.

  • Your company's brain for AI agents. Cited, permission-aware knowledge across every system.

View all MCP Connectors

Latest Blog Posts

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/cmacdonald0514/glean-chat-bot'

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