SQLite-Vec MCP
Vector database MCP server using SQLite with zero external dependencies.
Overview
Vector database MCP server using SQLite with zero external dependencies.
Setup
Run with npx:
pip install mcp-sqlite-vecConfiguration
SQLITE_VEC_MODEL environment variableDocumentation
SQLite-Vec MCP
Overview
SQLite-Vec MCP is a Model Context Protocol server built on top of SQLite and the sqlite-vec extension, providing vector database capabilities directly within SQLite. Released in July 2026 with over 980 GitHub stars, this server enables AI agents to perform vector similarity search, hybrid keyword+vector queries, and automated schema inferenceβall within a single-file, zero-dependency database.
This MCP server is particularly well-suited for edge deployments and resource-constrained environments where running separate vector databases (Pinecone, Qdrant, Chroma) is impractical. With SQLite-Vec, agents get vector search capabilities with the simplicity and portability of SQLite.
Features
- Vector Index Creation: Create and manage vector indexes directly in SQLite
- Similarity Search: Support for L2 distance, cosine similarity, and dot product
- Hybrid Search: Combine keyword and vector searches in a single query
- Zero External Dependencies: Single SQLite file with sqlite-vec extension
- Auto Schema Inference: Automatically infer schema from JSON data and create vector tables
- Incremental Indexing: Add vectors to existing indexes without rebuilding
- Full-Text Search Integration: Combine with SQLite FTS5 for powerful hybrid queries
- Multiple Vector Dimensions: Support for arbitrary vector dimensions
Installation
# Install via pip (Python MCP server)
pip install mcp-sqlite-vec
# Or via npm (Node.js MCP server)
npm install -g @mcp-sqlite-vec/server
# Launch via npx (no installation)
npx @mcp-sqlite-vec/server --database ./vectors.db
Configuration
{
"mcpServers": {
"sqlite-vec": {
"command": "npx",
"args": [
"@mcp-sqlite-vec/server",
"--database", "./vectors.db"
],
"env": {
"SQLITE_VEC_MODEL": "all-MiniLM-L6-v2"
}
}
}
}
Environment Variables:
| Variable | Description | Default |
|---|---|---|
SQLITE_VEC_MODEL | Embedding model for vector generation | all-MiniLM-L6-v2 |
SQLITE_VEC_DIMENSIONS | Vector dimensions | 384 |
MCP_LOG_LEVEL | Logging verbosity | info |
Available Tools
| Tool | Description |
|---|---|
create_vector_table | Create a table with vector columns |
insert_vectors | Insert documents with their embeddings |
vector_search | Perform similarity search on vectors |
hybrid_search | Combine keyword and vector search |
auto_schema_inference | Infer schema from JSON data and create vector table |
list_tables | List all vector tables in the database |
table_info | Get information about a specific vector table |
delete_vectors | Remove vectors from a table |
Usage Examples
Example 1: Create Vector Table and Insert Documents
# Via MCP client
mcp_client.call_tool("sqlite-vec", "create_vector_table", {
"table_name": "documents",
"columns": {
"id": "INTEGER PRIMARY KEY",
"content": "TEXT",
"embedding": "VECTOR(384)",
"metadata": "TEXT"
}
})
mcp_client.call_tool("sqlite-vec", "insert_vectors", {
"table_name": "documents",
"documents": [
{"id": 1, "content": "AI agents are transforming software development", "metadata": '{"category": "tech"}'},
{"id": 2, "content": "Vector databases enable semantic search", "metadata": '{"category": "data"}'},
{"id": 3, "content": "SQLite is perfect for embedded applications", "metadata": '{"category": "database"}'}
]
})
Example 2: Vector Similarity Search
response = mcp_client.call_tool("sqlite-vec", "vector_search", {
"table_name": "documents",
"query": "What are AI agents?",
"distance_metric": "cosine", # "l2", "cosine", "dot_product"
"top_k": 5
})
# Results sorted by similarity
Example 3: Hybrid Keyword + Vector Search
response = mcp_client.call_tool("sqlite-vec", "hybrid_search", {
"table_name": "documents",
"query": "AI agents development",
"keyword_fields": ["content"],
"vector_field": "embedding",
"top_k": 10,
"weight_vector": 0.7, # Vector search weight
"weight_keyword": 0.3 # Keyword search weight
})
Example 4: Auto Schema Inference
response = mcp_client.call_tool("sqlite-vec", "auto_schema_inference", {
"json_file": "./documents.json",
"table_name": "auto_documents",
"vector_field": "content",
"metadata_fields": ["title", "author", "date"]
})
Example 5: List Vector Tables
response = mcp_client.call_tool("sqlite-vec", "list_tables", {})
# Returns: {"tables": ["documents", "auto_documents", "embeddings"]}
Advanced Features
Custom Embedding Models
# Use different embedding models
mcp_client.call_tool("sqlite-vec", "set_embedding_model", {
"model": "text-embedding-ada-002",
"dimensions": 1536,
"api_key": "sk-xxx"
})
Batch Processing
# Insert large batches efficiently
mcp_client.call_tool("sqlite-vec", "insert_vectors", {
"table_name": "documents",
"json_file": "./large_corpus.json",
"batch_size": 1000
})
Index Optimization
# Rebuild vector index for better performance
mcp_client.call_tool("sqlite-vec", "rebuild_index", {
"table_name": "documents"
})
Edge Deployment
SQLite-Vec MCP is ideal for edge deployments:
# Deploy on Raspberry Pi or embedded devices
import sqlite3
from miniagent7b import MiniAgent
# SQLite-Vec requires only ~100MB total
agent = MiniAgent(model_path="miniagent-7b-int4", device="cpu")
vector_db = sqlite3.connect("./vectors.db")
Pros
- β Zero Dependencies: Single SQLite file, no external services
- β Vector Search Native: Built-in vector similarity search
- β Hybrid Search: Combine keyword and vector queries
- β Auto Schema Inference: Automatically create vector tables from JSON
- β Edge-Ready: Perfect for resource-constrained deployments
- β SQLite Familiarity: Leverages existing SQLite knowledge
Cons
- β SQLite Limitations: Not suitable for high-concurrency scenarios
- β Embedding Quality: Depends on external embedding model choice
- β New Server: Limited production track record
- β Scaling Limits: SQLite has inherent scalability constraints
When to Use
- Edge Deployments: Deploy vector search on devices without cloud access
- Prototyping: Quick experimentation without infrastructure setup
- Local Agent Workflows: Embed vector search in local agent applications
- Resource-Constrained Environments: Limited memory or compute availability
- Hybrid Search Needs: Combine keyword and semantic search capabilities
- Single-File Databases: Need portable, backupable database solutions
