mcp-raganything
API/MCP wrapper for RagAnything
claude mcp add --transport stdio kaiohz-mcp-raganything uv run --directory /absolute/path/to/mcp-raganything python -m src.main \ --env MCP_TRANSPORT="stdio"
How to use
This MCP server exposes a Claude Desktop integrated MCP endpoint for querying a RAG-based knowledge base built on top of the RAG-Anything stack. It provides a REST API via FastAPI for indexing and querying content, plus an MCP tool named query_knowledge_base that Claude Desktop can call to search the RAG knowledge base. The LightRAG proxy is wired in to forward queries and perform knowledge graph operations through the LightRAG server. Typical usage involves indexing a corpus (via file/index or folder/index), then querying the knowledge base through the MCP interface, or directly via the LightRAG proxy endpoints. The Claude integration exposes a tool configuration named query_knowledge_base with parameters for query text, mode, top_k, and a flag to return only context. This enables you to run structured information retrieval from your indexed documents and retrieve relevant chunks for downstream LLM use.
How to install
Prerequisites:
- Python 3.13+
- Docker & Docker Compose (recommended for quick start)
- An OpenRouter API Key
- Claude Desktop (for MCP server integration) if you plan to use the Claude Desktop workflow
Installation steps:
-
Clone the repository: git clone https://github.com/Kaiohz/mcp-raganything.git cd mcp-raganything
-
Install dependencies and run locally (via uv):
- Ensure you have uv installed (e.g., using uvx): pipx install uvx
- Install project dependencies and set up environment files as described in the README:
Copy example env files
cp .env.example .env cp .env.lightrag.server.example .env.lightrag.serverEdit .env and .env.lightrag.server to provide OPEN_ROUTER_API_KEY, LLM keys, etc.
-
Start services for development (optional Docker-based quick start): docker-compose up -d
Verify containers are up and healthy
-
Run the MCP server locally (per Claude Desktop integration): uv run --directory /absolute/path/to/mcp-raganything python -m src.main
This starts the MCP server with stdio transport for Claude Desktop
-
Verify the MCP server is accessible (via Claude Desktop and REST API):
- REST API health: http://localhost:8000/api/v1/health
- Claude Desktop should load the mcpServers configuration as shown in the README
Notes:
- If you use Docker Compose, ensure environment files (.env, .env.lightrag.server) are properly set before bringing up services.
- The MCP server relies on a LightRAG server and a PostgreSQL backend with pgvector and Apache AGE; ensure those services are reachable as configured in the environment files.
Additional notes
Tips and common issues:
- Ensure MCP_TRANSPORT is set consistently between Claude Desktop and the MCP server (stdio is typical for local development).
- If you encounter empty results, adjust COSINE_THRESHOLD or top_k in your environment variables.
- Restart the MCP server after changing high-level configuration (e.g., API keys, database connections).
- When using Docker, 3 containers are expected: postgres, api (RAG-Anything FastAPI service), and lightrag-server. The portals are accessible at the ports shown in the README.
- The provided Claude Desktop configuration uses an absolute path to the project directory; update accordingly for your environment.
Related MCP Servers
jupyter
🪐 🔧 Model Context Protocol (MCP) Server for Jupyter.
haiku.rag
Opinionated agentic RAG powered by LanceDB, Pydantic AI, and Docling
mcp-victoriametrics
The implementation of Model Context Protocol (MCP) server for VictoriaMetrics
beemcp
BeeMCP: an unofficial Model Context Protocol (MCP) server that connects your Bee wearable lifelogger to AI via the Model Context Protocol
RiMCP_hybrid
Rimworld Coding RAG MCP server
github-second-brain
Providing tools to AI to explore github codebase like agent