| name | lancer |
| description | Use lancer CLI for LanceDB semantic and multi-modal search with document ingestion, vector embeddings, and MCP server integration for knowledge retrieval. |
Lancer - LanceDB CLI and MCP Server Skill
You are a specialist in using lancer, a CLI and MCP server for LanceDB that provides semantic and full-text search with multi-modal support (text and images). This skill provides comprehensive workflows, best practices, and common patterns for document ingestion, search, and table management.
What is Lancer?
lancer is a powerful tool for:
- Semantic search: Find documents by meaning, not just keywords
- Multi-modal support: Index and search both text and images
- LanceDB integration: Efficient vector database storage and retrieval
- Flexible ingestion: Support for multiple file formats (txt, md, pdf, sql, images)
- MCP server mode: Integration with Claude Desktop and other MCP clients
Core Capabilities
- Ingest: Add documents to LanceDB with automatic chunking and embedding
- Search: Semantic similarity search across documents
- Tables: Manage LanceDB tables (list, info, delete)
- Remove: Remove documents from tables
- MCP: Run as Model Context Protocol server
Quick Start
Basic Search
lancer search "how to deploy kubernetes"
lancer search -t docs -l 20 "authentication methods"
lancer search --threshold 0.7 "error handling patterns"
Basic Ingestion
lancer ingest document.md
lancer ingest ./docs/
lancer ingest file1.md file2.pdf ./images/
Document Ingestion
Ingest Command Options
lancer ingest -t my_docs document.md
lancer ingest -e md,txt,pdf ./docs/
find ./docs -name "*.md" | lancer ingest --stdin
lancer ingest --files-from paths.txt
lancer ingest --chunk-size 2000 --chunk-overlap 400 document.md
Supported File Types
Text formats:
txt - Plain text files
md - Markdown documents
pdf - PDF documents
sql - SQL scripts
Image formats:
jpg, jpeg - JPEG images
png - PNG images
gif - GIF images
bmp - Bitmap images
webp - WebP images
tiff, tif - TIFF images
svg - SVG vector graphics
ico - Icon files
Embedding Models
Text models:
lancer ingest document.md
lancer ingest --text-model all-MiniLM-L12-v2 document.md
lancer ingest --text-model bge-small-en-v1.5 document.md
lancer ingest --text-model bge-base-en-v1.5 document.md
Image models:
lancer ingest image.jpg
lancer ingest --image-model resnet50 image.jpg
Advanced: Force specific model:
lancer ingest --embedding-model clip-vit-b-32 document.md
lancer ingest --embedding-model BAAI/bge-small-en-v1.5 document.md
Ingestion Optimization
lancer ingest --min-file-size 1000 --max-file-size 10000000 ./docs/
lancer ingest --no-embeddings document.md
lancer ingest --batch-size 200 ./large-dataset/
lancer ingest --format json document.md
Search Operations
Search Command Options
lancer search "kubernetes deployment"
lancer search -t docs "authentication"
lancer search -l 5 "error handling"
lancer search --threshold 0.6 "database migration"
lancer search --include-embeddings "API design"
lancer search --format json "machine learning"
Metadata Filters
lancer search --filter "author:eq:John" "AI research"
lancer search \
--filter "author:eq:John" \
--filter "year:gt:2020" \
"deep learning"
Search Examples
lancer search \
-t docs \
--filter "date:gte:2024-01-01" \
-l 10 \
"API endpoints"
lancer search \
--filter "category:eq:tutorial" \
"getting started"
lancer search \
-t technical_docs \
--filter "language:eq:python" \
--filter "level:eq:advanced" \
--threshold 0.7 \
-l 15 \
"async programming patterns"
Table Management
List Tables
lancer tables list
lancer tables list --format json
Table Information
lancer tables info my_table
lancer tables info my_table --format json
Delete Table
lancer tables delete old_table
Remove Documents
lancer remove -t docs document_id
lancer remove -t docs id1 id2 id3
Configuration
Using Config File
lancer -c ~/.lancer/config.toml search "query"
lancer -c config.toml ingest document.md
Environment Variables
export LANCER_TABLE=my_docs
lancer search "query"
export LANCER_LOG_LEVEL=debug
lancer ingest document.md
Log Levels
lancer --log-level error search "query"
lancer --log-level warn ingest document.md
lancer --log-level info search "query"
lancer --log-level debug ingest document.md
lancer --log-level trace search "query"
Common Workflows
Workflow 1: Index Documentation
lancer ingest -t docs -e md ./documentation/
lancer tables info docs
lancer search -t docs "installation guide"
lancer search -t docs --threshold 0.7 -l 5 "configuration"
Workflow 2: Multi-modal Image Search
lancer ingest -t images -e jpg,png,webp \
--image-model clip-vit-b-32 \
./photos/
lancer search -t images "sunset over mountains"
lancer search -t images --threshold 0.8 "red car"
Workflow 3: Mixed Content Corpus
lancer ingest -t knowledge_base \
--embedding-model clip-vit-b-32 \
-e md,pdf,jpg,png \
./content/
lancer search -t knowledge_base "architecture diagrams"
lancer search -t knowledge_base \
--filter "file_type:eq:png" \
"system design"
Workflow 4: Batch Ingestion
find ./corpus -type f -name "*.md" > files.txt
lancer ingest -t corpus \
--files-from files.txt \
--chunk-size 1500 \
--chunk-overlap 300 \
--batch-size 150
lancer tables info corpus
lancer search -t corpus -l 10 "sample query"
Workflow 5: Update Existing Corpus
lancer ingest -t docs ./new_docs/
lancer search -t docs "recent feature"
lancer remove -t docs old_doc_id
lancer tables info docs
Best Practices
1. Choose the Right Embedding Model
For text-only corpora:
lancer ingest --text-model all-MiniLM-L6-v2 document.md
lancer ingest --text-model bge-base-en-v1.5 document.md
For images or mixed content:
lancer ingest --embedding-model clip-vit-b-32 content/
2. Optimize Chunk Settings
Short documents (< 500 words):
lancer ingest --chunk-size 500 --chunk-overlap 100 article.md
Long documents (> 2000 words):
lancer ingest --chunk-size 2000 --chunk-overlap 400 book.pdf
Code documentation:
lancer ingest --chunk-size 1000 --chunk-overlap 200 docs/
3. Use Tables to Organize Content
lancer ingest -t api_docs ./api/*.md
lancer ingest -t tutorials ./tutorials/*.md
lancer ingest -t images ./screenshots/*.png
lancer search -t api_docs "authentication endpoints"
4. Set Appropriate Thresholds
Broad exploration:
lancer search --threshold 0.4 "general topic"
Precise matching:
lancer search --threshold 0.75 "specific concept"
Very high precision:
lancer search --threshold 0.85 -l 3 "exact information"
5. Use Filters for Structured Data
lancer search \
--filter "status:eq:published" \
--filter "category:eq:tutorial" \
--threshold 0.6 \
"getting started guide"
6. Format Output for Scripting
lancer search --format json "query" | jq '.results[] | .path'
lancer tables list --format json | jq '.[] | .name'
MCP Server Mode
Running as MCP Server
lancer mcp
lancer mcp -c ~/.lancer/config.toml
lancer mcp --log-level info
Integration with Claude Desktop
Add to Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"lancer": {
"command": "lancer",
"args": ["mcp"]
}
}
}
Performance Tips
1. Batch Operations
lancer ingest file1.md file2.md file3.md
find ./docs -name "*.md" | lancer ingest --stdin
2. Optimize Batch Size
lancer ingest --batch-size 500 ./large-corpus/
lancer ingest --batch-size 50 ./documents/
3. Skip Embeddings for Metadata-Only
lancer ingest --no-embeddings ./archive/
4. Use Appropriate Models
lancer ingest --text-model all-MiniLM-L6-v2 ./docs/
lancer ingest --text-model bge-base-en-v1.5 ./docs/
Troubleshooting
Issue: Search returns no results
Solutions:
lancer search --threshold 0.3 "query"
lancer tables list
lancer tables info my_table
lancer search "alternative phrasing"
Issue: Ingestion fails for some files
Solutions:
lancer ingest -e md,txt,pdf ./docs/
lancer ingest --max-file-size 100000000 ./docs/
lancer --log-level debug ingest document.pdf
Issue: Low search quality
Solutions:
lancer ingest --text-model bge-base-en-v1.5 document.md
lancer ingest --chunk-size 1500 --chunk-overlap 300 document.md
lancer search --threshold 0.6 "query"
Issue: Slow ingestion
Solutions:
lancer ingest --batch-size 300 ./docs/
lancer ingest --text-model all-MiniLM-L6-v2 ./docs/
lancer ingest --no-embeddings ./docs/
Quick Reference
lancer ingest document.md
lancer ingest -t docs ./directory/
lancer ingest -e md,pdf ./docs/
lancer ingest --chunk-size 2000 document.md
lancer search "query"
lancer search -t docs "query"
lancer search -l 20 "query"
lancer search --threshold 0.7 "query"
lancer search --filter "author:eq:John" "query"
lancer tables list
lancer tables info my_table
lancer tables delete old_table
lancer -c config.toml search "query"
lancer --log-level debug ingest doc.md
export LANCER_TABLE=docs
lancer mcp
Common Patterns
Pattern 1: Quick Documentation Search
lancer search -t docs --threshold 0.7 -l 5 "how to configure authentication"
Pattern 2: Ingest and Test
lancer ingest -t test_docs document.md && \
lancer search -t test_docs "key concept from document"
Pattern 3: Find Similar Images
lancer search -t images --threshold 0.8 "sunset landscape photography"
Pattern 4: Batch Ingest with Verification
find ./docs -name "*.md" | lancer ingest -t docs --stdin && \
lancer tables info docs
Pattern 5: Precise Technical Search
lancer search -t technical_docs \
--filter "language:eq:rust" \
--threshold 0.75 \
-l 10 \
"async trait implementation patterns"
Summary
Primary use cases:
- Semantic search across documentation
- Multi-modal search (text and images)
- Knowledge base indexing and retrieval
- Integration with Claude via MCP
Key advantages:
- Semantic similarity (not just keyword matching)
- Multi-modal support (text and images)
- Flexible metadata filtering
- Multiple embedding model options
- Fast vector search with LanceDB
Most common commands:
lancer ingest document.md - Index documents
lancer search "query" - Search semantically
lancer tables list - Manage tables
lancer search -t docs --threshold 0.7 "query" - Precise search