文档查询服务

一个通过MCP服务器暴露Better Auth文档的工具,包括基于Gemini的Streamlit聊天机器人演示客户端。

  • by Tegelstenen
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 Tegelstenen/better-auth-mcp

使用说明

更好的认证MCP

MCP服务器,将Better Auth文档作为工具公开,部署在Modal上。包括一个由Gemini提供支持的Streamlit聊天机器人演示客户端。

服务器公开了两个MCP工具:

  • get_table_of_contents:获取Better Auth文档索引
  • read_page:按路径读取特定文档页面

MCP服务器部署

服务器(mcp-server.py)部署到 模态首先对Modal进行身份验证,然后部署服务器:

modal token new
modal deploy mcp-server.py

Modal将输出一个URL,如下所示 https://your-username--example-mcp-server.modal.run。将此URL添加到 .env 文件为 MCP_SERVER_URL (别忘了附加 /mcp 到基本URL)。

客户端演示

Streamlit聊天机器人 main.py 是一个演示客户端,使用MCP服务器回答有关Better Auth的问题。它使用 gemini-2.5-flash-lite 以处理查询并自动调用MCP工具来获取相关文档。

cp .env.example .env
# Edit .env with GEMINI_API_KEY and MCP_SERVER_URL

要启动演示客户端,请运行:

uv sync
streamlit run main.py

项目结构

better-auth-mcp/
├── mcp-server.py          # MCP server
├── main.py                # Streamlit app entry point
├── chatbot.py             # Chatbot client with Gemini integration
└── test_endpoint.py       # Test script for MCP endpoints