PocketMCP
PocketMCP is a lightweight, local-first MCP (Model Context Protocol) server that automatically watches folders, chunks and embeds files locally using Transformers.js with MiniLM, stores vectors in SQLite + sqlite-vec, and exposes semantic search capabilities to VS Code and Cursor. Designed for small machines (I'm running on an Intel N100 with 16GB RAM) with zero external dependencies after initial model download.
Features
🔍 Semantic Search: Find content by meaning, not just keywords
📁 Auto-Ingestion: Watches folders and automatically processes new/changed files
📄 Multi-Format Support: PDF, DOCX, Markdown, and plain text files
⚡ Local-First: Runs completely offline after initial model download
🗄️ SQLite Storage: Fast, reliable vector storage with sqlite-vec extension
🔧 MCP Integration: Native support for VS Code and Cursor via MCP protocol
🌐 Web Interface: Built-in web tester for validation and manual testing
💾 Efficient: Designed for resource-constrained environments
🔄 Real-time: Debounced file watching with smart concurrency limits
📊 Smart Segmentation: Page-aware PDF processing and section-aware DOCX handling
🛡️ Robust Error Handling: Graceful handling of encrypted, corrupted, or oversized files
Architecture
Performance & Limits
Sweet spot: 10K-100K chunks on modest hardware
Query latency: Sub-100ms for
top_k <= 10
on typical corporaMemory usage: ~100MB for model + minimal overhead per document
Concurrency: Limited to 3 simultaneous file operations by default
File size limit: 50MB per file (configurable)
Screenshots
Table of Contents
Quick Start
1. Installation
2. Configuration
Edit .env
file:
3. Create Content Directory
4. Start the Server
On first run, the server will download the MiniLM model (~100MB) and then process any files in your watch directory.
Web Tester
PocketMCP includes a comprehensive web interface for testing and validation.
Access Points
Web Interface: http://127.0.0.1:5173
API Server: http://127.0.0.1:5174
Health Check: http://127.0.0.1:5174/health
Features
📊 Database Diagnostics Panel
Real-time database status monitoring
Table counts and vector dimensions
SQLite WAL mode verification
Error detection and reporting
One-click smoke testing
🔍 Search Panel
Interactive semantic search testing
LIKE vs Vector search modes
Configurable result count (top-K)
Detailed result inspection
Performance metrics (response time)
📄 Documents Panel
Browse all indexed documents
Pagination support
Document metadata display
Creation and update timestamps
🔎 Chunk Viewer
Detailed chunk inspection modal
Full text content display
Metadata and offset information
Copy-to-clipboard functionality
API Endpoints
Endpoint | Method | Description |
| GET | Server health check |
| GET | Database diagnostics |
| POST | Semantic search |
| GET | Get specific chunk |
| GET | List documents |
Example API Usage
Search Documents:
Get Diagnostics:
🔧 MCP Client Integration
Cursor Integration
Open Cursor Settings → MCP
Add a new server:
VS Code Integration
Add to your MCP settings:
HTTP Transport (Web Clients)
For web clients or remote access:
📚 API Reference
MCP Tools
search
Search for similar content using semantic search.
upsert_documents
Insert or update documents programmatically.
delete_documents
Delete documents by ID.
list_documents
List all documents with pagination.
MCP Resources
PocketMCP provides resource URIs for accessing specific chunks:
Format:
mcp+doc://<doc_id>#<chunk_id>
Returns: Complete chunk data including text, offsets, and metadata
Configuration
Environment Variables
Variable | Default | Description |
|
| Path to SQLite database file |
| (none) | Directory to watch for file changes |
|
| Hugging Face model for embeddings |
|
| Target chunk size in characters |
|
| Overlap between chunks in characters |
|
| Maximum pages to process in PDF files |
|
| Minimum text characters required in PDFs |
|
| Maximum file size for DOCX files (10MB) |
|
| Split DOCX documents on headings (h1/h2) |
|
| Environment mode |
|
| Enable detailed logs |
|
| Enable dotenv debug output |
|
| Web API server port |
|
| API server bind address |
|
| MCP transport mode (stdio/http/both) |
|
| HTTP server bind address |
|
| MCP server port |
|
| Logging level (debug/info/warn/error) |
Available Scripts
Script | Description |
| Start web interface + API server for testing |
| Start MCP server (both transports + file watching) |
| Build all components |
| Start production MCP server (both transports + file watching) |
| Create .env from template |
| Clean build artifacts and database |
Watch Directory
WATCH_DIR
- if not set, only manual document upserts workSupported files:
.md
,.txt
,.pdf
,.docx
File filtering: Automatically ignores temp files,
.DS_Store
,node_modules
, etc.Nested directories: Recursively watches all subdirectories
Document Processing
Processing Pipeline: Documents → Segments → Chunks
Documents: Top-level files with metadata
Segments: Logical divisions (PDF pages, DOCX sections, etc.)
Chunks: Text pieces optimized for embedding (~1000 chars)
Status Types: ok
, skipped
, needs_ocr
, too_large
, error
Supported File Types
Markdown (
.md
)Plain text (
.txt
)PDF (
.pdf
) - Text-based only, no OCRDOCX (
.docx
) - Microsoft Word documents
Notes:
Encrypted/password-protected files are skipped
Large files exceeding limits are marked as
too_large
Scanned PDFs requiring OCR are marked as
needs_ocr
Development
Project Structure
Development Commands
Deployment
Docker (Recommended)
Quick Start:
Access Points:
MCP Server:
http://localhost:8001
API Server:
http://localhost:5174
Web UI:
http://localhost:5173
Docker Compose:
Portainer Stacks
Go to Stacks → Add stack
Name:
pocketmcp
Paste this configuration:
Direct Installation
Access Points:
MCP Server:
http://localhost:8001
API Server:
http://localhost:5174
Web UI:
http://localhost:5173
Troubleshooting
Model Download Issues
If the embedding model fails to download:
Check internet connection for initial download
Model cache location:
~/.cache/huggingface/transformers/
Clear cache and retry if needed
SQLite Extension Issues
If sqlite-vec
fails to load:
Ensure
sqlite-vec
npm package is installedCheck that your system supports the required SQLite version
The system automatically falls back to regular SQLite tables if vec0 virtual tables fail
File Watching Issues
Files not being detected: Check file extensions and ignore patterns
High CPU usage: Increase debounce time with larger
debounceMs
valuesPermission errors: Ensure read/write access to watch and data directories
Web Interface Issues
API not accessible: Ensure API server is running on port 5174
Database not found: Check
SQLITE_PATH
environment variableCORS errors: API server includes CORS headers for local development
Memory Issues
Reduce
CHUNK_SIZE
for lower memory usageProcess fewer files simultaneously by reducing
maxConcurrency
Consider using a smaller embedding model (though this requires code changes)
Common Error Messages
"Too many parameter values were provided"
This was a known issue with sqlite-vec virtual tables, now fixed with automatic fallback
"Failed to load sqlite-vec extension"
System automatically falls back to regular SQLite tables with JSON embeddings
"Database file does not exist"
Run the MCP server first to create the database, or check the
SQLITE_PATH
License
MIT License - see LICENSE file for details.
Contributing
Fork the repository
Create a feature branch
Make your changes
Add tests if applicable
Submit a pull request
Acknowledgments
sqlite-vec for fast vector similarity search
Transformers.js for local embedding generation
Model Context Protocol for standardized tool integration
Hugging Face for the MiniLM model
React + Vite for the modern web interface
TailwindCSS for beautiful, responsive styling
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
A lightweight, local-first MCP server that automatically watches folders, chunks and embeds files using Transformers.js, and exposes semantic search capabilities to VS Code and Cursor. Runs completely offline with SQLite vector storage, designed for resource-constrained environments.
Related MCP Servers
- AsecurityAlicenseAqualityAn open-source MCP server that connects to various data sources (SQL databases, CSV, Parquet files), allowing AI models to execute SQL queries and generate data visualizations for analytics and business intelligence.Last updated -959MIT License
- -securityFlicense-qualityAn MCP server that integrates with AI editors like Cursor to maximize agentic capabilities while solving context window limitations, providing a Svelte UI for task planning and implementation tracking.Last updated -20
- -securityAlicense-qualityA lightweight MCP server that provides read-only access to SQLite databases, allowing users to execute SELECT queries, list tables, and describe table schemas.Last updated -MIT License
- -securityFlicense-qualityA local, fully-offline MCP memory server that enables persistent storage and retrieval of information using SQLite with both keyword and semantic vector search capabilities.Last updated -11183