DuckDB RAG MCP Sample
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 Sampleは、Apache License, Version 2.0の下で提供されています。
DuckDB-RAG-MCP-Sample
Project Details
- nananaman/DuckDB-RAG-MCP-Sample
- Apache License 2.0
- Last Updated: 4/21/2025
Recomended MCP Servers
DiffuGen is a powerful yet user-friendly interface for localedge image generation. Built on the Model Control Protocol (MCP),...
Basic Memory is a knowledge management system that allows you to build a persistent semantic graph from conversations...
This is an MCP kubernetes Server.
A Model Context Protocol (MCP) server for interacting with Shortcut (formerly Clubhouse)
MCP server that provides computer control capabilities, like mouse, keyboard, OCR, etc. using PyAutoGUI, RapidOCR, ONNXRuntime. Similar to...
MCP server for Notion integration
A powerful Model Context Protocol (MCP) server for GitHub Enterprise that enables AI agents to access and manage...
MCP server that allows simple SAP GUI interaction for LLM models using simulated mouse clicks and keyboard input.
PDF to Markdown conversion tool
An MCP server for listing and trading tokens on KaiaFun and interacting with the Kaia blockchain