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 (Intel N100, 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
- ⚡ 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
📋 Table of Contents
- Quick Start
- Web Tester
- MCP Client Integration
- API Reference
- Configuration
- Development
- Architecture
- Troubleshooting
🚀 Quick Start
1. Installation
2. Configuration
Edit .env
file:
3. Create Content Directory
4. Start the Server
Option A: MCP Server Only
Option B: MCP Server + Web Tester
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 |
---|---|---|
/health | GET | Server health check |
/api/db/diag | GET | Database diagnostics |
/api/search | POST | Semantic search |
/api/chunk/:id | GET | Get specific chunk |
/api/docs | GET | List documents |
Example API Usage
Search Documents:
Get Diagnostics:
🔧 MCP Client Integration
Cursor Integration
- Open Cursor Settings → MCP
- Add a new server with these settings:
VS Code Integration
For VS Code clients that support MCP, add to your settings:
Alternative: Direct Node Execution
📚 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 |
---|---|---|
SQLITE_PATH | ./data/index.db | Path to SQLite database file |
WATCH_DIR | (none) | Directory to watch for file changes |
MODEL_ID | Xenova/all-MiniLM-L6-v2 | Hugging Face model for embeddings |
CHUNK_SIZE | 1000 | Target chunk size in characters |
CHUNK_OVERLAP | 120 | Overlap between chunks in characters |
NODE_ENV | development | Environment mode |
VERBOSE_LOGGING | false | Enable detailed logs |
DEBUG_DOTENV | false | Enable dotenv debug output |
API_PORT | 5174 | Web API server port |
API_BIND | 127.0.0.1 | API server bind address |
Available Scripts
Script | Description |
---|---|
pnpm dev | Start web interface + API server |
pnpm dev:mcp | Start MCP server only |
pnpm dev:mcp:watch | Start MCP server with file watching |
pnpm dev:mcp:verbose | Start MCP server with verbose logging |
pnpm build | Build all components |
pnpm start | Start production MCP server |
pnpm setup | Create .env from template |
pnpm clean | Clean build artifacts and database |
Watch Directory Notes
WATCH_DIR
is optional - if not set, only manual document upserts work- Choose any directory -
./kb
is just a convention, use whatever makes sense - Supported files:
.md
,.txt
by default (configurable in code) - File filtering: Automatically ignores temp files,
.DS_Store
,node_modules
, etc. - Nested directories: Recursively watches all subdirectories
Supported File Types
Currently supports:
- Markdown (
.md
) - Plain text (
.txt
)
To add more file types, modify the supportedExtensions
in the FileIngestManager
configuration.
🛠️ Development
Project Structure
Development Commands
Testing
🏗️ Architecture
📊 Performance & Limits
- Sweet spot: 10K-100K chunks on modest hardware
- Query latency: Sub-100ms for
top_k <= 10
on typical corpora - Memory usage: ~100MB for model + minimal overhead per document
- Concurrency: Limited to 3 simultaneous file operations by default
- File size limit: 50MB per file (configurable)
🔧 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 installed - Check 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
values - Permission 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 variable - CORS errors: API server includes CORS headers for local development
Memory Issues
- Reduce
CHUNK_SIZE
for lower memory usage - Process 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 -957MIT 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 -11202