rag-mcp — Claude Code MCP server: search local files
The rag-mcp MCP server for Claude Code searches selected files and folders. It retrieves passages by exact terms or meaning, then can answer questions from that material.
MIT ★ 9 updated 2026-11-15
claude mcp add rag-mcp -e OPENROUTER_API_KEY=<OPENROUTER_API_KEY> -- uvx ragmcp-cliWhat rag-mcp does
rag-mcp searches local files within a chosen scope and returns passages relevant to a question. BM25 handles exact-term retrieval; semantic search uses embeddings, and a separate model can rerank results. The MCP server can also produce answers grounded in the retrieved material.
Exact-term search needs no account or API key. Semantic retrieval requires a selected embedding provider; written answers can use a Codex session with a ChatGPT plan or an OpenRouter key. With OPENROUTER_API_KEY set, OpenRouter also receives the query and retrieved passages for reranking, which is enabled automatically. Source files and the index stay local.
What it helps with
- find relevant passages in a selected folder
- retrieve material by meaning when wording differs
- draft an answer from local documents
Example prompts for the agent
- Find information about upload limits in
./docsand answer from those files. - Search
./docsfor material describing changes to the requirements. - Find the file-retention period after account closure in
./docs.
How to install rag-mcp
Platform CLI
claude mcp add rag-mcp -e OPENROUTER_API_KEY=<OPENROUTER_API_KEY> -- uvx ragmcp-cliReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from ragmcp-cli <command>
Platform CLI
codex mcp add rag-mcp --env OPENROUTER_API_KEY=<OPENROUTER_API_KEY> -- uvx ragmcp-cliReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from ragmcp-cli <command>
Config file
{
"mcpServers": {
"rag-mcp": {
"command": "uvx",
"args": [
"ragmcp-cli"
],
"env": {
"OPENROUTER_API_KEY": "<OPENROUTER_API_KEY>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from ragmcp-cli <command>
Config file
{
"servers": {
"rag-mcp": {
"type": "stdio",
"command": "uvx",
"args": [
"ragmcp-cli"
],
"env": {
"OPENROUTER_API_KEY": "<OPENROUTER_API_KEY>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from ragmcp-cli <command>
Platform CLI
gemini mcp add -e OPENROUTER_API_KEY=<OPENROUTER_API_KEY> rag-mcp uvx ragmcp-cliReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from ragmcp-cli <command>
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about rag-mcp
How do I install rag-mcp in Claude Code?
Run claude mcp add rag-mcp -e OPENROUTER_API_KEY=<OPENROUTER_API_KEY> -- uvx ragmcp-cli. This registers the MCP server with an OpenRouter key.
What does rag-mcp do?
It searches scoped local files and folders using exact terms or semantic retrieval. The retrieved passages can support answers to questions about those documents.
What does rag-mcp need to run?
Exact-term search works without an account or key. Semantic retrieval needs a chosen embedding provider; written answers use either Codex signed in with codex login and a ChatGPT plan, or an OpenRouter key.