Skip to main content

A SQLite MCP server with JSONB support, database administration tools, and advanced database operations

Project description

SQLite MCP Server

Last Updated January 13, 2026 - Production/Stable v2.6.5

Enterprise-grade SQLite with AI-native JSON operations & intelligent workflow automation โ€“ v2.6.5

GitHub Docker Pulls License: MIT Version Status MCP Registry PyPI Security CodeQL Type Safety

Transform SQLite into a powerful, AI-ready database engine with 73 specialized tools for advanced analytics, JSON operations, text processing, vector search, geospatial operations, and intelligent workflow automation.

Wiki โ€ข Changelog โ€ข Release Article


๐Ÿ“‹ Table of Contents

Quick Start

Configuration & Usage

Resources & Information


โœ… Quick Test - Verify Everything Works

Test all 73 tools in 30 seconds!

Quick smoke test:

python test_runner.py --quick

Standard comprehensive test (recommended):

python test_runner.py --standard

Full test suite with edge cases:

python test_runner.py --full

Expected output:

๐Ÿš€ SQLite MCP Server Comprehensive Test Suite v2.6.5
================================================================

๐Ÿ” Environment Detection:
  โœ… SQLite 3.50.4 (JSONB supported)
  โœ… Python 3.14.x  
  โœ… MCP 1.14.0
  โœ… Pyright strict type checking: PASS

๐Ÿ“Š Testing 73 Tools across 14 categories...

โœ… Core Database Operations (8/8 passed)
โœ… JSON Helper Tools (6/6 passed)  
โœ… JSON Operations (12/12 passed)  
โœ… Text Processing (8/8 passed)
๐ŸŽ‰ SUCCESS: All 73 tools tested successfully!

๐Ÿ›ก๏ธ Security Testing

NEW: Comprehensive SQL injection protection testing

Test SQL injection protection (from tests directory):

cd tests && python test_sql_injection.py

Expected result: ๐Ÿ›ก๏ธ Overall security posture: STRONG

What it tests:

  • Protection against the SQL injection vulnerability found in original Anthropic SQLite MCP server
  • 11 different attack vectors including multiple statements, UNION injection, blind injection
  • Parameter binding protection with malicious payloads
  • Stacked queries and comment-based injection attempts

โฌ†๏ธ Back to Table of Contents

๐Ÿš€ Quick Start

Option 1: Docker (Recommended)

Pull and run instantly:

docker pull writenotenow/sqlite-mcp-server:latest

Run with volume mount:

docker run -i --rm \
  -v $(pwd):/workspace \
  writenotenow/sqlite-mcp-server:latest \
  --db-path /workspace/database.db

๐Ÿ›ก๏ธ Supply Chain Security

For enhanced security and reproducible builds, use SHA-pinned images:

Find available SHA tags at: https://hub.docker.com/r/writenotenow/sqlite-mcp-server/tags Look for tags starting with "master-" or "sha256-" for cryptographically verified builds

Option 1: Human-readable timestamped builds (recommended)

docker pull writenotenow/sqlite-mcp-server:master-YYYYMMDD-HHMMSS-<commit>

Option 2: Multi-arch manifest digest (maximum security)

docker pull writenotenow/sqlite-mcp-server@sha256:<manifest-digest>

Example: Run with cryptographically verified image

docker run -i --rm \
  -v $(pwd):/workspace \
  writenotenow/sqlite-mcp-server:master-YYYYMMDD-HHMMSS-<commit> \
  --db-path /workspace/database.db

How to Find SHA Tags:

  1. Visit Docker Hub Tags
  2. For convenience: Use master-YYYYMMDD-HHMMSS-<commit> tags (human-readable, multi-arch)
  3. For maximum security: Use sha256-<hash> tags (manifest digests, immutable)

Understanding SHA Tags:

  • ๐Ÿท๏ธ master-YYYYMMDD-HHMMSS-<commit> - Human-readable, timestamped, multi-arch safe
  • ๐Ÿ”’ sha256-<manifest-digest> - Multi-arch manifest digest (works on all architectures)
  • โš ๏ธ Architecture-specific digests - Only for debugging specific architectures

Security Features:

  • โœ… Build Provenance - Cryptographic proof of build process
  • โœ… SBOM Available - Complete software bill of materials
  • โœ… Supply Chain Attestations - Verifiable build integrity
  • โœ… Reproducible Builds - Exact image verification for compliance

Option 2: Python Installation

Install from PyPI:

pip install sqlite-mcp-server-enhanced

Or install from source:

git clone https://github.com/neverinfamous/sqlite-mcp-server.git

Navigate to directory:

cd sqlite-mcp-server

Install requirements:

pip install -r requirements.txt

Run the server:

python start_sqlite_mcp.py --db-path ./database.db

Option 3: Test in 30 Seconds

Clone repository:

git clone https://github.com/neverinfamous/sqlite-mcp-server.git

Navigate to directory:

cd sqlite-mcp-server

Run quick test:

python test_runner.py --quick

๐Ÿ†• NEW in v2.6.4: Tool Filtering

Selectively enable/disable tools via SQLITE_MCP_TOOL_FILTER environment variable:

  • Address MCP client tool limits (Windsurf's 100-tool limit, Cursor stability)
  • Reduce token overhead by exposing only needed tools
  • Group-based filtering (-vector, -stats) and individual tool control (+vacuum_database)

See Tool Filtering for complete documentation.

v2.6.0: Complete JSON Operations Suite

5 Major Improvements in this release:

  • ๐ŸŽฏ JSON Helper Tools - 6 specialized tools for simplified JSON operations with path validation and merging
  • ๐Ÿค– JSON Auto-Normalization - Automatically fixes Python-style JSON with configurable strict mode
  • ๐Ÿ›ก๏ธ Parameter Binding Interface - Enhanced MCP tools with SQL injection prevention
  • ๐Ÿ“ฆ Automatic Parameter Serialization - Direct object/array parameters, no manual JSON.stringify()
  • ๐Ÿง  Enhanced JSON Error Diagnostics - Intelligent error categorization with contextual guidance

โšก Install to Cursor IDE

One-Click Installation

Click the button below to install directly into Cursor:

Install to Cursor

Or copy this deep link:

cursor://anysphere.cursor-deeplink/mcp/install?name=SQLite%20MCP%20Server&config=eyJzcWxpdGUtbWNwIjp7ImFyZ3MiOlsicnVuIiwiLWkiLCItLXJtIiwiLXYiLCIkKHB3ZCk6L3dvcmtzcGFjZSIsIndyaXRlbm90ZW5vdy9zcWxpdGUtbWNwLXNlcnZlcjpsYXRlc3QiLCItLWRiLXBhdGgiLCIvd29ya3NwYWNlL3NxbGl0ZV9tY3AuZGIiXSwiY29tbWFuZCI6ImRvY2tlciJ9fQ==

Prerequisites

  • โœ… Docker installed and running
  • โœ… ~500MB disk space available

Configuration

After installation, Cursor will use this Docker-based configuration:

{
  "sqlite-mcp": {
    "command": "docker",
    "args": [
      "run", "-i", "--rm",
      "-v", "$(pwd):/workspace",
      "writenotenow/sqlite-mcp-server:latest",
      "--db-path", "/workspace/sqlite_mcp.db"
    ]
  }
}

๐Ÿ“– See Full Installation Guide โ†’


๐Ÿ”ฅ Core Capabilities

  • ๐Ÿ“Š Statistical Analysis - Descriptive stats, percentiles, time series analysis
  • ๐Ÿ” Advanced Text Processing - Regex, fuzzy matching, phonetic search, similarity
  • ๐Ÿง  Vector/Semantic Search - AI-native embeddings, cosine similarity, hybrid search
  • ๐Ÿ—บ๏ธ SpatiaLite Geospatial - Enterprise GIS with spatial indexing and operations
  • ๐Ÿ” Transaction Safety - Auto-wrapped transactions with rollback protection
  • ๐ŸŽ›๏ธ 73 Specialized Tools - Complete database administration and analytics suite

๐Ÿข Enterprise Features

  • ๐Ÿ“ˆ Business Intelligence - Integrated insights memo and workflow automation
  • ๐Ÿ”„ Backup/Restore - Enterprise-grade operations with integrity verification
  • ๐ŸŽฏ Full-Text Search (FTS5) - Advanced search with BM25 ranking and snippets
  • ๐Ÿ—๏ธ Virtual Tables - Smart CSV/JSON import with automatic type inference
  • โš™๏ธ Advanced PRAGMA - Complete SQLite configuration and optimization

โฌ†๏ธ Back to Table of Contents

๐Ÿ“š MCP Client Configuration

Claude Desktop

{
  "mcpServers": {
    "sqlite-mcp-server": {
      "command": "python",
      "args": ["/path/to/sqlite-mcp-server/start_sqlite_mcp.py", "--db-path", "/path/to/database.db"]
    }
  }
}

Docker with Claude Desktop

{
  "mcpServers": {
    "sqlite-mcp-server": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "-v", "/path/to/project:/workspace", "writenotenow/sqlite-mcp-server:latest", "--db-path", "/workspace/database.db"]
    }
  }
}

โฌ†๏ธ Back to Table of Contents


๐ŸŽ›๏ธ Tool Filtering

New in v2.6.4

Some MCP clients have tool limits (e.g., Windsurf's 100-tool limit). Use the SQLITE_MCP_TOOL_FILTER environment variable to expose only the tools you need.

Filter Syntax

Syntax Description
-group Disable all tools in a group
-tool Disable a specific tool
+tool Re-enable a tool (useful after group disable)

Rules are processed left-to-right, so order matters.

Available Groups

Group Tools Description
core 5 Basic CRUD: read_query, write_query, create_table, list_tables, describe_table
fts 4 Full-text search: fts_search, create_fts_table, rebuild_fts_index, hybrid_search
vector 11 Semantic/vector search and embeddings
json 9 JSON operations and validation
virtual 8 Virtual tables: CSV, R-Tree, series
spatial 7 SpatiaLite geospatial operations
text 7 Text processing: fuzzy, phonetic, regex
stats 8 Statistical analysis
admin 14 Database administration and PRAGMA
misc 5 Miscellaneous utilities

Configuration Examples

With uvx (Cursor/Windsurf):

{
  "mcpServers": {
    "sqlite": {
      "command": "uvx",
      "args": [
        "--from", "git+https://github.com/neverinfamous/sqlite-mcp-server.git",
        "mcp-server-sqlite", "--db-path", "/path/to/database.db"
      ],
      "env": {
        "SQLITE_MCP_TOOL_FILTER": "-vector,-stats,-spatial,-text"
      }
    }
  }
}

With Docker:

{
  "mcpServers": {
    "sqlite": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "-e", "SQLITE_MCP_TOOL_FILTER=-vector,-stats,-spatial,-text",
        "-v", "/path/to/project:/workspace",
        "writenotenow/sqlite-mcp-server:latest",
        "--db-path", "/workspace/database.db"
      ]
    }
  }
}

Common Configurations

Reduce to ~50 tools (Windsurf-compatible):

SQLITE_MCP_TOOL_FILTER="-vector,-stats,-spatial,-text"

Core + JSON only (minimal footprint):

SQLITE_MCP_TOOL_FILTER="-fts,-vector,-virtual,-spatial,-text,-stats,-admin,-misc"

Disable admin but keep vacuum and backup:

SQLITE_MCP_TOOL_FILTER="-admin,+vacuum_database,+backup_database"

Read-only mode (disable write operations):

SQLITE_MCP_TOOL_FILTER="-write_query,-create_table"

โฌ†๏ธ Back to Table of Contents

๐ŸŽจ Usage Examples

Data Analysis Workflow

  1. Quick validation:
python test_runner.py --quick
  1. Start with your data:
python start_sqlite_mcp.py --db-path ./sales_data.db
  1. Use with Claude/Cursor for:
    • Statistical analysis of your datasets
    • Text processing and pattern extraction
    • Vector similarity search
    • Geospatial analysis and mapping
    • Business intelligence insights

Docker Development

Development with live reload:

docker run -i --rm \
  -v $(pwd):/workspace \
  -e SQLITE_DEBUG=true \
  writenotenow/sqlite-mcp-server:latest \
  --db-path /workspace/dev.db

๐ŸŽฏ JSON Helper Tools - Simplified JSON Operations

NEW in v2.6.0: Six powerful JSON helper tools that make complex JSON operations simple:

// โœ… Insert JSON with auto-normalization
json_insert({
  "table": "products",
  "column": "metadata", 
  "data": {'name': 'Product', 'active': True, 'price': None}
})

// โœ… Update JSON by path
json_update({
  "table": "products",
  "column": "metadata",
  "path": "$.price",
  "value": 29.99,
  "where_clause": "id = 1"
})

// โœ… Query JSON with complex filtering
json_query({
  "table": "products",
  "column": "metadata",
  "filter_paths": {"$.category": "electronics"},
  "select_paths": ["$.name", "$.price"]
})

JSON Helper Tools:

  • ๐ŸŽฏ json_insert - Insert JSON data with auto-normalization
  • ๐Ÿ”„ json_update - Update JSON by path with creation support
  • ๐Ÿ” json_select - Extract JSON data with multiple output formats
  • ๐Ÿ”Ž json_query - Complex JSON filtering and aggregation
  • โœ… json_validate_path - Validate JSON paths with security checks
  • ๐Ÿ”— json_merge - Merge JSON objects with conflict resolution

Auto-normalization still works:

  • ๐Ÿ”ง Single quotes โ†’ Double quotes
  • ๐Ÿ”ง Python True/False โ†’ JSON true/false
  • ๐Ÿ”ง Python None โ†’ JSON null
  • ๐Ÿ”ง Trailing commas removed
  • ๐Ÿ›ก๏ธ Security validation prevents malicious input

๐Ÿง  Enhanced JSON Error Diagnostics

Enhanced in v2.6.0: When JSON validation fails, get intelligent, contextual error messages with specific guidance:

// โŒ Invalid JSON input:
validate_json('{key_without_quotes: "value"}')

// โœ… Enhanced error response:
{
  "valid": false,
  "error": "Expecting property name enclosed in double quotes: line 1 column 2 (char 1)",
  "enhanced_message": "JSON validation failed (structural_syntax): Expecting property name...",
  "error_context": {
    "error_type": "structural_syntax",
    "security_concern": false,
    "suggestions": [
      "Ensure all object keys are properly quoted strings",
      "Check for missing colons (:) between keys and values",
      "Verify proper key-value pair structure: \"key\": \"value\""
    ]
  }
}

Enhanced Error Categories:

  • ๐Ÿ”ง Structural Issues - Missing quotes, colons, brackets with specific fix suggestions
  • ๐Ÿ›ก๏ธ Security Warnings - Detects potential SQL injection patterns in JSON strings
  • ๐Ÿ“ Encoding Problems - Character encoding and escape sequence guidance
  • ๐ŸŽฏ Context-Aware Tips - Line/column position with targeted recommendations

๐Ÿ›ก๏ธ Enhanced Parameter Binding + Auto-Serialization

NEW in v2.6.0: Built-in SQL injection protection with automatic JSON serialization:

// โœ… SECURE: Parameter binding prevents injection
read_query({
  "query": "SELECT * FROM users WHERE name = ? AND age > ?",
  "params": ["John", 25]
})

// โœ… NEW: Direct object/array parameters (auto-serialized)
write_query({
  "query": "INSERT INTO products (metadata, tags) VALUES (?, ?)",
  "params": [
    {"name": "Product", "price": 29.99, "active": true},  // Auto-serialized to JSON
    ["electronics", "featured", "new"]                    // Auto-serialized to JSON
  ]
})

// โœ… SIMPLIFIED: No more manual JSON.stringify()
// Before v2.6.0:
write_query({
  "query": "INSERT INTO table (data) VALUES (?)",
  "params": [JSON.stringify({"key": "value"})]  // Manual serialization required
})

// After v2.6.0:
write_query({
  "query": "INSERT INTO table (data) VALUES (?)",
  "params": [{"key": "value"}]  // Automatic serialization!
})

v2.6.0 Benefits:

  • ๐Ÿ›ก๏ธ SQL Injection Prevention - Parameter binding treats malicious input as literal data
  • ๐Ÿ“ฆ Auto-Serialization - Objects and arrays automatically converted to JSON strings
  • ๐Ÿ”„ Backward Compatible - Existing queries continue to work unchanged
  • โšก Better Performance - Query plan caching and parameter optimization
  • ๐Ÿ“ Cleaner API - No manual JSON.stringify() or parameter preparation needed

โฌ†๏ธ Back to Table of Contents

๐Ÿ“Š Tool Categories

The SQLite MCP Server provides 73 specialized tools across 14 categories:

๐Ÿ’ก Want the complete tool list? See the detailed tool reference with descriptions for all 73 tools, 7 resources, and 7 prompts.

Category Tool Count Description
Core Database 15 CRUD operations, schema management, transactions
JSON Helper Tools 6 Simplified JSON operations, path validation, merging
Text Processing 9 Regex, fuzzy matching, phonetic search, similarity
Statistical Analysis 8 Descriptive stats, percentiles, time series
Virtual Tables 8 CSV, R-Tree, series generation
Semantic Search 8 Embeddings, similarity, hybrid search
Geospatial 7 Spatial indexing, geometric operations
PRAGMA Operations 5 Configuration, optimization, introspection
Full-Text Search 3 FTS5 creation, indexing, BM25 ranking
Vector Optimization 2 ANN search, clustering, performance
Data Analysis 2 Smart CSV/JSON import with type inference
Resources 7 Database meta-awareness, performance insights
Prompts 7 Guided workflows, optimization recipes

๐Ÿ’ก Cursor Users: You can enable only the categories you need in your MCP client settings to reduce tool noise and improve stability. Each number above shows the count of tools in that category.

โฌ†๏ธ Back to Table of Contents

๐Ÿ† Why Choose SQLite MCP Server?

โœ… AI-Friendly - JSON auto-normalization and intelligent error messages reduce debugging time
โœ… Just Works - Built-in security and parameter binding with zero configuration
โœ… Smart Diagnostics - Enhanced error context provides actionable guidance when issues occur
โœ… Type Safe - Passes strict Pyright type checking in Cursor for maximum code quality
โœ… Instantly Testable - Validate all 73 tools in 30 seconds
โœ… Production Ready - Enterprise-grade testing and validation
โœ… Comprehensive - Everything you need in one package
โœ… Docker Ready - Containerized for easy deployment
โœ… Zero Breaking Changes - All existing code continues to work

โฌ†๏ธ Back to Table of Contents

๐Ÿ” AI-Powered Wiki Search

โ†’ Search the Documentation with AI

Can't find what you're looking for? Use our AI-powered search interface to search both SQLite and PostgreSQL MCP Server documentation:

  • ๐Ÿค– Natural Language Queries - Ask questions in plain English and get AI-generated answers
  • โšก Instant Results - AI-enhanced answers with source attribution from both wikis
  • ๐Ÿ“š Comprehensive Coverage - Searches all 73 SQLite tools + 63 PostgreSQL tools (136 total)
  • ๐ŸŽฏ Smart Context - Understands technical questions and provides relevant examples
  • ๐Ÿ”„ Dual Search Modes - AI-Enhanced for synthesized answers, or Raw Docs for direct chunks

Example queries:

  • "How do I prevent SQL injection attacks?"
  • "What statistical analysis tools are available?"
  • "How do I set up vector search with embeddings?"
  • "How do I use JSON helper tools for data normalization?"
  • "What SpatiaLite geospatial operations are available?"

โ†’ Try AI Search Now

The search interface uses Cloudflare's AI Search technology to provide intelligent, context-aware answers from comprehensive wiki documentation for both SQLite and PostgreSQL MCP Servers.

โฌ†๏ธ Back to Table of Contents

๐Ÿ“š Complete Documentation

โ†’ Wiki: Comprehensive Documentation & Examples

Comprehensive documentation including:

  • Detailed tool reference - All 73 tools with examples
  • Advanced configuration - Performance tuning and optimization
  • Integration guides - MCP clients, Docker, CI/CD
  • Feature deep-dives - Text processing, vector search, geospatial
  • Best practices - Query patterns, troubleshooting, workflows
  • API reference - Complete tool schemas and parameters

๐Ÿ“ฐ Read the v2.6.0 Release Article - Learn about JSON operations, auto-normalization, and enhanced security

โ†’ GitHub Gists: Practical Examples & Use Cases

9 curated gists with real-world examples:

  • JSON Helper Tools - Simplified JSON operations with auto-normalization
  • Vector/Semantic Search - AI-native embeddings and similarity search
  • SpatiaLite GIS - Geospatial operations and spatial indexing
  • Performance Optimization - Query tuning and index recommendations
  • Security Best Practices - SQL injection prevention and safe queries
  • Real-World Use Cases - Business intelligence and data analysis workflows
  • Database Migration - Schema evolution and data transformation
  • Docker Deployment - Production containerization strategies
  • Complete Feature Showcase - All 73 tools with comprehensive examples

โฌ†๏ธ Back to Table of Contents

๐Ÿ‘ Contributors

Special thanks to our contributors who help make SQLite MCP Server better:

v2.6.4 - Tool Filtering Feature

  • @Insighttful - Implemented the tool filtering system (PR #50)
    • Added SQLITE_MCP_TOOL_FILTER environment variable
    • Created 10 logical tool groups for flexible filtering
    • Contributed comprehensive test suite (410 lines)
    • Addressed MCP client tool limits (Windsurf, Cursor)

Want to contribute? See our Contributing Guide to get started!

โฌ†๏ธ Back to Table of Contents

๐Ÿ”— Additional Resources

โฌ†๏ธ Back to Table of Contents

๐Ÿš€ Quick Links

Action Command
AI-Powered Search search.adamic.tech
Test Everything python test_runner.py --standard
Docker Quick Start docker run -i --rm -v $(pwd):/workspace writenotenow/sqlite-mcp-server:latest
Install from PyPI pip install sqlite-mcp-server-enhanced
View Full Docs docs/sqlite-mcp-server.wiki
Report Issues GitHub Issues

โฌ†๏ธ Back to Table of Contents

๐Ÿ“ˆ Project Stats

  • 73 Tools across 14 categories (all tested and verified โœ…)
  • 2,000+ lines of comprehensive documentation
  • Multi-platform support (Windows, Linux, macOS)
  • Docker images for amd64 and arm64
  • Strict type checking with Pyright for code quality
  • Enterprise testing with comprehensive validation
  • Active development with regular updates

โฌ†๏ธ Back to Table of Contents

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqlite_mcp_server_enhanced-2.6.5.tar.gz (240.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sqlite_mcp_server_enhanced-2.6.5-py3-none-any.whl (90.3 kB view details)

Uploaded Python 3

File details

Details for the file sqlite_mcp_server_enhanced-2.6.5.tar.gz.

File metadata

File hashes

Hashes for sqlite_mcp_server_enhanced-2.6.5.tar.gz
Algorithm Hash digest
SHA256 96a68f9bc1138732bff09883f54b8db85e197eff43dbe2ca06e3f571427e5b45
MD5 618d361a50dbd54e880413ad0513b4f7
BLAKE2b-256 71477ca142b590c6c913962b990e6227f23f93e8bde9e5abe0eebcd0dfe23869

See more details on using hashes here.

File details

Details for the file sqlite_mcp_server_enhanced-2.6.5-py3-none-any.whl.

File metadata

File hashes

Hashes for sqlite_mcp_server_enhanced-2.6.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d5a8428f90dc8079bfbe43401fa7349c02573c10c06a5446f5defa9167b4efa3
MD5 f3b8f00c93bf81f00f4478f52f13ac3c
BLAKE2b-256 eb5381b7f02e1ce56995fef254624844bab1a1907e9740257b6190b1aa5f11a3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page