# Mcp Rag Server

> mcp-rag-server is a Model Context Protocol (MCP) server that enables Retrieval Augmented Generation (RAG) capabilities. It empowers Large Language Models (LLMs) to answer questions based on your document content by indexing and retrieving relevant information efficiently.

- **Type:** MCP server
- **Install:** `agentstack add mcp-kwanleefrmvi-mcp-rag-server`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [kwanLeeFrmVi](https://agentstack.voostack.com/s/kwanleefrmvi)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [kwanLeeFrmVi](https://github.com/kwanLeeFrmVi)
- **Source:** https://github.com/kwanLeeFrmVi/mcp-rag-server

## Install

```sh
agentstack add mcp-kwanleefrmvi-mcp-rag-server
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# mcp-rag-server

[](https://www.npmjs.com/package/mcp-rag-server)  [](LICENSE)  [](package.json)

A Model Context Protocol (MCP) server that enables Retrieval Augmented Generation (RAG). It indexes your documents and serves relevant context to Large Language Models via the MCP protocol.

## Integration Examples

### Generic MCP Client Configuration

```json
{
  "mcpServers": {
    "rag": {
      "command": "npx",
      "args": ["-y", "mcp-rag-server"],
      "env": {
        "BASE_LLM_API": "http://localhost:11434/v1",
        "EMBEDDING_MODEL": "nomic-embed-text",
        "VECTOR_STORE_PATH": "./vector_store",
        "CHUNK_SIZE": "500"
      }
    }
  }
}
```

### Example Interaction

```shell
# Index documents
>> tool:embedding_documents {"path":"./docs"}

# Check status
>> resource:embedding-status

 💡 **Tip:** We recommend using [Ollama](https://ollama.com) for embedding. Install and pull the `nomic-embed-text` model:
```bash
ollama pull nomic-embed-text
export EMBEDDING_MODEL=nomic-embed-text
```

## Configuration

| Variable            | Description                                      | Default                           |
| ------------------- | ------------------------------------------------ | --------------------------------- |
| `BASE_LLM_API`      | Base URL for embedding API                       | `http://localhost:11434/v1`       |
| `LLM_API_KEY`       | API key for your LLM provider                    | (empty)                           |
| `EMBEDDING_MODEL`   | Embedding model identifier                       | `nomic-embed-text`                |
| `VECTOR_STORE_PATH` | Directory for local vector store                 | `./vector_store`                  |
| `CHUNK_SIZE`        | Characters per text chunk (number)               | `500`                             |
> 💡 **Recommendation:** Use Ollama embedding models like `nomic-embed-text` for best performance.

## Usage

### MCP Tools

Once running, the server exposes these tools via MCP:

- `embedding_documents(path: string)`: Index documents under the given path
- `query_documents(query: string, k?: number)`: Retrieve top `k` chunks (default 15)
- `remove_document(path: string)`: Remove a specific document
- `remove_all_documents(confirm: boolean)`: Clear the entire index (`confirm=true`)
- `list_documents()`: List all indexed document paths

### MCP Resources

Clients can also read resources via URIs:

- `rag://documents` — List all document URIs
- `rag://document/{path}` — Fetch full content of a document
- `rag://query-document/{numberOfChunks}/{query}` — Query documents as a resource
- `rag://embedding/status` — Check current indexing status (completed, failed, total)

## How RAG Works

1. **Indexing**: Reads files, splits text into chunks based on `CHUNK_SIZE`, and queues them for embedding.
2. **Embedding**: Processes each chunk sequentially against the embedding API, storing vectors in SQLite.
3. **Querying**: Embeds the query and retrieves nearest text chunks from the vector store, returning them to the client.

## Development

```bash
npm install
npm run build      # Compile TypeScript
npm start          # Run server
npm run watch      # Watch for changes
```

## Contributing

Contributions are welcome! Please open issues or pull requests on [GitHub](https://github.com/kwanLeeFrmVi/mcp-rag-server).

## License

MIT 2025 Quan Le

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [kwanLeeFrmVi](https://github.com/kwanLeeFrmVi)
- **Source:** [kwanLeeFrmVi/mcp-rag-server](https://github.com/kwanLeeFrmVi/mcp-rag-server)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-kwanleefrmvi-mcp-rag-server
- Seller: https://agentstack.voostack.com/s/kwanleefrmvi
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
