A Chrome extension that allows you to create and manage local context databases using QDrant vector database and open-source embedding models. Select text from any webpage and save it to your personal knowledge base for later retrieval and search.
- Text Selection: Select any text on a webpage and save it to your context databases
- Multiple Databases: Create and manage multiple context databases for different topics
- Local Processing: All data stays on your machine - uses local embedding models and QDrant
- Fast Search: Semantic search across your saved contexts using vector similarity
- Rich Metadata: Automatically captures webpage URL, title, domain, and timestamp
- Context Menu Integration: Right-click selected text for quick actions
- Modern UI: Clean, modern interface with real-time server status
- Python 3.8+ (required for the local server)
- Chrome Browser (or Chromium-based browser)
- 4GB+ RAM (recommended for embedding models)
- Internet connection (for initial model download)
-
Clone or download this project:
cd /path/to/ContextDB -
Create a Python virtual environment (recommended):
python -m venv context_db_env # On macOS/Linux: source context_db_env/bin/activate # On Windows: context_db_env\Scripts\activate
-
Install Python dependencies:
pip install -r requirements.txt
The server will automatically download the embedding model on first run, but you can pre-download it:
from sentence_transformers import SentenceTransformer
# This will download the model (about 90MB)
model = SentenceTransformer('all-MiniLM-L6-v2')
print("Model downloaded successfully!")Run the icon creation script to generate placeholder icons:
pip install Pillow # If not already installed
python create_icons.py-
Open Chrome and navigate to
chrome://extensions/ -
Enable Developer Mode (toggle in the top right)
-
Click "Load unpacked" and select the ContextDB folder
-
Pin the extension to your toolbar for easy access
python server.pyThe server will start on http://localhost:8000. You should see:
Starting Context DB Server...
Server will be available at: http://127.0.0.1:8000
Using embedding model: all-MiniLM-L6-v2
- Click the extension icon in Chrome toolbar
- Check server status - should show "Server online"
- Enter a database name (e.g., "Research Notes")
- Click "Create Database"
Method 1: Text Selection Modal
- Select any text on a webpage
- A modal will appear automatically
- Choose a database or create a new one
- Add optional tags
- Click "Save to Database"
Method 2: Right-Click Context Menu
- Select text on any webpage
- Right-click and choose "Add to Context DB"
- If you have a default database selected, it saves automatically
- Otherwise, the extension popup opens for database selection
- Open the extension popup
- Go to the Search section
- Select a database to search
- Enter your query and click "Search"
- View results with similarity scores
Edit server.py and change the EMBEDDING_MODEL constant:
# Current default (fast, efficient)
EMBEDDING_MODEL = "all-MiniLM-L6-v2"
# Alternative options:
# EMBEDDING_MODEL = "BAAI/bge-small-en-v1.5" # Better quality
# EMBEDDING_MODEL = "sentence-transformers/all-mpnet-base-v2" # Larger, higher quality
# EMBEDDING_MODEL = "nomic-ai/nomic-embed-text-v1" # Good for longer textsNote: Changing models requires recreating databases as vector dimensions may differ.
In server.py, modify the Config class:
class Config:
HOST = "127.0.0.1" # Server host
PORT = 8000 # Server port
DEFAULT_SEARCH_LIMIT = 5 # Default search results
MAX_SEARCH_LIMIT = 50 # Maximum search resultsUse the extension popup to configure:
- Server URL: Change if using different host/port
- Context Menu: Enable/disable right-click menu
- Default Database: Set a default for quick saving
Based on research and testing, here are the best open-source models for different use cases:
all-MiniLM-L6-v2(90MB, 384 dimensions)- Fastest inference
- Good for real-time use
- Best for short to medium texts
BAAI/bge-small-en-v1.5(130MB, 384 dimensions)- Better quality than MiniLM
- Still fast inference
- Good for general purpose
sentence-transformers/all-mpnet-base-v2(420MB, 768 dimensions)- Higher quality embeddings
- Slower inference
- Best for critical applications
nomic-ai/nomic-embed-text-v1(500MB+, 768 dimensions)- Handles very long texts (8192+ tokens)
- Good for documents and articles
- Slower but comprehensive
ContextDB/
βββ manifest.json # Chrome extension manifest
βββ popup.html # Extension popup interface
βββ popup.css # Popup styling
βββ popup.js # Popup functionality
βββ content.js # Content script for text selection
βββ content.css # Content script styles
βββ background.js # Extension background script
βββ server.py # FastAPI server
βββ requirements.txt # Python dependencies
βββ create_icons.py # Icon generation script
βββ icons/ # Extension icons
β βββ icon16.png
β βββ icon32.png
β βββ icon48.png
β βββ icon128.png
βββ context_dbs/ # Created automatically
β βββ databases.json # Database metadata
β βββ [database_name]/ # Individual database folders
βββ README.md # This file
The local server provides these endpoints:
GET /health- Server health checkGET /databases- List all databasesPOST /databases- Create new databaseDELETE /databases/{name}- Delete databasePOST /add-text- Add text to databasePOST /search- Search databaseGET /databases/{name}/stats- Database statistics
- Check Python version: Must be 3.8+
- Install dependencies:
pip install -r requirements.txt - Check port availability: Port 8000 might be in use
- Virtual environment: Activate your venv if using one
- Start the server: Run
python server.py - Check server URL: Verify in extension settings
- Firewall: Ensure localhost connections are allowed
- Browser restart: Try restarting Chrome
- Internet connection: Required for first download
- Disk space: Models need 90MB-500MB+ space
- Proxy/Corporate network: May block Hugging Face downloads
- Permissions: Extension needs "activeTab" permission
- Content script: Check browser console for errors
- Settings: Ensure context menu is enabled
- Database exists: Check database is created and has content
- Text content: Some texts may not embed well
- Model compatibility: Recreate databases after model changes
- Local-only: All data stays on your machine
- No tracking: No analytics or data collection
- Secure storage: QDrant stores data locally
- HTTPS support: Works with secure websites
- Export/import functionality
- Bulk text processing
- Advanced search filters
- Database backup/restore
- Custom embedding models
- Dark mode theme
- Batch operations API
This is an open-source project! Feel free to:
- Report bugs
- Suggest features
- Submit pull requests
- Improve documentation
This project is open source. Use it however you like!
If you encounter issues:
- Check the troubleshooting section above
- Look at the browser console for errors
- Check the Python server logs
- Create an issue with detailed information
Built with:
- QDrant - Vector database
- Sentence Transformers - Embedding models
- FastAPI - Python web framework
- Chrome Extensions API - Browser integration