Complete guide for setting up the DocScraper vector database with MCP (Model Context Protocol) server integration for Claude Code and other AI development environments.
- Prerequisites
- System Requirements
- Installation Steps
- MCP Configuration
- Vector Database Setup
- Testing & Verification
- Usage Examples
- Troubleshooting
- Advanced Configuration
- Python 3.11+ (recommended 3.13+)
- Node.js 18+ (for MCP server dependencies)
- Git (for cloning repositories)
- Claude Code or Cursor.ai (for MCP integration)
pip install asyncio aiofiles openai python-dotenv beautifulsoup4 crawl4ai networkx scikit-learn tenacity| Component | Minimum | Recommended |
|---|---|---|
| RAM | 8GB | 16GB+ |
| Storage | 5GB free | 10GB+ free |
| CPU | 4 cores | 8+ cores |
| OS | macOS 10.15+, Ubuntu 20.04+, Windows 10+ | Latest versions |
# Clone the repository
git clone https://github.com/emanuelrechsteiner/DocScraper.git
cd DocScraper
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt# Clone the MCP Vector Server (if not included)
git clone https://github.com/your-org/mcp-vector-server.git /path/to/mcp-vector-server
# Navigate to MCP server directory
cd /path/to/mcp-vector-server
# Create virtual environment for MCP server
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install MCP server dependencies
pip install -r requirements.txt
# OR if using uv:
uv sync# Create the main vector database directory
mkdir -p /path/to/VectorDatabase
# Example structure:
# /path/to/VectorDatabase/
# ├── mcp-vector-server/ # MCP server code
# ├── YYYYMMDD_HHMMSS_YourDocs_VectorDB/ # Your vector database
# └── other_databases/ # Additional databasesCreate or update your MCP configuration file:
Location:
- macOS:
~/.cursor/mcp.jsonor~/.claude-code/mcp.json - Windows:
%APPDATA%\Cursor\mcp.jsonor%APPDATA%\Claude Code\mcp.json - Linux:
~/.config/cursor/mcp.jsonor~/.config/claude-code/mcp.json
Configuration:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["@modelcontextprotocol/server-filesystem", "/your/home/directory"]
},
"github": {
"command": "npx",
"args": ["@modelcontextprotocol/server-github"]
},
"vector-db": {
"command": "python3",
"args": ["/path/to/mcp-vector-server/mcp-vector-server.py"],
"env": {
"VECTOR_DB_PATH": "/path/to/VectorDatabase/YYYYMMDD_HHMMSS_YourDocs_VectorDB"
}
},
"memory": {
"command": "npx",
"args": ["@modelcontextprotocol/server-memory"]
}
}
}Create a .env file in your project root:
# .env file
OPENAI_API_KEY=your-openai-api-key-here
VECTOR_DB_PATH=/path/to/VectorDatabase/YYYYMMDD_HHMMSS_YourDocs_VectorDB
MCP_SERVER_PATH=/path/to/mcp-vector-server# Navigate to DocScraper directory
cd /path/to/DocScraper
# Set up environment
source venv/bin/activate
export OPENAI_API_KEY="your-api-key"
# Process documents with GUI
python DocPostProcessorGUI.py
# OR process via CLI
python DocPostProcessor.py "/path/to/your/docs" "/path/to/output" --use-llmIf you have a pre-built vector database:
# Copy the database to your system
cp -r /source/YYYYMMDD_HHMMSS_YourDocs_VectorDB /path/to/VectorDatabase/
# Update the path in your MCP configuration
# Edit ~/.cursor/mcp.json and update VECTOR_DB_PATHA properly configured vector database should have:
YYYYMMDD_HHMMSS_YourDocs_VectorDB/
├── vector_db_index.json # Main vector index (large file)
├── processing_summary.json # Database statistics
├── chunks/ # Individual document chunks
├── cleaned/ # Cleaned markdown files
├── metadata/ # Document metadata
└── checkpoints/ # Processing checkpoints
Create a test script (test_setup.py):
#!/usr/bin/env python3
import json
import os
from pathlib import Path
def test_vector_database():
"""Test vector database setup"""
db_path = os.getenv('VECTOR_DB_PATH')
if not db_path:
print("❌ VECTOR_DB_PATH not set")
return False
if not Path(db_path).exists():
print(f"❌ Database not found: {db_path}")
return False
# Check required files
required_files = [
"vector_db_index.json",
"processing_summary.json"
]
for file_name in required_files:
file_path = Path(db_path) / file_name
if not file_path.exists():
print(f"❌ Missing file: {file_name}")
return False
size_mb = file_path.stat().st_size / (1024 * 1024)
print(f"✅ {file_name}: {size_mb:.1f} MB")
# Load summary
try:
with open(Path(db_path) / "processing_summary.json", 'r') as f:
summary = json.load(f)
print(f"📊 Database Statistics:")
print(f" Documents: {summary.get('total_documents', 0):,}")
print(f" Chunks: {summary.get('total_chunks', 0):,}")
print(f" Processed: {summary.get('processed_at', 'Unknown')}")
except Exception as e:
print(f"❌ Error reading summary: {e}")
return False
print("✅ Vector database test passed!")
return True
if __name__ == "__main__":
test_vector_database()Run the test:
python test_setup.py# Start MCP server manually
cd /path/to/mcp-vector-server
export VECTOR_DB_PATH="/path/to/VectorDatabase/YYYYMMDD_HHMMSS_YourDocs_VectorDB"
./.venv/bin/python src/mcp_vector_server/simple_server.py
# Should output: Server starting on port XXXX- Restart Claude Code/Cursor
- Open a project
- Test MCP connection:
- In chat, ask: "Can you search the vectordb for documentation about X?"
- Should see MCP tools being used
# In Claude Code, you can now use:
# "Search vectordb for crawl4ai session management"
# "Find documentation about async web scraping in vectordb"
# "What does vectordb contain about Python asyncio?"# Quick start alias (add to ~/.zshrc or ~/.bashrc)
alias /vector="cd /path/to/mcp-vector-server && export VECTOR_DB_PATH='/path/to/VectorDatabase/YYYYMMDD_HHMMSS_YourDocs_VectorDB' && ./.venv/bin/python src/mcp_vector_server/simple_server.py"
# Usage
/vector # Starts vector database serverAdd to .vscode/tasks.json in your project:
{
"version": "2.0.0",
"tasks": [
{
"label": "Start Vector Database",
"type": "shell",
"command": "cd /path/to/mcp-vector-server && export VECTOR_DB_PATH='/path/to/VectorDatabase/YYYYMMDD_HHMMSS_YourDocs_VectorDB' && ./.venv/bin/python src/mcp_vector_server/simple_server.py",
"group": "build",
"presentation": {
"echo": true,
"reveal": "always",
"panel": "new"
}
}
]
}# Check path
echo $VECTOR_DB_PATH
ls -la $VECTOR_DB_PATH
# Fix: Update path in MCP config# Check Python environment
which python3
python3 --version
# Check dependencies
pip list | grep -E "(asyncio|aiofiles|json)"
# Fix: Reinstall dependencies
pip install -r requirements.txt# Fix permissions
chmod +x /path/to/mcp-vector-server/mcp-vector-server.py
chmod -R 755 /path/to/VectorDatabase/# Check MCP config syntax
cat ~/.cursor/mcp.json | python -m json.tool
# Restart Claude Code completely
# Check logs in Claude Code developer tools# Test MCP server directly
python3 /path/to/mcp-vector-server/mcp-vector-server.py --debug
# Test vector database access
python3 -c "
import json
from pathlib import Path
db_path = '/path/to/VectorDatabase/YYYYMMDD_HHMMSS_YourDocs_VectorDB'
summary_file = Path(db_path) / 'processing_summary.json'
if summary_file.exists():
with open(summary_file) as f:
data = json.load(f)
print(f'Documents: {data.get(\"total_documents\", 0)}')
else:
print('Summary file not found')
"{
"mcpServers": {
"vector-db-main": {
"command": "python3",
"args": ["/path/to/mcp-vector-server/mcp-vector-server.py"],
"env": {
"VECTOR_DB_PATH": "/path/to/VectorDatabase/main_docs_VectorDB"
}
},
"vector-db-secondary": {
"command": "python3",
"args": ["/path/to/mcp-vector-server/mcp-vector-server.py"],
"env": {
"VECTOR_DB_PATH": "/path/to/VectorDatabase/secondary_docs_VectorDB",
"MCP_SERVER_PORT": "8081"
}
}
}
}# In your MCP server configuration, you can customize:
# - Search similarity threshold
# - Maximum results returned
# - Search algorithm (TF-IDF, semantic, etc.)# For large databases (>1GB), consider:
# 1. Increase system memory
# 2. Use SSD storage
# 3. Adjust search parameters
# 4. Enable caching
# Environment variables for performance
export VECTOR_DB_CACHE_SIZE=1000
export VECTOR_DB_MAX_RESULTS=50
export VECTOR_DB_SIMILARITY_THRESHOLD=0.1- Check logs in Claude Code developer tools
- Test components individually (database → MCP server → Claude Code)
- Verify paths and permissions
- Check environment variables
# Verified working paths (adjust for your system):
VECTOR_DB_PATH="/Users/username/VectorDatabase/20250824_135319_TechDocs_VectorDB"
MCP_SERVER_PATH="/Users/username/mcp-vector-server"
DOCSCRAPER_PATH="/Users/username/DocScraper"- Python 3.11+ installed
- DocScraper repository cloned
- MCP vector server set up
- Vector database created/copied
- MCP configuration file updated
- Environment variables set
- Test script passes
- MCP server starts successfully
- Claude Code connects to MCP
- Vector search works in Claude Code
🎉 Setup Complete! Your vector database is now accessible via MCP in Claude Code.
Last updated: January 2025 Version: 1.0