RAG-Anything MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@RAG-Anything MCP ServerFind all documents mentioning RAG techniques"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
๐ RAG-Anything MCP Server
A powerful Model Context Protocol (MCP) server that exposes RAG-Anything capabilities, enabling any MCP-compatible application to perform advanced multi-modal document processing and retrieval.
๐ Features
๐ Multi-format Document Processing: PDF, Office documents, images, text files
๐ Intelligent RAG Queries: Text and multimodal query support
๐ง Knowledge Graph Integration: Powered by LightRAG
๐ผ๏ธ Vision Language Model: Analyze images, tables, and equations
๐ MCP Protocol: Standardized interface for any client application
โก Async Operations: High-performance async processing
Related MCP server: MCP-RAGAnything
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ MCP Clients โ
โ (VS Code, Claude Desktop, Custom Apps, etc.) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
MCP Protocol
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ RAG-Anything MCP Server โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Document Processing Tools โ โ
โ โ - upload_document โ โ
โ โ - process_document โ โ
โ โ - batch_process โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Query Tools โ โ
โ โ - query_text โ โ
โ โ - query_multimodal โ โ
โ โ - query_with_context โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Management Tools โ โ
โ โ - list_documents โ โ
โ โ - get_document_info โ โ
โ โ - delete_document โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ RAG-Anything Core โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โ โ MinerU โ โ LightRAG โ โ VLM โ โ
โ โ Parser โ โ Knowledge โ โ Analysis โ โ
โ โ โ โ Graph โ โ โ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ๐ Quick Start
Installation
# Clone repository
git clone <your-repo-url>
cd twin-editor-rag
# Install dependencies
pip install -e .
# Or with development dependencies
pip install -e ".[dev]"Configuration
Create a .env file:
# API Configuration
OPENAI_API_KEY=your_openai_api_key
OPENAI_BASE_URL=https://api.openai.com/v1 # Optional
# Model Configuration
LLM_MODEL=gpt-4o-mini
VISION_MODEL=gpt-4o
EMBEDDING_MODEL=text-embedding-3-large
EMBEDDING_DIM=3072
# Model Profile Configuration (optional)
MODEL_PROFILE=openai_default
MODEL_PROFILES_PATH=./model_profiles.json
# Or set MODEL_PROFILES to a JSON object string with profile definitions
# Storage Configuration
RAG_STORAGE_DIR=./rag_storage
UPLOAD_DIR=./uploads
MAX_FILE_SIZE=100 # MB
# Server Configuration
LOG_LEVEL=INFOModel profiles let you switch the entire model set with a single env var. If
MODEL_PROFILE is set, it overrides LLM_MODEL, VISION_MODEL,
EMBEDDING_MODEL, and EMBEDDING_DIM using either MODEL_PROFILES (JSON
string) or MODEL_PROFILES_PATH (JSON file, defaults to
./model_profiles.json).
Running the Server
# Start MCP server
python src/server.py
# Or use with specific config
python src/server.py --config config.jsonUsing with MCP Clients
VS Code (with MCP Extension)
Add to your VS Code settings:
{
"mcp.servers": {
"rag-anything": {
"command": "python",
"args": ["/path/to/twin-editor-rag/src/server.py"],
"env": {
"OPENAI_API_KEY": "your_key"
}
}
}
}Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"rag-anything": {
"command": "python",
"args": ["/path/to/twin-editor-rag/src/server.py"],
"env": {
"OPENAI_API_KEY": "your_key"
}
}
}
}๐ Available Tools
Document Processing
upload_document
Upload a document file to the server.
# Parameters:
- file_path: str - Path to document file
- doc_id: Optional[str] - Custom document ID
# Returns:
- doc_id: str - Document identifier
- status: str - Upload statusprocess_document
Process an uploaded document with RAG-Anything.
# Parameters:
- doc_id: str - Document identifier
- parser: Optional[str] - Parser to use (mineru/docling)
- parse_method: Optional[str] - Parse method (auto/ocr/txt)
# Returns:
- doc_id: str
- status: str
- stats: dict - Processing statisticsbatch_process_documents
Process multiple documents in batch.
# Parameters:
- file_paths: List[str] - List of file paths
- max_concurrent: Optional[int] - Max parallel processing
# Returns:
- results: List[dict] - Processing resultsQuery Operations
query_text
Query the RAG system with text.
# Parameters:
- query: str - Query text
- mode: str - Query mode (hybrid/local/global/naive)
- top_k: Optional[int] - Number of results
# Returns:
- answer: str - RAG answer
- sources: List[dict] - Source documentsquery_multimodal
Query with multimodal content (images, tables, equations).
# Parameters:
- query: str - Query text
- multimodal_content: List[dict] - Multimodal content
- mode: str - Query mode
# Returns:
- answer: str - RAG answer with multimodal understandingManagement
list_documents
List all processed documents.
# Returns:
- documents: List[dict] - Document list with metadataget_document_info
Get detailed information about a document.
# Parameters:
- doc_id: str - Document identifier
# Returns:
- doc_info: dict - Detailed document informationdelete_document
Remove a document from the system.
# Parameters:
- doc_id: str - Document identifier
# Returns:
- status: str - Deletion status๐ง Advanced Configuration
Custom RAG Configuration
# config.json
{
"rag_config": {
"enable_image_processing": true,
"enable_table_processing": true,
"enable_equation_processing": true,
"context_window": 2,
"max_context_tokens": 3000
},
"parser_config": {
"default_parser": "mineru",
"default_parse_method": "auto"
}
}LLM Provider Configuration
Supports multiple providers:
OpenAI
Azure OpenAI
Anthropic (Claude)
Local models (LM Studio, Ollama)
๐ Examples
Example 1: Process and Query Documents
# Using MCP client
import mcp
client = mcp.Client("rag-anything")
# Upload and process
result = await client.call_tool("upload_document", {
"file_path": "./research_paper.pdf"
})
doc_id = result["doc_id"]
await client.call_tool("process_document", {
"doc_id": doc_id
})
# Query
answer = await client.call_tool("query_text", {
"query": "What are the main findings?",
"mode": "hybrid"
})
print(answer["answer"])Example 2: Multimodal Query
# Query with table data
result = await client.call_tool("query_multimodal", {
"query": "Compare these metrics with document content",
"multimodal_content": [{
"type": "table",
"table_data": "Method,Accuracy\nRAG,95.2%\nBaseline,87.3%",
"table_caption": "Performance Comparison"
}],
"mode": "hybrid"
})๐งช Testing
# Run tests
pytest tests/
# Run with coverage
pytest --cov=src tests/
# Test specific functionality
pytest tests/test_tools.py -v๐ค Contributing
Contributions welcome! Please:
Fork the repository
Create a feature branch
Add tests for new features
Submit a pull request
๐ License
MIT License - See LICENSE file for details
๐ Related Projects
RAG-Anything - Core RAG framework
LightRAG - Knowledge graph RAG
MCP - Model Context Protocol
โญ Star History
If you find this useful, please star the repo!
๐ Deployment to Render.com
Prerequisites
Render Account: Sign up at render.com
OpenAI API Key: Get your key from OpenAI Platform
Git Repository: Push your code to GitHub/GitLab
Option 1: Deploy with render.yaml (Recommended)
Connect Repository: Link your GitHub/GitLab repo to Render
Set Environment Variables: In Render dashboard, add:
OPENAI_API_KEY: Your OpenAI API keyOther optional variables from
.env.example
Deploy: Render will auto-detect
render.yamland deploy
Option 2: Manual Deployment
Create New Web Service in Render Dashboard
Configure Service:
Environment: Docker
Dockerfile Path:
./DockerfileInstance Type: Standard (512 MB+ RAM recommended)
Add Disk (for persistent storage):
Name:
rag-storageMount Path:
/app/rag_storageSize: 10 GB
Set Environment Variables:
OPENAI_API_KEY=your_key_here LLM_MODEL=gpt-4o-mini VISION_MODEL=gpt-4o EMBEDDING_MODEL=text-embedding-3-largeDeploy: Click "Create Web Service"
Post-Deployment
Your MCP server will be available at:
https://your-app-name.onrender.com/mcpConnect from your MCP client using HTTP transport:
{
"servers": {
"rag-document-mcp": {
"url": "https://your-app-name.onrender.com/mcp",
"type": "http"
}
}
}Cost Estimation
Free Tier: 750 hours/month (suitable for testing)
Starter: $7/month (recommended for production)
Storage: $0.25/GB/month
๐ง Contact
For questions or support, please open an issue on GitHub.
This server cannot be installed
Maintenance
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/nguyenngocdue/RAG-MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server