AAS LanceDB MCP Server

AAS LanceDB MCP Server

Provides AI agents with database-like operations over LanceDB with automatic BGE-M3 multilingual embedding generation, enabling semantic search, CRUD operations, and safe schema migrations across structured data.

Category
Visit Server

README

AAS LanceDB MCP Server

A comprehensive Model Context Protocol (MCP) server that provides AI agents with database-like operations over LanceDB with automatic embedding generation using state-of-the-art BGE-M3 multilingual embeddings.

โœจ Why This MCP Server?

  • ๐ŸŽฏ Database-like Interface: Works like SQLite MCP - create tables, CRUD operations, migrations
  • ๐Ÿค– Automatic Embeddings: BGE-M3 generates 1024D multilingual embeddings for searchable text
  • ๐Ÿ” Semantic Search: Natural language search across your data using vector similarity
  • ๐Ÿ“Š Rich Resources: Dynamic database inspection (schemas, samples, statistics)
  • ๐Ÿ’ก Intelligent Prompts: AI guidance for schema design, optimization, troubleshooting
  • ๐Ÿ›ก๏ธ Safe Migrations: Built-in table migration with validation and automatic backups
  • ๐ŸŒ Multilingual: BGE-M3 provides excellent performance across 100+ languages

๐Ÿš€ Quick Start

Install & Run with uvx (Recommended)

# Run directly without installation
uvx aas-lancedb-mcp --help

# Or install globally
uv tool install aas-lancedb-mcp
aas-lancedb-mcp --version

Install from Source

git clone https://github.com/applied-ai-systems/aas-lancedb-mcp.git
cd aas-lancedb-mcp
uv tool install .

๐Ÿ› ๏ธ MCP Capabilities Overview

๐Ÿ”ง 10 Database Tools

Tool Purpose Example
create_table Create tables with schema Create products table with searchable descriptions
list_tables Show all tables Get overview of database contents
describe_table Get table schema & info Understand table structure and metadata
drop_table Delete tables Remove unused tables
insert Add data (auto-embeddings) Insert product with searchable description
select Query with filtering/sorting Find products by price range
update Modify data (auto-embeddings) Update product info with new description
delete Remove rows by conditions Delete discontinued products
search Semantic text search "Find sustainable products" โ†’ matches related items
migrate_table Safe schema changes Add columns or change structure safely

๐Ÿ“ Dynamic Resources

Resources provide AI agents with real-time database insights:

  • lancedb://overview - Complete database statistics and table summary
  • lancedb://tables/{name}/schema - Table schema, columns, searchable fields
  • lancedb://tables/{name}/sample - Sample data for understanding contents
  • lancedb://tables/{name}/stats - Column statistics, data quality metrics

๐Ÿ’ฌ 5 Intelligent Prompts

AI-powered guidance for database operations:

  • analyze_table - Generate insights about data patterns and quality
  • design_schema - Help design optimal table schemas for use cases
  • optimize_queries - Performance optimization recommendations
  • troubleshoot_performance - Diagnose and solve database issues
  • migration_planning - Plan safe schema migrations step-by-step

๐Ÿ“‹ Usage Examples

Creating a Product Catalog

{
  "tool": "create_table",
  "arguments": {
    "schema": {
      "name": "products", 
      "columns": [
        {"name": "title", "type": "text", "required": true, "searchable": true},
        {"name": "description", "type": "text", "searchable": true},
        {"name": "price", "type": "float", "required": true},
        {"name": "category", "type": "text", "required": true},
        {"name": "metadata", "type": "json"}
      ],
      "description": "E-commerce product catalog with semantic search"
    }
  }
}

Adding Products (Embeddings Generated Automatically)

{
  "tool": "insert", 
  "arguments": {
    "data": {
      "table_name": "products",
      "data": {
        "title": "Eco-Friendly Water Bottle", 
        "description": "Sustainable stainless steel water bottle with insulation",
        "price": 24.99,
        "category": "sustainability",
        "metadata": {"brand": "EcoLife", "material": "stainless_steel"}
      }
    }
  }
}

Semantic Search (Natural Language)

{
  "tool": "search",
  "arguments": {
    "query": {
      "table_name": "products",
      "query": "environmentally friendly drinking containers",
      "limit": 5
    }
  }
}

Database Inspection (Resources)

{
  "resource": "lancedb://tables/products/sample"
}

Returns sample product data for AI agents to understand the table structure.

AI Guidance (Prompts)

{
  "prompt": "design_schema",
  "arguments": {
    "use_case": "Customer support ticket system",
    "data_types": "ticket text, priority levels, timestamps", 
    "search_requirements": "semantic search across ticket descriptions"
  }
}

Returns AI-generated recommendations for optimal table design.

โš™๏ธ Configuration

Claude Desktop Setup

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "aas-lancedb": {
      "command": "aas-lancedb-mcp",
      "args": ["--db-uri", "~/my_database"],
      "env": {
        "EMBEDDING_MODEL": "BAAI/bge-m3"
      }
    }
  }
}

Environment Variables

export LANCEDB_URI="./my_database"      # Database location
export EMBEDDING_MODEL="BAAI/bge-m3"    # Embedding model (default)
export EMBEDDING_DEVICE="cpu"           # cpu or cuda

Command Line Options

aas-lancedb-mcp --help                   # Show help
aas-lancedb-mcp --version                # Show version  
aas-lancedb-mcp --db-uri ./my_db         # Custom database path

๐Ÿ—๏ธ Architecture

Enhanced MCP Server Architecture
โ”œโ”€โ”€ ๐Ÿ”ง Tools (10)           - Database operations (CRUD, search, migrate)
โ”œโ”€โ”€ ๐Ÿ“ Resources (dynamic)   - Real-time database introspection  
โ”œโ”€โ”€ ๐Ÿ’ฌ Prompts (5)          - AI guidance for database tasks
โ”œโ”€โ”€ ๐Ÿค– BGE-M3 Embeddings    - Automatic 1024D multilingual vectors
โ”œโ”€โ”€ ๐Ÿ›ก๏ธ Safe Migrations      - Schema evolution with validation
โ””โ”€โ”€ ๐Ÿ“Š Rich Metadata        - Column types, constraints, statistics

Key Technical Features

  • ๐ŸŽฏ Database-like Interface: Familiar SQL-style operations hiding vector complexity
  • ๐Ÿค– Automatic Embedding Generation: BGE-M3 creates vectors for searchable text columns
  • ๐Ÿ” Hybrid Search: Combine semantic similarity with traditional filtering
  • ๐Ÿ“Š Dynamic Resources: Real-time database inspection for AI agents
  • ๐Ÿ’ก Contextual Prompts: AI guidance using actual database state
  • ๐Ÿ›ก๏ธ Migration Safety: Backup, validate, and rollback capabilities
  • ๐ŸŒ Multilingual: BGE-M3 excels across 100+ languages

๐Ÿงช Development & Testing

# Clone and setup
git clone https://github.com/applied-ai-systems/aas-lancedb-mcp.git
cd aas-lancedb-mcp

# Install dependencies
uv sync --all-extras

# Run tests
uv run pytest

# Run tests with coverage  
uv run pytest --cov=src --cov-report=term-missing

# Format and lint
uv run ruff format .
uv run ruff check .

# Test CLI
uv run aas-lancedb-mcp --help

๐Ÿš€ Performance & Scalability

  • BGE-M3 Embeddings: 1024 dimensions, excellent multilingual performance
  • LanceDB Backend: Columnar vector database optimized for scale
  • Efficient Operations: Automatic embedding caching and batch processing
  • Memory Management: Lazy loading and streaming for large datasets
  • Search Performance: HNSW indexing for fast vector similarity search

๐Ÿค Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Make changes with tests (pytest tests/)
  4. Format code (uv run ruff format .)
  5. Submit Pull Request

๐Ÿ“„ License

MIT License - see LICENSE file for details.

๐Ÿ™ Acknowledgments

๐Ÿ“š Related MCP Projects


Ready to supercharge your AI agents with powerful database capabilities? ๐Ÿš€

uvx aas-lancedb-mcp --help

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured