1. Conduid
  2. RAG
  3. Rust Local Rag
MCP server Β· RAG

Rust Local Rag

πŸ¦€ High-performance local RAG server in Rust that integrates with Claude Desktop via MCP. Search PDF documents privately using Ollama embeddings - no external API calls.

Unclaimed rag
39Low

Scored 6 months ago Β· breakdown

About Rust Local Rag

Rust Local Rag is an MCP server in the RAG category: πŸ¦€ High-performance local RAG server in Rust that integrates with Claude Desktop via MCP. Search PDF documents privately using Ollama embeddings - no external API calls.

Install

From source
git clone https://github.com/ksaritek/rust-local-rag

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Ask AI

✦

Ask AI about Rust Local Rag

Powered by Claude · Grounded in docs

I know everything about Rust Local Rag. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

  • βœ“README presentThe repository ships documentation.

5 checks have not been run yet.

README

Rust Local RAG

A high-performance, local RAG (Retrieval-Augmented Generation) system built in Rust that integrates with Claude Desktop via the Model Context Protocol (MCP). Search and analyze your PDF documents directly within Claude conversations without sending data to external services.

🎯 Purpose

This project demonstrates how to build a production-ready MCP server using Rust that:

  • Processes PDF documents locally using poppler for text extraction
  • Generates embeddings using local Ollama models (no external API calls)
  • Provides semantic search through document collections
  • Integrates seamlessly with Claude Desktop via MCP protocol
  • Maintains privacy by keeping all data processing local

πŸ—οΈ What is MCP?

The Model Context Protocol (MCP) is a standard that allows AI assistants like Claude to interact with external tools and data sources. Instead of Claude being limited to its training data, MCP enables it to:

  • Call external tools and functions
  • Access real-time data sources
  • Integrate with local applications
  • Maintain context across interactions

πŸ¦€ How This Project Uses Rust MCP SDK

This implementation leverages the rmcp crate - the official Rust SDK for MCP - to create a server that exposes RAG capabilities to Claude Desktop.

MCP Architecture in This Project

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    MCP Protocol     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 β”‚    (stdin/stdout)   β”‚                  β”‚
β”‚  Claude Desktop β”‚ ◄─────────────────► β”‚   Rust RAG       β”‚
β”‚                 β”‚                     β”‚   MCP Server     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                β”‚
                                                β–Ό
                                        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                        β”‚  Local RAG Stack β”‚
                                        β”‚                  β”‚
                                        β”‚  β€’ PDF Parser    β”‚
                                        β”‚  β€’ Ollama        β”‚
                                        β”‚  β€’ Vector Store  β”‚
                                        β”‚  β€’ Search Engine β”‚
                                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key MCP Components Used

1. Server Handler Implementation

#[tool(tool_box)]
impl ServerHandler for RagMcpServer {
    fn get_info(&self) -> ServerInfo {
        // Provides server metadata to Claude
    }
}

2. Tool Definitions

Uses rmcp macros to expose RAG functionality as MCP tools:

#[tool(description = "Search through uploaded documents using semantic similarity")]
async fn search_documents(&self, query: String, top_k: Option<usize>) -> Result<CallToolResult, McpError>

#[tool(description = "List all uploaded documents")]  
async fn list_documents(&self) -> Result<CallToolResult, McpError>

#[tool(description = "Get RAG system statistics")]
async fn get_stats(&self) -> Result<CallToolResult, McpError>

3. Transport Layer

// Uses stdin/stdout transport for Claude Desktop integration
let service = server.serve(stdio()).await?;

✨ Features

πŸ” Semantic Document Search

  • Vector-based similarity search using Ollama embeddings
  • Configurable result count (top-k)
  • Relevance scoring for search results

πŸ“ Document Management

  • Automatic PDF text extraction via poppler
  • Document chunking for optimal embedding generation
  • Real-time document list and statistics

πŸ”’ Privacy-First Design

  • All processing happens locally
  • No external API calls for document content
  • Embeddings stored locally for fast retrieval

⚑ High Performance

  • Rust's memory safety and performance
  • Async/await for non-blocking operations
  • Efficient vector storage and retrieval

πŸš€ Quick Start

1. Prerequisites

# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Install Ollama
brew install ollama

# Install Poppler (for PDF parsing)
brew install poppler

# Start Ollama and install embedding model
make setup-ollama

2. Build and Install

git clone <this-repository>
cd rust-local-rag
make install

3. Configure Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
    "mcpServers": {
        "rust-local-rag": {
            "command": "/Users/yourusername/.cargo/bin/rust-local-rag",
            "env": {
                "DATA_DIR": "/Users/yourusername/Documents/data",
                "DOCUMENTS_DIR": "/Users/yourusername/Documents/rag",
                "LOG_DIR": "/tmp/rust-local-rag",
                "LOG_LEVEL": "info",
                "LOG_MAX_MB": "10"
            }
        }
    }
}

4. Add Documents and Use

# Add PDFs to documents directory
cp your-files.pdf ~/Documents/rag/

# Restart Claude Desktop
# Now ask Claude: "Search my documents for information about X"

πŸ›οΈ Architecture

Technology Stack

  • πŸ¦€ Rust: Core application language for performance and safety
  • πŸ“‘ rmcp: Official Rust MCP SDK for Claude integration
  • πŸ€– Ollama: Local embedding generation (nomic-embed-text)
  • πŸ“„ Poppler: PDF text extraction
  • πŸ—ƒοΈ Custom Vector Store: In-memory vector database for fast search

Data Flow

  1. Document Ingestion: PDFs β†’ Text extraction β†’ Chunking
  2. Embedding Generation: Text chunks β†’ Ollama β†’ Vector embeddings
  3. Indexing: Embeddings β†’ Local vector store
  4. Search: Query β†’ Embedding β†’ Similarity search β†’ Results
  5. MCP Integration: Results β†’ Claude Desktop via MCP protocol

πŸ› οΈ MCP Integration Details

Why MCP Over HTTP API?

Aspect MCP Approach HTTP API Approach
Integration Native Claude Desktop support Requires custom client
Security Process isolation, no network Network exposure required
Performance Direct stdin/stdout IPC Network overhead
User Experience Seamless tool integration Manual API management

MCP Tools Exposed

  1. search_documents

    • Purpose: Semantic search across document collection
    • Input: Query string, optional result count
    • Output: Ranked search results with similarity scores
  2. list_documents

    • Purpose: Document inventory management
    • Input: None
    • Output: List of all indexed documents
  3. get_stats

    • Purpose: System monitoring and debugging
    • Input: None
    • Output: Embedding counts, memory usage, performance metrics

πŸ“š Documentation

  • Setup Guide: Complete installation and configuration
  • Usage Guide: Claude Desktop integration and usage examples

🀝 Contributing

Contributions are welcome! This project demonstrates practical MCP server implementation patterns that can be adapted for other use cases.

Development

# Run in development mode
make run

# Check formatting
cargo fmt --check

# Run linter
cargo clippy

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Model Context Protocol for the specification
  • rmcp for the excellent Rust MCP SDK
  • Ollama for local embedding generation
  • Claude Desktop for MCP integration support

Built with ❀️ in Rust | Powered by MCP | Privacy-focused RAG

README copy captured when this server was indexed; it may lag the repository. The original is authoritative.

Questions

About Rust Local Rag

How do I install Rust Local Rag?

No package has been published for this server, so install it from source: clone the repository and follow its README.

Is Rust Local Rag safe to use with an AI agent?

Its trust score is 39 out of 100 (low). It passes 1 of the 1 static security checks run so far. It has no ConduID identity yet, so agent calls to it are not receipted.

Is Rust Local Rag still maintained?

Conduid hasn't recorded a commit date for this repository yet. Check the repository directly for recent activity.