MCP-Markdown-RAG
A Model Context Protocol (MCP) server that provides a local-first RAG engine for your markdown documents. It uses a file-based Milvus vector database to index your notes, enabling LLMs to perform semantic search and retrieve relevant content from your local files.
README
<div align="center"> <img src="docs/banner.png" alt="MCP-Markdown-RAG" width="800" style="border-radius:10px;"/> <h1>MCP-Markdown-RAG</h1> <p> <img alt="GitHub forks" src="https://img.shields.io/github/forks/Zackriya-Solutions/MCP-Markdown-RAG"/> <img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/Zackriya-Solutions/MCP-Markdown-RAG"> <img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/Zackriya-Solutions/MCP-Markdown-RAG"> </p> <p> <a href="LICENSE"> <img src="https://img.shields.io/badge/License-Apache%202.0-green" alt="License" /> </a> <img src="https://img.shields.io/badge/MCP-Server-blue"/> </p> </div>
A Model Context Protocol (MCP) server that provides a local-first RAG engine for your markdown documents. This server uses a file-based Milvus vector database to index your notes, enabling Large Language Models (LLMs) to perform semantic search and retrieve relevant content from your local files.
[!NOTE] This project is in active development. The API and implementation are subject to change. We are exploring future enhancements, including a potential port to an Obsidian plugin for seamless vault integration.
🎯 Key Features
✅ Local-First & Private: All your data is processed and stored locally. Nothing is sent to a third-party service for indexing.
✅ Semantic Search for Markdown: Go beyond simple keyword search. Find document sections based on conceptual meaning.
✅ MCP Compatible: Integrates with any MCP-supported host application like Claude Desktop, Windsurf, or Cursor.
✅ Simple Tooling: Provides two straightforward tools (index_documents and search) for managing and querying your knowledge base.
⚙️ How It Works
The server operates in two main phases, exposing its functionality through MCP tools.
-
Indexing:
- The
index_documentstool is called with a path to your markdown files. - The server reads the documents, splits them into logical chunks (e.g., by headings), and converts each chunk into a vector embedding.
- These embeddings, along with their metadata (original text, file path), are stored in a local Milvus vector database.
- You can run it in two modes:
- Full Reindex (force_reindex=True): Clears and rebuilds the entire index from scratch.
- Incremental Update (force_reindex=False, default): Automatically detects and re-indexes only changed files by comparing them against a tracking log. Deleted or modified chunks are pruned and replaced to keep the index up-to-date.
- Recursive Indexing (recursive=False, default): Recursively indexes all subdirectories.
- The
-
Searching:
- When you ask a question in a host application, it uses the
searchtool. - The server converts your query into a vector embedding.
- It then performs a similarity search against the Milvus database to find the most semantically relevant document chunks.
- The results are returned to the LLM, providing it with the context needed to answer your question accurately.
<div align="center" > <img src="docs/mcp_search.png" alt="MCP Search" width="800" style="border-radius:10px;"/> </div>
- When you ask a question in a host application, it uses the
🛠️ Available Tools
-
index_documents- Description: Indexes Markdown documents for semantic search. Converts each file into structured vector chunks and inserts them into the Milvus database.
- Incremental Indexing: Automatically reindexes only changed files unless force_reindex=True is passed.
- Arguments:
directory(string, optional): The path to the folder containing .md files. Defaults to current directory.force_reindex(boolean, optional): If True, clears and rebuilds the full index. Defaults to False.recursive(boolean, optional): If True, recursively indexes all subdirectories. Defaults to False.
-
search- Description: Searches the indexed documents using semantic similarity.
- Arguments:
query(string, required): Your natural language query.limit(integer, optional): Max number of chunks to return (default is usually 5–10).
🚀 Installation & Setup
This server requires UV (for running the Python server).
Step 1: Get the Server Code
Clone this repository to your local machine:
git clone https://github.com/Zackriya-Solutions/MCP-Markdown-RAG.git
Step 2: Configure Your Host App
Configure your MCP host application (e.g., Windsurf, Claude.app) to use the server. Add the following to your settings file:
{
"mcpServers": {
"markdown_rag": {
"command": "uv",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/MCP-Markdown-RAG",
"run",
"server.py"
]
}
}
}
Note: Replace
/ABSOLUTE/PATH/TO/MCP-Markdown-RAGwith the absolute path to where you cloned this repository.
Note: The first run will take a while and the same for the first indexing, as it needs to download the embedding model(~50MB).
📈 What's Next? (Roadmap)
We are actively working on improving the server. Future plans include:
- Performance Optimization: Improve indexing by encoding inputs in batches, which should better manage CPU usage.
- Flexible Embedding Models: Add support for other embedding models, such as the
BGEM3-largemodel for potentially higher accuracy. - Obsidian Plugin: Explore creating a dedicated Obsidian plugin for a fully integrated experience.
🐛 Debugging
You can use the MCP inspector to debug the server directly. Run the following command from the repository's root directory:
npx @modelcontextprotocol/inspector uv --directory /ABSOLUTE/PATH/TO/MCP-Markdown-RAG run server.py
🤝 Contributing
Contributions are welcome! Please feel free to open an issue or submit a pull request.
🙏 Acknowledgments
- The Model Context Protocol for the open standard that makes this possible.
- The Milvus Project for the powerful open-source vector database.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。