mcp-rag-local

mcp-rag-local

Enables storing and retrieving text passages based on semantic meaning using local embeddings (Ollama) and vector storage (ChromaDB), allowing conversational memorization and retrieval of information.

Category
访问服务器

README

Memory Server (mcp-rag-local)

This MCP server provides a simple API for storing and retrieving text passages based on their semantic meaning, not just keywords. It uses Ollama for generating text embeddings and ChromaDB for vector storage and similarity search. You can "memorize" any text and later retrieve the most relevant stored texts for a given query.

Example Usage

Memorize a Text

You can simply ask the LLM to memorize a text for you in natural language:

User: Memorize this text: "Singapore is an island country in Southeast Asia."

LLM: Text memorized successfully.

Memorize Multiple Texts

You can also ask the LLM to memorize several texts at once:

User: Memorize these texts:

  • Singapore is an island country in Southeast Asia.
  • It is about one degree of latitude north of the equator.
  • It is a major financial and shipping hub.

LLM: All texts memorized successfully.

This will store all provided texts for later semantic retrieval.

Memorize a PDF File

You can also ask the LLM to memorize the contents of a PDF file via memorize_pdf_file. The MCP tool will read up to 20 pages at a time from the PDF, return the extracted text, and have the LLM chunk it into meaningful segments. The LLM then uses the memorize_multiple_texts tool to store these chunks.

This process is repeated: the MCP tool continues to read the next 20 pages, the LLM chunks and memorizes them, and so on, until the entire PDF is processed and memorized.

User: Memorize this PDF file: C:\path\to\document.pdf

LLM: Reads the first 20 pages, chunks the text, stores the chunks, and continues with the next 20 pages until the whole document is memorized.

You can also specify a starting page if you want to begin from a specific page:

MCP to LLM: Memorize this PDF file starting from page 40: C:\path\to\document.pdf

LLM: Reads pages 40–59, chunks and stores the text, then continues with the next set of pages until the end of the document.

Example: Conversational Chunking and Memorizing Large Text

If you have a long text, you can ask the LLM to help you split it into short, meaningful chunks and store them. For example:

User: Please chunk the following long text and memorize all the chunks.

{large body of text}

LLM: Splits the text into short, relevant segments and calls memorize_multiple_texts to store them. If the text is too long to store in one go, the LLM will continue chunking and storing until the entire text is memorized.

User: Are all the text chunks stored?

LLM: Checks and, if not all are stored, continues until the process is complete.

This conversational approach ensures that even very large texts are fully chunked and memorized, with the LLM handling the process interactively.

Retrieve Similar Texts

To recall information, just ask the LLM a question:

User: What is Singapore?

LLM: Returns the most relevant stored texts along with a human-readable description of their relevance.

Setup Instructions

0. Clone this repository

First, clone this git repository and change into the cloned directory:

git clone <repository-url>
cd mcp-rag-local

1. Install uv

Install uv (a fast Python package manager):

curl -LsSf https://astral.sh/uv/install.sh | sh

1a. Windows Installation

If you are on Windows, install uv using PowerShell:

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

2. Start the services

Run the following command to start ChromaDB and Ollama using Docker Compose:

docker-compose up

3. Pull the embedding model

After the containers are running, pull the embedding model for Ollama:

docker exec -it ollama ollama pull all-minilm:l6-v2

4. MCP Server Config

Add the following to your MCP server configuration:

"mcp-rag-local": {
  "command": "uv",
  "args": [
    "--directory",
    "path\\to\\mcp-rag-local",
    "run",
    "main.py"
  ],
  "env": {
    "CHROMADB_PORT": "8321",
    "OLLAMA_PORT": "11434"
  }
}

5. Viewing and Managing Memory (ChromaDB Admin GUI)

A web-based GUI for ChromaDB(Memory Server's db) is included for easy inspection and management of stored memory.

  • The admin UI is available at: http://localhost:8322
  • You can use this interface to browse, search, and manage the vector database contents.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选