rag-mcp-server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
rag-mcp-server
Your documents and knowledge graph as tools that any AI assistant can call, over the Model Context Protocol.
The client (Claude Desktop, Claude Code, an IDE, or your own agent) decides when to search passages, when to walk the graph, and when to inspect an entity. This server only retrieves. It returns cited evidence (document, page, section, or ordered fact chains) and never answers on the model's behalf.
tool | backed by | returns |
| layout-rag: hybrid dense + BM25, optional local cross-encoder | chunks with document, 1-based pages, section path |
| graphwalk-rag: bidirectional meet-in-the-middle | anchors and the best ordered fact chains with sources |
| graphwalk-rag: document-routed walk | routed documents, fact chains, (document, page) evidence |
| the graph store | type, description, degree, hub flag, relations with sources |
| this server | configured backends, per-tool p50/p95 latency |
Run it
pip install "rag-mcp-server @ git+https://github.com/gopalsharma1615-ai/rag-mcp-server"
layout-rag ingest docs/*.pdf --index ./index # documents (see layout-rag)
graphwalk-rag build docs/ --workdir ./graph # graph (see graphwalk-rag; price it with --dry-run)
export LAYOUT_RAG_INDEX=./index GRAPH_WORKDIR=./graph
export GRAPH_EMBED_MODEL=text-embedding-3-small # the model that embedded the graph
export LLM_MODEL=gpt-4o-mini # keyword extraction for the walks (or LLM_BASE_URL for vLLM)
claude mcp add rag-tools -- rag-mcp-server # Claude Code (stdio)
rag-mcp-server --http 8765 # or streamable HTTP for remote clientsClaude Desktop (claude_desktop_config.json):
{"mcpServers": {"rag-tools": {"command": "rag-mcp-server",
"env": {"LAYOUT_RAG_INDEX": "/path/index", "GRAPH_WORKDIR": "/path/graph"}}}}Either backend is optional. Without GRAPH_WORKDIR only search_documents works, and vice versa. Indexes and
models load lazily on first use.
Related MCP server: Provenance-Aware Retrieval MCP Server
Measured latency
Warm latency on a CPU-only VM (8 threads), per tool call, from python bench/latency.py:
tool | setting | p50 | p95 |
| hybrid, bge-large-en-v1.5, no rerank | 0.11 s | 0.12 s |
| + | 39.7 s | 41.2 s |
| + | 58.6 s | 61.6 s |
| 52,474-node graph | < 1 ms | < 1 ms |
These measurements drove a design decision: reranking is opt-in (rerank=False by default, pool set by
RAG_RERANK_POOL, default 20). A 568M-parameter cross-encoder over 512-token chunks is impractical on CPU for an
interactive tool: even 20 candidates take about 40 s. Use a GPU, a smaller cross-encoder (RAG_RERANKER), or leave it off. The graph tools'
latency is dominated by the keyword-extraction LLM call and query embedding, not by the walk itself: the
traversal takes milliseconds (see graphwalk-rag).
Evaluation plan
The agent-vs-pipeline comparison is planned and not yet run: an LLM client choosing these tools vs a fixed single-pass pipeline on HotpotQA multi-hop, measuring answer accuracy, tool-selection accuracy, calls per question, latency and $/question. It will live in research-agent.
Development
pip install -e ".[dev]" && pytest -q # tool tests on a tiny index + graph, and a real stdio round-tripMIT licence. Built by Gopal Sharma.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Cross-tool persistent memory and context for AI assistants over MCP.
Stateless agentic tools over MCP: concept extraction, long-context, knowledge graph, planning.
Read-only MCP tools for AI agent discovery, structured resources, and NIULAI information.
Search, vet & assemble MCP servers from your agent: verified tools, risk labels, and trust scores.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to query documents in a Bedrock Knowledge Base through the MCP protocol, with tools for semantic search and agentic retrieval.MIT
- FlicenseNot gradedqualityDmaintenanceExposes a provenance-aware knowledge graph to AI agents over MCP, providing tools like get_fact and search_documents that return precise answers with source citations.1-
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to perform retrieval-augmented generation with hybrid search, reranking, multi-modal image processing, and RAG evaluation through standardized MCP tools.MIT
- FlicenseBqualityBmaintenanceEnables AI agents to query an air-gapped enterprise knowledge vault via seven MCP tools for deterministic and hybrid retrieval, entity graph traversal, context compression, archive inspection, onboarding scans, and node status.7-