Skip to main content

Add to Cursor Add to VS Code Add to Claude Add to ChatGPT Add to Codex Add to Gemini

MCP RAG 工具集

基于模型上下文协议(MCP)的智能知识库系统,提供文档处理、知识问答和向量库管理功能。

支持使用豆包与OpenAI

✨ 主要特性

  • 🧠 智能知识库:基于向量检索的 RAG 系统,支持语义搜索和智能问答
  • 📄 多格式文档处理:支持超过 25 种文档格式,包括 PDF、DOCX、PPTX、XLSX、图片、邮件等
  • 🌐 直观 Web 界面:Bento 风格布局,分类展示所有工具功能
  • 🤖 多模型支持:兼容 OpenAI、豆包、Ollama 等主流 AI 模型
  • 🔍 高级过滤搜索:支持按文件类型、内容结构等条件进行精确检索
  • 📊 统计分析:提供知识库统计、嵌入缓存分析等数据洞察
  • ⚡ 本地化处理:支持本地模型推理,保护数据隐私
  • 🔧 向量库管理:提供缓存清理、数据库优化等维护功能

安装

# 安装工具
uv tool install mcp_rag

# 升级工具
uv tool install mcp_rag --upgrade

# 卸载工具
uv tool uninstall mcp_rag

使用

启动 MCP 服务器

mcp_rag server

启动 Web 界面

mcp_rag web

Web 界面提供直观的 Bento 布局,支持以下工具分类:

  • 📥 添加内容:添加文本和文档到知识库
  • ❓ 智能问答:基于知识库进行问答和检索
  • 📊 数据统计:查看知识库和系统统计信息
  • ⚙️ 向量库管理:优化和维护向量数据库

配置

在项目根目录创建 .env 文件进行配置:

# OpenAI 配置
OPENAI_API_KEY=
OPENAI_API_BASE=https://api.openai.com/v1
OPENAI_MODEL=gpt-4o-mini
OPENAI_TEMPERATURE=0
OPENAI_EMBEDDING_MODEL=text-embedding-3-large

# 豆包 配置
# OPENAI_API_KEY=
# OPENAI_API_BASE=https://ark.cn-beijing.volces.com/api/v3
# OPENAI_MODEL=doubao-1-5-pro-32k-250115
# OPENAI_TEMPERATURE=0
# OPENAI_EMBEDDING_MODEL=doubao-embedding-text-240715

mcp客户端配置(豆包为例)

{
    "mcpServers": {
        "rag": {
            "command": "uv",
            "args": [
                "run",
                "mcp-rag",
                "serve"
            ],
            "env": {
                "PYTHONUNBUFFERED": "1",

                "OPENAI_API_KEY": "key",
                "OPENAI_API_BASE": "https://ark.cn-beijing.volces.com/api/v3",
                "OPENAI_MODEL": "doubao-1-5-pro-32k-250115",
                "OPENAI_TEMPERATURE": "0",

                "OPENAI_EMBEDDING_MODEL": "doubao-embedding-text-240715",
            }
        }
    }
}

可用工具

添加内容

  • learn_text(text, source_name) - 添加文本到知识库
  • learn_document(file_path) - 处理并添加文档到知识库

智能问答

  • ask_rag(query) - 基于知识库回答问题
  • ask_rag_filtered(query, file_type, min_tables, min_titles, processing_method) - 带过滤条件的智能检索

支持格式

支持超过 25 种文档格式,包括 PDF、DOCX、PPTX、XLSX、图片、邮件等。

Metadata

Release files for mcp-rag-fastmcp 0.3.17

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-rag-fastmcp 0.3.17
File Size Uploaded
mcp_rag_fastmcp-0.3.17.tar.gz 36.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-rag-fastmcp 0.3.17
File Interpreter ABI Platform
mcp_rag_fastmcp-0.3.17-py3-none-any.whl Python 3 none any Details

Total release size: 77.4 kB

Release files / mcp_rag_fastmcp-0.3.17.tar.gz

Download URL mcp_rag_fastmcp-0.3.17.tar.gz
Size 36.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1dfb1c2a88ef89972acc60d57c0966efe690c26935095c4ed78fb6e042976c5d
BLAKE2b-256 checksum
How to use checksums
6853e7a241e202bce256eb70ece59ee3cde7acdcb2626ddf5ab92b3cda42216b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.22

Release files / mcp_rag_fastmcp-0.3.17-py3-none-any.whl

Download URL mcp_rag_fastmcp-0.3.17-py3-none-any.whl
Size 41.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc532fd3460fd71a1f32e46607e74505e026056b0168958c62385be41e145d59
BLAKE2b-256 checksum
How to use checksums
cc08bb7f2f24a97d7cf0d8aa8ba9a51b231296aa2db01c708d966da5793c6e83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.22

Release history Release notifications | RSS feed

This release

0.3.17 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page