---
title: "Deploy RAGFlow MCP"
description: "Expose RAGFlow datasets to AI clients over MCP"
category: "AI/ML"
url: https://railway.com/deploy/deploy-ragflow-mcp-server
---

# Deploy RAGFlow MCP

Expose RAGFlow datasets to AI clients over MCP

**[Deploy RAGFlow MCP on Railway](https://railway.com/template/deploy-ragflow-mcp-server)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/deploy-ragflow-mcp-server/manifest.json

- **Creator:** onepush
- **Category:** AI/ML

## Template content

### MinIO

- **Image:** pgsty/silo:RELEASE.2026-08-06T00-00-00Z@sha256:29a498b24669cae1fed11c1a2fb2b3d73c68829a0a9c0b14e71b386671d38fac
- **Start command:** `/usr/bin/docker-entrypoint.sh silo server /data --address :9000 --console-address :9001`
- **Health check:** /minio/health/live

### ragflow

- **Image:** infiniflow/ragflow:v0.27.2@sha256:e6b3f1a185c0a70abb3a72e1092415df8c5c6a4fae0089545554f2936c4b27ab
- **Start command:** `/ragflow/entrypoint.sh --enable-adminserver --init-model-provider-tables`
- **Health check:** /api/v1/system/healthz
- **Public domain:** Yes

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2.10@sha256:47670742d7924adbcdb404d1288b6327815b23141969c0939b8e5d61f78c2634
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

### MySQL https://devicons.railway.app/i/mysql.svg

- **Image:** mysql:8.4.11@sha256:24989179f58856db763f418010c1169fecc944e3ec1ea7e921572d83eb070f70
- **Start command:** `docker-entrypoint.sh mysqld --innodb-use-native-aio=0 --disable-log-bin --performance_schema=0 --innodb-buffer-pool-size=1G --max-connections=1000 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-allowed-packet=1073741824`

### Elasticsearch

- **Image:** elasticsearch:8.11.3@sha256:58a3a280935d830215802322e9a0373faaacdfd646477aa7e718939c2f29292a
- **Start command:** `/bin/bash -c "rm -rf /usr/share/elasticsearch/data/lost+found; chown -R 1000:0 /usr/share/elasticsearch/data && cd /usr/share/elasticsearch && exec setpriv --reuid=1000 --regid=0 --clear-groups env HOME=/usr/share/elasticsearch /bin/tini -- /usr/local/bin/docker-entrypoint.sh eswrapper"`

## Documentation

# 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_retrieval` on 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_datasets` and `ragflow_list_chats` to 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`, and `tools/call` with 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_retrieval` on 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)?

1. Open your domain, register the first account, then set `REGISTER_ENABLED=0` in Railway.
2. Add a model provider, create a dataset, upload files, and parse them.
3. Click your avatar, open **API**, and copy a RAGFlow API key.
4. Send `initialize` and `tools/list` to `https://your-domain/api/v1/mcp` with the Bearer key.
5. Call `ragflow_retrieval` once with curl to confirm chunks come back.
6. Add the endpoint to your MCP client as a Streamable HTTP server.

```bash
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.

```bash
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.

```bash
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.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius v0.1 Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

Open this page in a browser: https://railway.com/deploy/deploy-ragflow-mcp-server
