Skip to main content
Glama
tonyromero-ai

Glean Chatbot

Glean Chatbot

将一小批内部合同文档索引到 Glean,通过 Search + Chat 解答这些文档中的问题,并将同一流程以 MCP 工具(ask_glean)的形式提供。

要求

  • Python 3.10+

  • 一个 Glean 实例

  • 一个 Indexing API 令牌

  • 一个包含 Search 和 Chat 作用域的 Client API 令牌

Related MCP server: Glean Remote MCP Server

安装与设置

  1. 克隆并进入仓库:

git clone <your-repo-url>
cd glean-chatbot
  1. 安装依赖:

pip install -r requirements.txt
  1. 根据示例创建 .env 并填入你的取值:

# macOS / Linux
cp .env.example .env

# Windows (PowerShell)
copy .env.example .env

变量

是否必需

用途

GLEAN_INSTANCE

实例名称(https://<instance>-be.glean.com

GLEAN_INDEXING_TOKEN

Indexing API 令牌

GLEAN_CLIENT_TOKEN

Client API 令牌(支持 Search + Chat)

GLEAN_ACT_AS

*

用于 X-Glean-ActAs 的用户邮箱(*使用全局 Client API 令牌时需要)

GLEAN_DATASOURCE

数据源名称(默认为 interviewds

GLEAN_DATASOURCE_DISPLAY

在 Glean UI 中显示的名称

GLEAN_URL_REGEX

每个文档 viewURL 必须匹配的正则表达式

.envconfig.py 自动加载(通过 python-dotenv),无需手动 source

运行

为文档建立索引

python scripts/index_documents.py
# optional: wait until Search can find them
python scripts/index_documents.py --verify

从 CLI 提问

python scripts/ask.py "Who owns the Enronry Tony contract?"
python scripts/ask.py "What must OKLightning Tony deliver before go-live?" --top-k 3

MCP (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 都调用同一个 pipeline。结果被限制在我们自己的文档范围内;如果 Search 没有返回任何内容,我们会推荐相近的文档标题,而不是凭空编造答案。

备注 / 限制

  • 共享沙箱会忽略 datasourcesFilter;我们在客户端按文档 id 前缀(CUSTOM_<DATASOURCE>_Contract_)进行过滤。

  • 索引是异步的——文档可能需要几分钟才能被搜索到。

  • 演示文档使用了 allowAnonymousAccess: true。请勿将其带到生产环境。

  • 文档的 viewURL 必须匹配 GLEAN_URL_REGEX,否则索引会将其拒绝。

关于 API 的取舍与生产环境注意事项,请参阅 DESIGN_NOTE.md

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

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables semantic search and retrieval of personal and team knowledge from connected sources like Slack, Gmail, Google Drive, and Dropbox, with the ability to save new information for future recall.
    Apache 2.0
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables 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.
    164
    MIT
  • F
    license
    Not graded
    quality
    F
    maintenance
    Enables semantic search across documentation stored in Gemini FileSearchStores, returning AI-generated answers with source citations.
    1

View all related MCP servers

Related MCP Connectors

  • Search your knowledge bases from any AI assistant using hybrid RAG.

  • Search and reason over your Obsidian-style Markdown vault, right from ChatGPT.

  • Connect your team's living knowledge base — docs, data, issues, CRM — to Claude and ChatGPT.

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/tonyromero-ai/glean-chatbot'

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