DuckDB RAG MCP 示例
这是一个嵌入和矢量化 markdown 文档的示例,以便可以使用 MCP 和 RAG 进行解释。
我们使用Plamo-Embedding-1B进行矢量化。
功能
从 markdown 文件中提取并矢量化文本
使用 DuckDB 进行向量搜索
使用 Parquet 文件保存矢量数据
从 MCP 搜索向量
如何使用
矢量数据生成
首先,将要搜索的markdown文件放在特定的目录中,然后使用以下命令将其转换为Parquet文件。
uv run main.py --directory ~/path/to/markdown/files --parquet vectors.parquet
配置 MCP
建造
以下命令将在dist/server
中生成单个二进制文件。
uv run pyinstaller --clean --strip --noconfirm --onefile server.py
MCP 客户端配置
请根据您要使用的客户端进行设置。
对于 Claude Desktop 来说它看起来像这样:
对于 VECTOR_PARQUET,指定刚刚转换的文件。
uv run mcp install server.py -v VECTOR_PARQUET=/path/to/vectors.parquet
设置如下:
{
"mcpServers": {
"DuckDB-RAG-MCP-Sample": {
"command": "/path/to/dist/server",
"env": {
"VECTOR_PARQUET": "/path/to/vectors.parquet"
}
}
}
}
启动开发服务器
uv run mcp dev server.py
执照
DuckDB RAG MCP 示例根据 Apache 许可证 2.0 版提供。
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
MCP 服务器通过将 markdown 文档转换为嵌入向量并使用 DuckDB 执行向量搜索来启用 RAG(检索增强生成)。
Related MCP Servers
- AsecurityAlicenseAqualityThis MCP server utilizes DuckDuckGo for web searches, providing structured search results with metadata and features like smart content classification and language detection, facilitating easy integration with AI clients supporting the MCP protocol.Last updated -1262MIT License
- AsecurityFlicenseAqualityAn MCP server that enables interaction with Markdown knowledge bases, allowing users to search and retrieve content by tags, text, URL, or date range from their local markdown files.Last updated -779
- -securityFlicense-qualityAn advanced MCP server providing RAG-enabled memory through a knowledge graph with vector search capabilities, enabling intelligent information storage, semantic retrieval, and document processing.Last updated -2028
- -securityAlicense-qualityA server that integrates Retrieval-Augmented Generation (RAG) with the Model Control Protocol (MCP) to provide web search capabilities and document analysis for AI assistants.Last updated -3Apache 2.0