modelscope·@wesleygriffin/pdfrag
暂无描述。
A Model Context Protocol (MCP) server that provides powerful RAG (Retrieval-Augmented Generation) capabilities for PDF documents. This server uses ChromaDB for vector storage, sentence-transformers for embeddings, and semantic chunking for intelligent text segmentation.
multi-qa-mpnet-base-dot-v1 (optimized for question-answering)git clone <repository-url>
cd pdfrag
pip install -e .
pdfrag --help
pdfrag-cli --help
The server automatically downloads required NLTK punkt tokenizer data on first run.
For scanned PDF support, install Tesseract:
brew install tesseractsudo apt-get install tesseract-ocrThe server automatically detects scanned pages and uses OCR when Tesseract is available.
The server stores its ChromaDB database in a configurable location. You can specify the database path using the --db-path command line argument:
# Use default location (~/.dotfiles/files/mcps/pdfrag/chroma_db)
pdfrag
# Use custom database location
pdfrag --db-path /path/to/your/database
Default chunking settings:
These can be customized when adding PDFs:
{
"pdf_path": "/path/to/document.pdf",
"chunk_size": 5, # Use 5 sentences per chunk
"overlap": 2 # 2 sentences overlap
}
Responses are limited to 25,000 characters by default. If exceeded, results are automatically truncated with a warning message.
pdfrag/
src/pdfrag/ # Main package
server.py # FastMCP server with 5 tools
database.py # ChromaDB interface
embeddings.py # Embedding generation
pdf.py # PDF text extraction
chunking.py # Semantic chunking
cli.py # MCP CLI tool
tests/ # Test suite
docs/ # Documentation
examples/ # Configuration examples
pyproject.toml # Package configuration
Add a PDF document to the RAG database.
Input:
{
"pdf_path": "/absolute/path/to/document.pdf",
"chunk_size": 3, // optional, default: 3
"overlap": 1 // optional, default: 1
}
Output:
{
"status": "success",
"message": "Successfully added 'document.pdf' to the database",
"document_id": "a1b2c3d4...",
"filename": "document.pdf",
"pages": 15,
"chunks": 127,
"chunk_size": 3,
"overlap": 1
}
Example Use Cases:
Remove a PDF document from the database.
Input:
{
"document_id": "a1b2c3d4..." // Get from pdf_list
}
Output:
{
"status": "success",
"message": "Successfully removed 'document.pdf' from the database",
"document_id": "a1b2c3d4...",
"removed_chunks": 127
}
List all PDF documents in the database.
Input:
{
"response_format": "markdown" // or "json"
}
Output (Markdown):
# PDF Documents (2 total)
## research_paper.pdf
**Document ID:** a1b2c3d4...
**Chunks:** 127
**Added:** N/A
## documentation.pdf
**Document ID:** e5f6g7h8...
**Chunks:** 89
**Added:** N/A
Output (JSON):
{
"count": 2,
"documents": [
{
"document_id": "a1b2c3d4...",
"filename": "research_paper.pdf",
"chunk_count": 127
},
{
"document_id": "e5f6g7h8...",
"filename": "documentation.pdf",
"chunk_count": 89
}
]
}
Search using semantic similarity (vector search).
Input:
{
"query": "machine learning techniques for text classification",
"top_k": 5, // optional, default: 5
"document_filter": null, // optional, search specific doc
"response_format": "markdown" // optional, default: markdown
}
Output (Markdown):
# Search Results for: 'machine learning techniques for text classification'
Found 5 relevant chunks:
## Result 1
**Document:** research_paper.pdf
**Page:** 7
**Similarity Score:** 0.8754
**Content:**
Machine learning approaches to text classification have evolved significantly...
---
Use Cases:
Search using keyword matching.
Input:
{
"keywords": "neural network backpropagation",
"top_k": 5, // optional, default: 5
"document_filter": null, …
暂无描述。
暂无描述。
一种模型上下文协议服务器,它将Wireshark的网络分析能力与Claude等人工智能系统集成在一起,允许在无需手动复制的情况下直接分析网络数据包。
通过SearchAPI.site将AI助手连接到外部数据源(如Google、Bing等),并通过模型上下文协议(MCP)实现对网络信息的安全和上下文访问。
暂无描述。
暂无描述。