Token导航 LogoToken导航TokenDH.com
Ragify Docs API MCP Server logo
文档知识stdio官方级别未说明来源级核验

Ragify Docs API MCP Server

MCP Server

RAGify Docs 是一个开发者工具,通过结合网页抓取、向量嵌入和AI问答技术,帮助开发者快速导航和理解文档内容。

工具数

1

提示词数

0

GitHub Stars

1

资源数

0
文档处理检索增强生成PythonClaude开发工具Claude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

codewithyasho

提供方

codewithyasho

最后核验

2026/5/17 20:19

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

python -m venv .venv

详细介绍

📚 RAGuify Docs API和MCP服务器

交互式文档开发工具

递归地抓取整个文档,并使用检索增强生成(RAG)提出基于人工智能的问题

Python FastAPI LangChain Groq MCP

______________________________________________________________________

🎯 概述

RAGify文档 是一个综合工具,通过结合网络抓取、矢量嵌入和人工智能问答,帮助开发人员快速浏览和理解文档。RAGify只需提供一个URL并提问,而不是手动阅读文档——RAGify将找到由实际文档内容支持的最相关答案。

✨ 主要特点

  • 🕷️ 递归Web抓取 -自动遍历和提取整个文档网站的内容
  • 🧠 矢量嵌入 -使用HuggingFace模型将文档转换为语义嵌入
  • 🎯 智能检索 -使用最大边际相关性(MMR)来获取多样化和相关的上下文
  • 🤖 AI驱动的答案 -利用Groq的快速语言模型进行准确响应
  • 智能高速缓存 -在同一文档的多个查询中重用嵌入
  • 🔌 多个接口 -通过REST API、MCP服务器或直接Python模块访问
  • 📍 来源归属 -获取用于回答您问题的确切文档页面的链接
  • 🚀 生产就绪 -内置FastAPI和异步支持,可扩展部署

______________________________________________________________________

🏗️ 项目结构

RAGify-Docs-API/
├── main.py              # Core RAG engine - documentation scraping & question answering
├── app.py               # FastAPI REST API server
├── mcp_server.py        # MCP (Model Context Protocol) server for Claude/AI integrations
├── pyproject.toml       # Project metadata and dependencies
├── requirements.txt     # Python package requirements
└── README.md            # This file

组件体系结构

┌─────────────────────────────────────────────────────────┐
│                    RAGify Docs API                      │
├─────────────────────────────────────────────────────────┤
│                                                         │
│  ┌──────────────┐  ┌──────────────┐  ┌─────────────┐  │
│  │  FastAPI     │  │  MCP Server  │  │   Python    │  │
│  │  (/ragify)   │  │ (ask_docs)   │  │   Module    │  │
│  └──────┬───────┘  └──────┬───────┘  └──────┬──────┘  │
│         │                 │                  │         │
│         └─────────────────┼──────────────────┘         │
│                           │                           │
│                    ┌──────▼───────┐                   │
│                    │   main.py    │                   │
│                    │  (RAG Core)  │                   │
│                    └──────┬───────┘                   │
│                           │                           │
│         ┌─────────────────┼─────────────────┐         │
│         │                 │                 │         │
│    ┌────▼────┐      ┌─────▼──────┐   ┌────▼─────┐  │
│    │ Scraper │      │ Embeddings │   │    LLM   │  │
│    │ (URL)   │      │  (HF)      │   │  (Groq) │  │
│    └────┬────┘      └─────┬──────┘   └────┬─────┘  │
│         │                 │                │       │
│         └─────────────────┼────────────────┘       │
│                           │                        │
│                    ┌──────▼────────┐              │
│                    │ Cache Storage │              │
│                    │    (In-Mem)   │              │
│                    └───────────────┘              │
│                                                   │
└─────────────────────────────────────────────────────┘

______________________________________________________________________

🚀 安装

先决条件

  • Python 3.12+
  • pip或uv包管理器
  • Groq的API密钥(可选选项:本地使用Ollama)

设置步骤

  1. 克隆存储库
   git clone 
   cd RAGify-Docs-API
  1. 创建虚拟环境
   python -m venv .venv
   .venv\Scripts\activate  # Windows
   # or
   source .venv/bin/activate  # macOS/Linux
  1. 安装依赖项
   pip install -r requirements.txt
   # or using uv
   uv sync
  1. 创建一个 .env 文件 (可选-适用于API密钥)
   GROQ_API_KEY=your_groq_api_key_here

______________________________________________________________________

📖 用法

选项1:FastAPI REST API

启动服务器:

uvicorn app:app --reload --host 0.0.0.0 --port 8000

提出请求:

curl -X POST "http://localhost:8000/ragify" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://docs.langchain.com/oss/python/langchain/overview",
    "query": "What is LangChain?"
  }'

Python示例:

import requests

response = requests.post(
    "http://localhost:8000/ragify",
    json={
        "url": "https://docs.python.org/3/",
        "query": "How do I create a list?"
    }
)

print(response.json())
# {
#     "answer": "...",
#     "sources": ["https://docs.python.org/3/..."]
# }

API文件:

  • 交互式文档: http://localhost:8000/docs (Swagger用户界面)
  • 重新记录: http://localhost:8000/redoc

______________________________________________________________________

选项2:MCP服务器

启动MCP服务器:

python mcp_server.py

默认配置:

  • 主持人: 0.0.0.0
  • 端口: 8000 (或从 PORT env变量)
  • 传输:HTTP流式传输

______________________________________________________________________

选项3:直接Python模块

在你自己的Python代码中使用RAGify:

from main import main

# Initialize RAG for a documentation URL
rag_chain = main("https://docs.langchain.com/oss/python/langchain/overview")

# Ask questions
response = rag_chain.invoke({
    "input": "What is a retriever in LangChain?"
})

print(response["answer"])
print(response["context"])  # List of source documents

______________________________________________________________________

🔑 配置

环境变量

# Groq API Configuration
GROQ_API_KEY=your_key_here
GROQ_MODEL=openai/gpt-oss-120b

# Or use Ollama instead of Groq (local inference)
# Uncomment in main.py: llm = ChatOllama(model="your-model")

# MCP Server Port
PORT=8000

定制在 main.py

块大小和重叠:

text_splitter = RecursiveCharacterTextSplitter(
    chunk_size=1000,      # Increase for longer contexts
    chunk_overlap=200     # Increase for better continuity
)

嵌入模型:

embeddings = HuggingFaceEmbeddings(
    model_name="sentence-transformers/all-MiniLM-L6-v2"
    # Or use: "all-mpnet-base-v2" (larger, more accurate)
)

检索参数:

retriever = vector_store.as_retriever(
    search_type="mmr",
    search_kwargs={
        "k": 5,           # Number of results to return
        "fetch_k": 10,    # Candidates to consider
        "lambda_mult": 0.5 # Balances similarity vs diversity
    }
)

LLM选择:

# Use Groq (fast, requires API key)
llm = ChatGroq(model="openai/gpt-oss-120b", temperature=0.2)

# OR use Ollama locally (no API key needed)
# llm = ChatOllama(model="llama2", temperature=0.2)

______________________________________________________________________

📋 API 参考

FastAPI端点

POST /ragify

问一个关于文档的问题。

请求:

{
  "url": "https://docs.example.com",
  "query": "How do I get started?"
}

答复:

{
  "answer": "To get started with Example...",
  "sources": [
    "https://docs.example.com/getting-started",
    "https://docs.example.com/installation"
  ]
}

状态代码:

  • 200 -成功
  • 500 -RAG初始化或调用错误

______________________________________________________________________

GET /

健康检查和欢迎信息。

答复:

{
  "message": "Welcome to the RAGify Docs API! Use the /ragify endpoint to ask questions about documentation."
}

______________________________________________________________________

MCP工具: ask_docs

可通过MCP客户端(Claude等)访问

参数:

  • url (string):要抓取的文档URL
  • query (string):要问的问题

退货:

{
  "answer": "...",
  "sources": ["url1", "url2"]
}

或者出错:

{
  "error": "Error message"
}

______________________________________________________________________

🚀 部署

Docker(可选)

FROM python:3.12-slim

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

EXPOSE 8000

CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]

构建并运行:

docker build -t ragify-docs-api .
docker run -p 8000:8000 -e GROQ_API_KEY=your_key ragify-docs-api

______________________________________________________________________

内置于❤️ 适合喜欢优秀文档的开发人员

⭐ 如果你觉得这很有用,请在存储库中加星!

目录标签

目录标签

文档处理检索增强生成PythonClaude开发工具本地部署AI问答开发者工具文档解析

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

api-key

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

1

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdioapi-key部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP