
kazuph/mcp-docs-rag
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
ローカルディレクトリ内の文書のRAG(Retrieval-Augmented generation)
概要
ローカルディレクトリ内の文書のRAG(Retrieval-Augmented generation) これは、ローカルディレクトリに保存されたドキュメントの RAG システムを実装する TypeScript ベースの MCP サーバーです。 LLM を使用して文書をローカルに保存されたリポジトリやテキストファイルからコンテキストでクエリすることができます。 - ドキュメントを docs:// でリストしてアクセスする URI - ドキュメントは Git リポジトリまたはテキストファイル - コンテンツアクセスのためのテキスト mime タイプをプレーン - List documents - DOCS PATHディレクトリにあるすべての利用可能な文書を一覧表示 - すべての文書の整形リストを返す - 利用可能な文書の総数を表示 - rag query - RAGを使用してクエリ文書を取り除きます - ドキュメントのコンテキストでAI生成された応答を返し - add git repository - Gitリポジトリを省略して、オプションのスパースのチェックアウト - ドキュメント名を省略するパラメータとしてrepository urlを取る - ドキュメント名を省略するパラメータを指定してください.
概要(AI 翻訳)
ローカルディレクトリ内の文書のRAG(Retrieval-Augmented generation)
これは、ローカルディレクトリに保存されたドキュメントの RAG システムを実装する TypeScript ベースの MCP サーバーです。 LLM を使用して文書をローカルに保存されたリポジトリやテキストファイルからコンテキストでクエリすることができます。
##特徴
リソース
- [
docs://を介して文書をリストおよびアクセスする ログイン - 文書は Git リポジトリやテキストファイルでも構いません
- コンテンツアクセスのためのプレーンテキストミータイプ
ツール
- [
list_documents- DOCS PATHディレクトリにあるすべての利用可能な文書をリストする - すべての文書の整形リストを返す
- 利用可能な文書の総数を表示
- [
rag_query- RAGを使用してドキュメントをクエリ - ドキュメント ID とクエリをパラメーターとして取得
- 文書からのコンテキストでAI生成された応答を返す
- [[
add_git_repository] - Gitリポジトリをオプションのスパースチェックアウトでdocsディレクトリにクローンする - パラメータとしてrepository urlを
- ドキュメントの名前をカスタマイズするためのオプションの document name パラメータ(‘-docs’ suffix なしで単純な記述名を使用する)
- 特定のディレクトリのスパースチェックアウトのためのオプションのサブディレクトリパラメータ
- リポジトリが既に存在している場合は、自動的に最新の変更をプル
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 README の抜粋です。原文を見る。
mcp-docs-rag MCP Server
RAG (Retrieval-Augmented Generation) for documents in a local directory
This is a TypeScript-based MCP server that implements a RAG system for documents stored in a local directory. It allows users to query documents using LLMs with context from locally stored repositories and text files.
Features
Resources
- List and access documents via
docs://URIs - Documents can be Git repositories or text files
- Plain text mime type for content access
Tools
list_documents- List all available documents in the DOCS_PATH directory- Returns a formatted list of all documents
- Shows total number of available documents
rag_query- Query documents using RAG- Takes document_id and query as parameters
- Returns AI-generated responses with context from documents
add_git_repository- Clone a Git repository to the docs directory with optional sparse checkout- Takes repository_url as parameter
- Optional document_name parameter to customize the name of the document (use simple descriptive names without ‘-docs’ suffix)
- Optional subdirectory parameter for sparse checkout of specific directories
- Automatically pulls latest changes if repository already exists
add_text_file- Download a text file to the docs directory- Takes file_url as parameter
- Uses wget to download file
Prompts
guide_documents_usage- Guide on how to use documents and RAG functionality- Includes list of available documents
- Provides usage hints for RAG functionality
Development
Install dependencies:
npm install
Build the server:
npm run build
For development with auto-rebuild:
npm run watch
Setup
This server requires a local directory for storing documents. By default, it uses ~/docs but you can configure a different location with the DOCS_PATH environment variable.
Document Structure
The documents directory can contain:
- Git repositories (cloned directories)
- Plain text files (with .txt extension)
Each document is indexed separately using llama-index.ts with Google’s Gemini embeddings.
API Keys
This server uses Google’s Gemini API for document indexing and querying. You need to set your Gemini API key as an environment variable:
export GEMINI_API_KEY=your-api-key-here
You can obtain a Gemini API key from the Google AI Studio website. Add this key to your shell profile or include it in the environment configuration for Claude Desktop.
Installation
To use with Claude Desktop, add the server config:
On MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
On Linux: ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"docs-rag": {
"command": "npx",
"args": ["-y", "@kazuph/mcp-docs-rag"],
"env": {
"DOCS_PATH": "/Users/username/docs",
インストール
npx -y @kazuph/mcp-docs-rag設定
{
"mcpServers": {
"docs-rag": {
"command": "npx",
"args": ["-y", "@kazuph/mcp-docs-rag"],
"env": {
"DOCS_PATH": "/Users/username/docs",
"GEMINI_API_KEY": "your-api-key-here"
}
}
}
}