RAGFlow MCP Server
Provides a comprehensive Model Context Protocol interface for RAGFlow, enabling AI models to perform semantic retrieval, manage datasets, and handle document chunks. It supports advanced features like GraphRAG and RAPTOR for sophisticated knowledge base management and natural language querying.
README
RAGFlow MCP Server
A comprehensive Model Context Protocol (MCP) server for RAGFlow that provides full API access for semantic retrieval and knowledge base management.
Features
- Semantic Retrieval: Search across datasets using natural language queries
- Dataset Management: Create, list, update, and delete datasets
- Document Management: Upload, parse, list, download, and delete documents
- Chunk Management: Add, list, update, and delete document chunks
- Chat Assistants: Create and manage chat assistants with RAG capabilities
- Session Management: Create and manage chat sessions
- GraphRAG & RAPTOR: Build and query knowledge graphs (when supported by your RAGFlow instance)
Installation
Prerequisites
- Python 3.10+
- RAGFlow server running and accessible (v0.16.0+ for core features)
- RAGFlow API key
Note: GraphRAG and RAPTOR build APIs require RAGFlow v0.21.0 or later.
Install from source
git clone https://github.com/Juxsta/ragflow-mcp.git
cd ragflow-mcp
pip install -e .
Configure Claude Code
Add to your Claude Code MCP settings:
claude mcp add ragflow -e RAGFLOW_API_KEY=your-api-key -e RAGFLOW_URL=http://localhost:9380/api/v1 -- python -m ragflow_mcp.server
Or manually add to ~/.claude/settings.json:
{
"mcpServers": {
"ragflow": {
"command": "python",
"args": ["-m", "src.server"],
"cwd": "/path/to/ragflow-mcp",
"env": {
"RAGFLOW_API_KEY": "your-api-key",
"RAGFLOW_URL": "http://localhost:9380/api/v1"
}
}
}
}
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
RAGFLOW_API_KEY |
Yes | - | Your RAGFlow API key |
RAGFLOW_URL |
No | http://localhost:9380/api/v1 |
RAGFlow API base URL |
RAGFLOW_TIMEOUT |
No | 300 |
Request timeout in seconds |
RAGFLOW_LOG_LEVEL |
No | INFO |
Logging level |
Available Tools
Retrieval
ragflow_retrieval_tool- Semantic search across datasets
Dataset Management
ragflow_list_datasets_tool- List all datasetsragflow_create_dataset_tool- Create a new datasetragflow_update_dataset_tool- Update dataset configurationragflow_delete_dataset_tool- Delete a dataset (requires confirmation)
Document Management
ragflow_list_documents_tool- List documents in a datasetragflow_upload_document_tool- Upload a document (file path or base64)ragflow_parse_document_tool- Trigger async document parsingragflow_parse_document_sync_tool- Parse and wait for completionragflow_download_document_tool- Download document contentragflow_delete_document_tool- Delete a document (requires confirmation)ragflow_stop_parsing_tool- Cancel an active parsing job
Chunk Management
ragflow_list_chunks_tool- List chunks in a documentragflow_add_chunk_tool- Add a chunk to a documentragflow_update_chunk_tool- Update chunk content/keywordsragflow_delete_chunk_tool- Delete chunks (requires confirmation)
Chat & Sessions
ragflow_list_chats_tool- List chat assistantsragflow_create_chat_tool- Create a chat assistantragflow_update_chat_tool- Update chat configurationragflow_delete_chat_tool- Delete a chat assistant (requires confirmation)ragflow_list_sessions_tool- List sessions for a chatragflow_create_session_tool- Create a new sessionragflow_chat_tool- Send a message and get a response
GraphRAG & RAPTOR
ragflow_build_graph_tool- Build knowledge graph for a datasetragflow_graph_status_tool- Check graph construction statusragflow_get_graph_tool- Retrieve the knowledge graphragflow_delete_graph_tool- Delete a knowledge graph (requires confirmation)ragflow_build_raptor_tool- Build RAPTOR tree for a datasetragflow_raptor_status_tool- Check RAPTOR construction status
Usage Examples
Semantic Search
Query: "What is the main character's motivation?"
Dataset: your-dataset-id
Upload and Parse a Document
1. Upload: ragflow_upload_document_tool(dataset_id, file_path="/path/to/doc.pdf")
2. Parse: ragflow_parse_document_sync_tool(document_id)
3. Search: ragflow_retrieval_tool(query="your question", dataset_ids=[dataset_id])
Development
Run Tests
pip install -e ".[dev]"
pytest tests/ -v
Project Structure
ragflow-mcp/
├── src/
│ ├── __init__.py
│ ├── server.py # FastMCP server setup
│ ├── connector.py # RAGFlow API client
│ ├── config.py # Configuration management
│ ├── cache.py # LRU cache implementation
│ └── tools/
│ ├── retrieval.py # Semantic search
│ ├── datasets.py # Dataset CRUD
│ ├── documents.py # Document management
│ ├── chunks.py # Chunk management
│ ├── chat.py # Chat & sessions
│ └── graph.py # GraphRAG & RAPTOR
├── tests/
│ └── ...
├── pyproject.toml
└── README.md
Safety Features
All delete operations require explicit confirm=True parameter to prevent accidental data loss.
License
MIT License
Acknowledgments
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。