
ksaritek/rust-local-rag
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
MCP 経由で Claude デスクトップと統合する Rust の高性能ローカル RAG サーバー。 Ollama embeddings - 外部 API 呼び出しを使用して、PDF ドキュメントを個人的に検索します.
概要
Rustで構築された高性能なローカルRAG(Retrieval-Augmented generation)システムで、モデルコンテキストプロトコル(MCP)を介してClaude Desktopと統合します。 外部サービスにデータを送信することなく、Claudeの会話内でPDF文書を直接検索および分析します。 このプロジェクトでは、Rust を使用して、MCP サーバを制作する方法を説明します。 - テキスト抽出用のポップアップを使用して - ローカルオラマモデル(外部API呼び出しなし)を使用して - ドキュメントコレクションを介して - MCPプロトコルを介してClaudeデスクトップ - すべてのデータ処理をローカルに保つことによって Model Context Protocol (MCP) は、Claude のような AI アシスタントが外部ツールやデータソースとやり取りできる規格です.
概要(AI 翻訳)
Rustで構築された高性能なローカルRAG(Retrieval-Augmented generation)システムで、モデルコンテキストプロトコル(MCP)を介してClaude Desktopと統合します。 外部サービスにデータを送信することなく、Claudeの会話内でPDF文書を直接検索および分析します。
重要な目的
このプロジェクトでは、Rust を使用して、MCP サーバを制作する方法を説明します。
- ** テキスト抽出のためのポップアップを使用してPDF文書をローカルに処理**
- ローカルオラマモデル(外部API呼び出しなし)を使用して埋め込むを生成する
- 文書のコレクションを通して意味のある検索を提供
- MCPプロトコルを介してClaudeデスクトップとシームレスに統合 -すべてのデータをローカル処理し続けることで、プライバシーの確保
️️ MCPとは?
Model Context Protocol (MCP) は、Claude のような AI アシスタントが外部ツールやデータソースとやり取りできる規格です。 Claude の代わりに、そのトレーニングデータに限定されている。MCP は、次のようになります。
- 外部ツールと関数の呼び出し
- リアルタイムのデータソースへのアクセス
- ローカルアプリケーションとの統合
- インタラクション間でコンテキストを維持
方法 このプロジェクトは Rust MCP SDK を使用する
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 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) -> Result
#[tool(description = "List all uploaded documents")]
async fn list_documents(&self) -> Result
インストール
This server does not publish a one-line install command.
Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →設定
{
"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"
}
}
}
}