
Deploy RAGFlow MCP
Expose RAGFlow datasets to AI clients over MCP
Just deployed
/data
ragflow
Just deployed
/ragflow/logs
Redis
Just deployed
/data
MySQL
Just deployed
/var/lib/mysql
Elasticsearch
Just deployed
/usr/share/elasticsearch/data
Deploy and Host self hosted RAGFlow MCP (RAG Engine as an MCP Server) on Railway
This template runs RAGFlow on Railway so MCP clients like Claude Desktop and Cursor can call ragflow_retrieval against your parsed datasets.
About Hosting RAGFlow MCP open-source software on Railway (self hosted RAGFlow as an MCP server template)
This template runs the RAGFlow stack on Railway: the ragflow service (web UI and API on port 9380), Elasticsearch for document search, MinIO for uploads, MySQL for metadata, and Redis for the task queue.
Railway provisions the five services, generates the secrets, and keeps the containers on a private network.
Why Deploy RAGFlow MCP, the LlamaIndex MCP alternative on Railway (Railway Free Trial)
LlamaIndex MCP means writing and hosting your own server, so every retrieval change is code you maintain.
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying RAGFlow MCP on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Railway vs Other Hosting Providers and VPS for RAGFlow MCP self hosting
Railway gets RAGFlow MCP live fast, while a VPS gives you more control over Elasticsearch and the host.
| Provider | What You Get with Railway | What You Get with the Other Provider |
|---|---|---|
| DigitalOcean | All five services deploy with public HTTPS and no Compose setup. | You manage a Droplet, set vm.max_map_count to 262144, and handle TLS. |
| AWS | A public domain and generated secrets, with no VPC to configure. | Fine-grained networking, but more setup to maintain. |
| Hetzner | Managed restarts and volumes without monitoring the box yourself. | Lower cost per GB of RAM and disk for this memory-heavy stack. |
Railway suits a team that wants MCP clients running this week.
Common Use Cases for hosted RAGFlow MCP
- Searching company docs from an MCP client: Point Claude Desktop or Cursor at your endpoint as a Streamable HTTP server, and the client can call
ragflow_retrievalon your parsed datasets. You get cited chunks back instead of pasting files into chat. - Listing datasets and chats from an agent: An agent can call
ragflow_list_datasetsandragflow_list_chatsto see what exists before it searches. - Per-user keys in host mode: Each client uses its own RAGFlow API key, so retrieval runs as that user and only reaches datasets their account can access.
- One shared identity in self-host mode: Every client acts as the user behind
RAGFLOW_MCP_HOST_API_KEY. That suits a small team, but anyone who can reach the port shares the identity, so firewall it. - Scripted retrieval checks with curl: Run
initialize,tools/list, andtools/callwith curl to confirm the key and dataset work before you wire up a client. Each POST is stateless, so a failure shows which step broke.
Dependencies for RAGFlow MCP Docker hosted on Railway
This template runs five services, and the MCP route lives in the ragflow service on port 9380.
Deployment Dependencies for Managed RAGFlow MCP Service (RAG Engine)
- ragflow: RAGFlow image with nginx, web UI, API on 9380, admin server on 9381, and task executor. Public port 80, logs at
/ragflow/logs, health check at/api/v1/system/healthz. - Elasticsearch 8.11.3: document engine, single node, 1 GB heap, data at
/usr/share/elasticsearch/data. - MinIO (pgsty/silo): S3-compatible file store, volume at
/data. - MySQL 8.4.11: database
rag_flow, volume at/var/lib/mysql. - Redis 8.2.10: task queue and caches, volume at
/data.
Keep RAGFLOW_SECRET_KEY stable across redeploys, since it signs sessions and API tokens.
Implementation Details for RAGFlow MCP (Using RAGFlow official docker image)
The fixed settings are DOC_ENGINE=elasticsearch, DB_TYPE=mysql, DEVICE=cpu, API_PROXY_SCHEME=python, USE_DOCLING=false, and TZ=UTC. REGISTER_ENABLED starts at 1 so you can create the first account, then set it to 0.
How does RAGFlow MCP compare against other ways to give AI clients your documents over MCP
RAGFlow MCP vs LlamaIndex MCP (LlamaIndex MCP Alternative)
- Where RAGFlow fits: The MCP route ships inside the Go API server, so Claude Desktop or Cursor can call
ragflow_retrievalon parsed datasets with no separate MCP process. - Where LlamaIndex wins: It's a framework you code against, so you control loading, indexing, and tool design in ways RAGFlow's fixed three tools don't allow.
- Ingestion trade-off: RAGFlow's DeepDoc parsing handles PDFs, scans, and tables through the UI, while LlamaIndex expects you to wire up your own loaders.
RAGFlow MCP vs Dify (Dify MCP Alternative)
- Where RAGFlow fits: It's built around retrieval quality, with hybrid search, rerank, and citations, exposed directly over MCP.
- Where Dify wins: It's a full LLM app platform with a visual workflow builder, so you can build the chatbot and its logic in one place.
- License note: RAGFlow is Apache-2.0, while Dify uses a modified Apache license with extra conditions, which matters if you plan to redistribute.
RAGFlow MCP vs Onyx (Onyx MCP Alternative)
- Where RAGFlow fits: It works from documents you upload and parse yourself, which suits a focused knowledge base you control end to end.
- Where Onyx wins: Its many prebuilt connectors sync SaaS content automatically, so it has broader reach if your content lives across many tools.
- Licensing: Onyx has an MIT core with a separate enterprise edition, so check which features you need.
RAGFlow MCP vs AnythingLLM (AnythingLLM MCP Alternative)
- Where RAGFlow fits: DeepDoc parsing, chunk inspection, and a retrieval endpoint MCP clients can call directly make it the choice when retrieval quality matters most.
- Where AnythingLLM wins: It's simpler to start, as a desktop app or single Docker container with chat over documents, so it's faster for a solo user.
- Footprint: AnythingLLM is MIT licensed and light to run, while RAGFlow with Elasticsearch, MySQL, and DeepDoc models needs several GB of RAM.
How to use RAGFlow MCP (the OSS RAG engine)?
- Open your domain, register the first account, then set
REGISTER_ENABLED=0in Railway. - Add a model provider, create a dataset, upload files, and parse them.
- Click your avatar, open API, and copy a RAGFlow API key.
- Send
initializeandtools/listtohttps://your-domain/api/v1/mcpwith the Bearer key. - Call
ragflow_retrievalonce with curl to confirm chunks come back. - Add the endpoint to your MCP client as a Streamable HTTP server.
curl -X POST https://your-domain/api/v1/mcp \
-H "Authorization: Bearer YOUR_RAGFLOW_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"smoke","version":"0.1"}}}'
curl -X POST https://your-domain/api/v1/mcp \
-H "Authorization: Bearer YOUR_RAGFLOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"ragflow_retrieval","arguments":{"question":"What is our refund policy?","page_size":5}}}'
How to self host RAGFlow MCP on other VPS Services (RAGFlow self hosting guide)
This walkthrough runs the RAGFlow stack on your own Linux VPS so MCP clients can reach it.
Clone the Repository
Clone the upstream repo and set a kernel value that Elasticsearch requires.
git clone https://github.com/infiniflow/ragflow
cd ragflow/docker
sudo sysctl -w vm.max_map_count=262144
Install Dependencies
You need Docker 24 or newer with the Compose plugin, plus at least 4 CPU cores, 16 GB RAM, and 50 GB disk.
Configure Environment Variables
In docker/.env, set your passwords and turn on the MCP listener. Use self-host mode with a real key, since startup fails without one.
RAGFLOW_MCP_ENABLED=true
RAGFLOW_MCP_HOST=0.0.0.0
RAGFLOW_MCP_LAUNCH_MODE=self-host
RAGFLOW_MCP_HOST_API_KEY=your-api-key
Start the RAGFlow MCP Application
Bring the stack up, then test the built-in route with a tools/list call to https://your-domain/api/v1/mcp using your Bearer key.
Official Pricing of RAGFlow MCP (RAGFlow pricing)
RAGFlow is open source under Apache-2.0, so the software itself costs nothing to run.
RAGFlow MCP cloud vs self hosted comparison (Pricing, features, costs, and more)
Self hosting RAGFlow MCP trades a managed Railway deploy's convenience for cost control and more ops work.
Monthly cost of self hosting RAGFlow MCP on Railway
Expect roughly $40-80 per month on Railway, because Elasticsearch, MySQL, and the RAGFlow container with its DeepDoc models each want several gigabytes of RAM.
System Requirements for Hosting RAGFlow MCP on a VPS
Upstream RAGFlow lists 4 CPU cores, 16 GB RAM, 50 GB disk, and Docker 24 or newer as minimums.
Frequently Asked Questions (FAQs)
Do I need the 9382 listener, or is there a built-in route?
Most setups don't need the listener.
What's the difference between host and self-host mode?
In host mode each client authenticates with its own API key and acts as that user.
Which tools does the server expose?
The built-in route offers ragflow_retrieval, ragflow_list_datasets, and ragflow_list_chats.
Are there timeouts or page limits?
Calls time out after 60 seconds on the server.
Does it support SSE?
The built-in /api/v1/mcp route uses Streamable HTTP with JSON responses and no SSE.
How do I secure the key?
Keep the RAGFlow API key in environment variables, never in committed config files.
Template Content
ragflow
infiniflow/ragflow:v0.27.2Redis
redis:8.2.10MySQL
mysql:8.4.11Elasticsearch
elasticsearch:8.11.3
