📚 个人研究助理MCP
  
一个生产就绪的MCP(模型上下文协议)服务器,可以在您的个人研究库中进行语义搜索。专为需要与Claude Desktop和其他人工智能工具集成的快速、准确的文档检索的人工智能工程师而设计。
🎯 问题陈述
研究人员和专业人士积累了数十篇论文和文件,但很难做到:
- 在多个文档中查找相关信息
- 记住哪篇论文包含了具体的见解
- 将不同来源的相关概念联系起来
- 每天花2个多小时搜索信息
传统的关键字搜索忽略了语义联系,阅读所有内容是不切实际的。
💡 解决方案
MCP服务器:
- 使用语义嵌入将文档索引到向量数据库中
- 使Claude(或任何MCP客户端)能够通过对话方式查询您的研究库
- 提供低于500毫秒的响应时间,检索准确率超过85%
- 包括一个用于管理和指标的Streamlit仪表板
🏗️ 建筑
Documents (PDF/DOCX/HTML/MD)
↓
Document Processor → Text Chunker → Embeddings
↓
ChromaDB Vector Store
↓
├─→ MCP Server (FastMCP) → Claude Desktop
└─→ Streamlit UI → Monitoring/Testing✨ 特性
- 语义搜索:整个库中的自然语言查询
- 多格式支持:PDF、DOCX、HTML、Markdown、TXT
- 快速检索:1000多个块的查询延迟\<500ms
- MCP集成:适用于Claude Desktop、VS Code和任何MCP客户端
- 元数据提取:自动提取标题、作者、关键字
- 查询日志记录:跟踪使用情况和性能指标
- 流线型仪表板:上传、搜索和可视化指标
📊 性能指标
🚀 安装
先决条件
- Python 3.11+
- 最低2GB RAM
- Git
设置
# Clone repository
git clone https://github.com/yourusername/research-assistant-mcp.git
cd research-assistant-mcp
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Install local embeddings
pip install sentence-transformers
# Configure environment
cp .env.example .env
# Edit .env - add OPENAI_API_KEY if using OpenAI embeddings下载示例数据
# Download 25 AI/ML papers from arXiv
python scripts/download_sample_papers.py --count 25索引文档
# Index sample papers
python scripts/index_docs.py --folder ./sample_papers
# Or index your own documents
python scripts/index_docs.py --folder /path/to/your/papers --recursive📖 用法
启动MCP服务器
python mcp_server/server.py配置Claude桌面
增添 claude_desktop_config.json:
苹果电脑: ~/Library/Application Support/Claude/claude_desktop_config.json\ 视窗: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"research-assistant": {
"command": "python",
"args": ["/full/path/to/research-assistant-mcp/mcp_server/server.py"],
"env": {}
}
}
}重新启动克劳德桌面。
启动Streamlit用户界面
streamlit run ui/app.py开放时间: http://localhost:8501
🛠️ MCP工具
search_documents
在您的库中进行语义搜索。
Query: "What are the challenges in RAG systems?"
Returns: Top-k results with sources, scores, and metadataget_document_summary
快速浏览文档。
Input: Document path or title
Returns: Title, author, keywords, previewfind_related_papers
查找与主题类似的文档。
Query: "prompt engineering techniques"
Returns: Related papers with relevance scores📁 项目结构
research-assistant-mcp/
├── mcp_server/ # MCP server implementation
│ └── server.py
├── rag_pipeline/ # RAG components
│ ├── config.py
│ ├── document_processor.py
│ ├── chunker.py
│ ├── vector_store.py
│ ├── retriever.py
│ └── metadata_extractor.py
├── ui/ # Streamlit dashboard
│ ├── app.py
│ └── pages/
├── scripts/ # CLI utilities
│ ├── index_docs.py
│ └── download_sample_papers.py
├── tests/ # Testing & benchmarks
│ ├── sample_queries.json
│ └── benchmark_performance.py
├── data/ # Data storage
│ ├── chroma_db/
│ └── query_logs/
└── docs/ # Documentation
└── METRICS.md🧪 测试
# Run performance benchmarks
python tests/benchmark_performance.py
# Output: Accuracy, latency, scale metrics🐳 Docker部署
# Build and run
docker-compose up -d
# Access UI at http://localhost:8501
# MCP server runs on localhost:8000📈 查询示例
- 跨文档综合\
“比较LLM的不同微调方法”
- 方案探索\
“RLHF如何改善模型对齐?”
- 技术细节\
“解释变压器注意机制”
- 文献综述\
“RAG系统的最新发展是什么?”
🔧 定制
更改嵌入模型
编辑 .env:
# OpenAI (paid, best quality)
EMBEDDING_MODEL=text-embedding-3-small
# Or use local (free) by default - already configured调整块大小
编辑 .env:
CHUNK_SIZE=1000 # Characters per chunk
CHUNK_OVERLAP=200 # Overlap between chunks添加文档类型
编辑 rag_pipeline/document_processor.py 添加新的文件类型处理程序。
🐛 故障排除
ChromaDB错误:删除 data/chroma_db 并重新索引\ 导入错误:验证 pip install -r requirements.txt 完成\ UI空白:检查浏览器控制台,尝试Chrome/Firefox\ 查询速度慢:减少 TOP_K_RESULTS 在 .env
🚧 未来的增强功能
- \[\]新文档的自动监视文件夹
- \[\]交叉编码器重新排序以提高精度
- \[\]多模式支持(图像、图表)
- \[\]引文网络图
- \[\]出口到Notion/黑曜石
- \[\]Web界面(FastAPI+React)
🎥 演示视频
\[链接到2分钟演示视频-即将推出\]
🤝 贡献
欢迎投稿!请打开问题或PR。
📄 许可证
MIT许可证-请参阅 许可证
🙏 致谢
______________________________________________________________________
建造于 \[你的名字\]| | 领英
