rag
Provides semantic search and RAG over markdown documentation using Ollama for embeddings and chat.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ragquery how to set up the project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
rag
rag is a CLI tool and MCP server that turns codebases and documentation into a searchable, queryable knowledge base with vector search, RAG, and a structural knowledge graph.
Prerequisites
Minimum hardware
Component | Requirement |
RAM | 4 GB (8 GB for larger doc sets) |
CPU | Any x86-64 or ARM64, 2+ cores |
GPU | Optional. Any NVIDIA GPU with 2+ GB VRAM. CPU-only fallback is functional but slower |
Disk | 100 MB for index (scales with doc count) |
Indexing 5000 chunks: ~25s on RTX 3060, ~3min on CPU-only.
Related MCP server: mcp-docs
Install
git clone https://github.com/FrameMuse/llm-rag.git
cd llm-rag
bun installAdd shell alias:
alias rag='bun /path/to/llm-rag/scripts/cli.ts'Quick start
cd my-project
rag init # create .rag/ project scope
rag index # chunk, embed, index all files
rag mcp search "..." # search indexed content
rag mcp graph "..." # query knowledge graph
rag serve # start MCP serverCommands
Command | Description |
| Create .rag/ config, mcp.json, .gitignore |
| Chunk files, embed via Ollama, store in LanceDB |
| Start MCP server (STDIO) for current .rag/ scope |
| Build knowledge graph from code and docs |
| One-shot CLI proxy for MCP tools |
| Show index statistics |
rag mcp tools
Tool | Usage | Description |
|
| Semantic search |
|
| Knowledge graph query |
|
| Read file content |
|
| List indexed files |
|
| Print opencode.json snippet |
Project scope (.rag/)
project/
├── .rag/
│ ├── config.json # { name, embedModel, ragModel, pattern, chunks, temperature }
│ ├── mcp.json # MCP config snippet for opencode.json
│ ├── .gitignore # *
│ ├── data/
│ │ ├── lancedb/ # Vector index (generated by rag index)
│ │ └── graph.json # Knowledge graph (generated by rag index)
├── *.md
├── src/
└── ...Each project keeps its index and graph local. rag discovers .rag/ by walking up from current directory (like git).
MCP integration
Register in opencode.json:
{
"mcp": {
"my-project": {
"type": "local",
"command": ["rag", "serve"],
"cwd": "/path/to/project",
"enabled": true
}
}
}The MCP server exposes 8 tools:
Tool | Purpose |
| Vector search |
| Search graph nodes |
| Node connections |
| Core abstractions |
| Shortest path |
| List communities |
| List indexed files |
| Read file content |
Run rag mcp config from project directory to print the snippet with cwd pre-filled.
Architecture
flowchart LR
MD[.md files] --> Chunker
MD2[.ts/.js files] --> AST
AST -->|declarations| Graph
MD -->|headings + links| Graph
Chunker -->|heading split| Chunks
Chunks -->|Ollama embed| Vectors
Vectors -->|store| LanceDB
Query -->|embed| LanceDB
LanceDB -->|search| Results
Question -->|embed + search| Context
Context -->|Ollama chat| Answer
Graph -->|structural context| AnswerVector RAG: chunks embedded → vector search → top K → LLM synthesis
Knowledge graph: TS/JS AST and MD headings/links → nodes + edges → structural queries
Knowledge graph
The knowledge graph extracts structural relationships from TypeScript, JavaScript, and Markdown files:
TS/JS: functions, classes, interfaces, types, enums, imports, extends, class members
MD: headings, frontmatter titles, cross-document links
Two-tier design
Free-form — shows everything the graph knows about a topic in one report:
rag mcp graph "render"
→ Matching references + top match detail + connections + community + god rank + surprisesSubcommands — focused queries when you know what you need:
Subcommand | Description |
| Most connected core abstractions |
| List all directory-based communities |
| Show all references in a community |
| Cross-community surprising connections |
| Detect circular imports |
| Connections for a node |
| Shortest path between two nodes |
| Reference and edge counts |
Flags:
--signature— show declaration signatures (e.g.,function render(ctx: CanvasCtx): void)--limit N— max results to show (default 10)--dir in|out|both— direction for neighbors (default both)--type <edgeType>— filter edges by type
Built automatically at the end of each rag index. Incrementally updated during --watch mode.
Vision (image captioning)
Images are captioned via qwen3-vl during index phase 2 (text first, then images in parallel with 4 workers). The caption text is embedded and stored alongside text chunks, making images searchable by description.
Supported: .png .jpg .jpeg .gif .webp .svg (SVG via sharp).
Requires qwen3-vl pulled in Ollama.
Configuration
.rag/config.json:
{
"name": "my-project",
"embedModel": "mxbai-embed-large",
"ragModel": "llama3.2:3b",
"visionModel": "qwen3-vl",
"pattern": "",
"chunks": 8,
"temperature": 0.3
}Models auto-pull if missing. --chunks overrides per query.
License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for querying Forkast documentation
Serve a folder of Markdown notes as an MCP server: hybrid search, reading, and sourced answers.
An MCP server that gives your AI access to the source code and docs of all public github repos
Markdown-based note-taking with a hosted MCP server. Your notes serve you and your AI.
Related MCP Servers
- FlicenseBqualityDmaintenanceAn MCP server that enables interaction with Markdown knowledge bases, allowing users to search and retrieve content by tags, text, URL, or date range from their local markdown files.792-
- AlicenseNot gradedqualityCmaintenanceGeneric MCP server that exposes Markdown documentation to LLMs, enabling them to search and answer questions about any software documentation.MIT
- AlicenseNot gradedqualityDmaintenanceTransforms Markdown documentation into an intelligent knowledge base with AI-powered search and Q\&A through an MCP server.5 npm9MIT
- AlicenseNot gradedqualityCmaintenanceA read-only MCP server that enables semantic search and retrieval over a local Markdown knowledge base with heading-aware chunking and multilingual embeddings.MIT