书签存储器
一个基于Python的书签语义搜索系统,通过向量嵌入和语义分块实现对URL内容的智能查询。
特性
- 🔍 语义搜索:根据含义查找书签,而不仅仅是关键字
- 🧩 智能分块:智能地将内容分割成有意义的片段
- 🚀 多个后端:支持Qdrant Cloud、本地容器或自动启动
- 🌐 FastAPI服务器:带有自动生成文档的RESTful API
- 🤖 MCP集成:用于AI助手集成的FastMCP服务器
- 📊 灵活嵌入:支持多种嵌入模型
快速开始
安装
# Clone the repository
git clone file:///c:/temp/BookmarkMemory
cd BookmarkMemory
# Install dependencies
pip install -r requirements.txt
pip install -e .基本用法
from bookmark_memory import BookmarkMemory
# Initialize
bm = BookmarkMemory()
# Add bookmarks
bm.add_bookmarks([
"https://example.com/article1",
"https://example.com/article2"
])
# Search
results = bm.find_related_bookmarks("machine learning")
for result in results:
print(f"{result['url']} - Score: {result['relevance_score']:.3f}")API服务器
# Start the FastAPI server
uvicorn bookmark_memory.api.fastapi_app:app --reload
# Visit http://localhost:8000/docs for API documentationMCP服务器
添加到您的Claude Desktop配置中:
{
"mcpServers": {
"bookmark-memory": {
"command": "python",
"args": ["-m", "bookmark_memory.mcp.mcp_server"],
"env": {
"QDRANT_MODE": "auto"
}
}
}
}配置
环境变量
QDRANT_MODE:连接模式(自动、云端、本地)QDRANT_HOST:Qdrant主机地址QDRANT_PORT:Qdrant端口(默认值:6333)EMBEDDING_MODEL:嵌入模型(默认:句子转换/全MiniLM-L6-v2)
看 config/settings.py 对于所有配置选项。
文档
测试
# Run all tests
pytest
# Run with coverage
pytest --cov=bookmark_memory许可证
MIT许可证-有关详细信息,请参阅许可证文件。
