Back to MCP directory
publicPublicdnsLocal runtime

HR Policy Chatbot

该项目构建了一个基于RAG的HR聊天机器人,通过MCP服务器作为功能调用中心,实现PDF文档上传、解析、检索及自然语言问答功能。

article

README

🚀 带有本地MCP服务器的RAG聊天机器人

本项目构建了一个基于RAG的HR聊天机器人,借助localhost MCP服务器作为功能调用中心,为用户提供工作场所规则相关的信息。它能让用户上传PDF文件,并从中提取信息来回答自然语言问题。

🚀 快速开始

本项目实现了一个基于 Streamlit 和 MCP 服务器的检索增强生成(RAG)聊天机器人。用户可以上传 PDF 文件,聊天机器人从这些 PDF 中提取相关信息以回答自然语言问题。该系统利用 OpenAI 模型、LangChain 工具和内存中向量存储来实现高效的文档检索。

✨ 主要特性

  • MCP 工具集成:使用 MCP 进行工具编排,确保文档索引、检索和答案生成之间的通信顺畅。后端工具可以轻松扩展或替换以添加新功能。
  • PDF 上传与解析:上传 PDF 文件后,使用 PDFPlumberLoader 提取文本内容。
  • 文本分块:使用 RecursiveCharacterTextSplitter 将提取的文本分成更小的段落,以便于索引和检索。
  • 文档索引:将分块后的文本索引到内存中的向量存储中,并使用 OpenAIEmbeddings 生成嵌入。
  • 相似性搜索(余弦相似度):当用户提交查询时,聊天机器人执行相似性搜索以检索与查询最相关的文档段落。
  • 基于提示的答案生成:使用自定义提示模板结合用户问题和检索到的上下文,并通过 GPT - 4 驱动的 LLM(使用 ChatOpenAI)生成最终答案。
  • 交互式界面:应用程序使用 Streamlit 提供交互式的聊天界面,显示用户问题和机器人回答。

📚 详细文档

结果

(此处原文档“结果”部分无具体内容,若有可补充详细信息)

READY-TO-PASTE CONFIG

MCP client config generator

Choose your client, fill the required environment variables, then copy a config generated from this server's published metadata

terminal
data_object

This entry does not contain a standard command or remote URL, so a safe client config cannot be generated automatically

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client