npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@berthojoris/mcp-sqlite-server

v1.3.0

Published

A secure SQLite MCP (Model Context Protocol) server for AI agents with granular permissions and comprehensive security features

Readme

SQLite MCP Server

A comprehensive Model Context Protocol (MCP) server implementation for SQLite databases, providing secure and controlled access to SQLite operations through a standardized interface.

npm version License: MIT

📋 Table of Contents

⚡ Quick Start

Get up and running in 30 seconds:

# Run directly with npx (no installation required)
npx @berthojoris/mcp-sqlite-server sqlite:////path/to/database.sqlite list,read,create,update,delete

Or add to your MCP client configuration:

{
  "mcpServers": {
    "sqlite": {
      "command": "npx",
      "args": ["-y", "@berthojoris/mcp-sqlite-server", "sqlite:////path/to/db.sqlite", "list,read,create,update,delete"]
    }
  }
}

🚀 Features

Core Functionality

  • MCP Protocol Compliance: Full implementation of the Model Context Protocol for seamless integration with MCP clients
  • SQLite Integration: Native SQLite support using better-sqlite3 for optimal performance
  • Granular Permissions: Fine-grained permission system with 10 distinct permission types
  • Security First: Comprehensive SQL injection protection and query validation
  • Schema Introspection: Complete database schema analysis and reporting
  • Connection Pooling: Efficient database connection management
  • Audit Logging: Detailed operation logging for security and compliance

Permission System

The server implements a granular permission system with the following types:

  • list - List tables and schemas
  • read - SELECT queries and data retrieval
  • create - INSERT operations
  • update - UPDATE operations
  • delete - DELETE operations
  • execute - Execute stored procedures/functions
  • ddl - Data Definition Language (CREATE, ALTER, DROP)
  • procedure - Stored procedures (N/A for SQLite - reserved for compatibility)
  • transaction - Transaction control (BEGIN, COMMIT, ROLLBACK)
  • utility - Utility operations (VACUUM, ANALYZE, PRAGMA, etc.)

Security Features

  • SQL Injection Prevention: Parameterized queries and pattern detection
  • Query Validation: Comprehensive query analysis and sanitization
  • Permission Enforcement: Operation-level permission checking
  • Rate Limiting: Configurable request rate limiting
  • Audit Trail: Complete operation logging with client tracking
  • Input Sanitization: Parameter validation and sanitization

Auto-Creation Features

  • Database Auto-Creation: Automatically creates database files if they don't exist
  • Directory Auto-Creation: Creates parent directories recursively as needed
  • Intelligent Initialization: Detects new vs existing databases and logs appropriately
  • Zero-Configuration Setup: Works out-of-the-box with any valid SQLite path

📦 Installation

NPX Usage (Recommended)

npx @berthojoris/mcp-sqlite-server sqlite:////path/to/your/database.sqlite list,read,utility

Global Installation

npm install -g @berthojoris/mcp-sqlite-server
mcp-sqlite-server sqlite:////path/to/your/database.sqlite list,read,create,update

Local Installation

npm install @berthojoris/mcp-sqlite-server

🔗 Integration Guide

Standard MCP Configuration

Add this configuration to your MCP client's config file:

{
  "mcpServers": {
    "sqlite": {
      "command": "npx",
      "args": [
        "-y",
        "@berthojoris/mcp-sqlite-server",
        "sqlite:////path/to/database.sqlite",
        "list,read,create,update,delete,utility"
      ]
    }
  }
}

Arguments Explained: | # | Argument | Description | |---|----------|-------------| | 1 | -y | Auto-confirm npx installation | | 2 | @berthojoris/mcp-sqlite-server | Package name | | 3 | sqlite:////path/to/database.sqlite | Database connection string | | 4 | list,read,create,update,delete,utility | Comma-separated permissions |

Config File Locations by Client

| Client | Config File Location | |--------|---------------------| | Claude Desktop (macOS) | ~/Library/Application Support/Claude/claude_desktop_config.json | | Claude Desktop (Windows) | %APPDATA%\Claude\claude_desktop_config.json | | Claude Desktop (Linux) | ~/.config/Claude/claude_desktop_config.json | | Cursor IDE (macOS/Linux) | ~/.cursor/mcp.json | | Cursor IDE (Windows) | %USERPROFILE%\.cursor\mcp.json | | Windsurf IDE | ~/.windsurf/mcp.json | | Cline (VS Code) | VS Code settings.json under cline.mcpServers |

Platform-Specific Path Examples

# macOS/Linux
"sqlite:////Users/yourname/databases/app.sqlite"
"sqlite:////home/user/projects/data.sqlite"

# Windows
"sqlite:///C:/Users/yourname/databases/app.sqlite"

# Relative path (from working directory)
"sqlite://./data/app.sqlite"

# In-memory database
"sqlite://:memory:"

Multiple Databases

{
  "mcpServers": {
    "main-db": {
      "command": "npx",
      "args": ["-y", "@berthojoris/mcp-sqlite-server", "sqlite:////path/to/main.sqlite", "list,read,create,update,delete"]
    },
    "analytics-db": {
      "command": "npx",
      "args": ["-y", "@berthojoris/mcp-sqlite-server", "sqlite:////path/to/analytics.sqlite", "list,read"]
    }
  }
}

🔧 Configuration

Connection String Formats

The server supports multiple SQLite connection string formats:

# Absolute path
sqlite:////absolute/path/to/database.sqlite

# Relative path  
sqlite://./relative/path/to/database.sqlite

# In-memory database
sqlite://:memory:

# Direct file path
/path/to/database.sqlite

Permission Combinations

Detailed Permission Descriptions

Common permission combinations for different use cases:

# Read-only access
list,read

# Basic CRUD operations
list,read,create,update,delete

# Full database access
list,read,create,update,delete,execute,ddl,transaction,utility

# Analytics/reporting
list,read,utility

# Development/testing
list,read,create,update,delete,ddl,transaction,utility

🔌 Available Tools

The MCP server provides 28 powerful tools for comprehensive SQLite database management:

Tools Summary

| # | Tool | Description | Permission | |---|------|-------------|------------| | 1 | sqlite_query | Execute SELECT queries with parameterized support | read | | 2 | sqlite_insert | Insert single records into tables | create | | 3 | sqlite_update | Update existing records | update | | 4 | sqlite_delete | Delete records from tables | delete | | 5 | sqlite_schema | Get comprehensive schema information | list | | 6 | sqlite_tables | List all tables in database | list | | 7 | sqlite_relations | Analyze table relationships and foreign keys | list | | 8 | sqlite_transaction | Execute multiple queries atomically | transaction | | 9 | sqlite_backup | Create database backup | utility | | 10 | sqlite_bulk_insert | Bulk insert with relational support | create | | 11 | sqlite_bulk_update | Bulk update with progress tracking | update | | 12 | sqlite_bulk_delete | Bulk delete with cascade support | delete | | 13 | sqlite_ddl | Schema management (CREATE/ALTER/DROP) | ddl | | 14 | sqlite_views | Create and manage database views | ddl | | 15 | sqlite_indexes | Index management and optimization | list, ddl | | 16 | sqlite_constraints | View constraints and foreign keys | list | | 17 | sqlite_migrate | Data migration between tables | read, create, update | | 18 | sqlite_backup_restore | Backup tables and restore from SQL | utility, read, ddl | | 19 | sqlite_column_statistics | Column statistics and data profiling | read | | 20 | sqlite_database_summary | Database summary and metadata | read | | 21 | sqlite_schema_erd | Entity relationship diagram data | read | | 22 | sqlite_schema_rag_context | RAG context for AI models | read | | 23 | sqlite_analyze_query | Query analysis and execution plans | read | | 24 | sqlite_optimization_hints | Query optimization suggestions | read | | 25 | sqlite_database_health_check | Database health and integrity checks | read | | 26 | sqlite_unused_indexes | Find unused or redundant indexes | read | | 27 | sqlite_connection_pool_stats | Connection pool statistics | read |

Tool Categories

Data Query & Retrieval:

  • sqlite_query - Run SELECT statements
  • sqlite_schema - Inspect database structure
  • sqlite_tables - List available tables
  • sqlite_relations - Analyze table relationships and foreign keys

Data Manipulation (CRUD):

  • sqlite_insert - Create new records
  • sqlite_update - Modify existing records
  • sqlite_delete - Remove records

Bulk Operations:

  • sqlite_bulk_insert - Insert many records efficiently
  • sqlite_bulk_update - Update many records at once
  • sqlite_bulk_delete - Delete many records with cascade support

Schema Management:

  • sqlite_ddl - CREATE/ALTER/DROP tables and indexes
  • sqlite_views - Create, drop, and manage database views
  • sqlite_indexes - Index management and optimization

Constraints & Relationships:

  • sqlite_constraints - View and analyze constraints and foreign keys

Data Migration:

  • sqlite_migrate - Clone tables, compare structures, and copy data

Database Operations:

  • sqlite_transaction - Atomic multi-query execution
  • sqlite_backup - Database backup utility
  • sqlite_backup_restore - Backup tables and restore from SQL files

📖 Full Documentation: See DOCUMENTATIONS.md for detailed parameters, examples, and response formats for each tool.

🔒 Security Guidelines

Best Practices

  1. Principle of Least Privilege: Only grant necessary permissions
  2. Use Parameterized Queries: Always use parameters for dynamic values
  3. Regular Backups: Implement automated backup strategies
  4. Monitor Audit Logs: Review operation logs regularly
  5. Connection Limits: Set appropriate connection pool limits
  6. Read-Only When Possible: Use read-only mode for reporting/analytics

Security Features

  • SQL Injection Protection: Automatic detection of dangerous patterns
  • Query Validation: Comprehensive query analysis before execution
  • Permission Enforcement: Operation-level access control
  • Rate Limiting: Configurable request throttling
  • Audit Logging: Complete operation tracking
  • Input Sanitization: Parameter validation and cleaning

Dangerous Operations

The server automatically blocks or restricts:

  • Multiple statement execution
  • Dangerous SQL patterns (UNION-based injections, etc.)
  • Unauthorized schema modifications
  • Excessive query complexity
  • Operations without proper permissions

📄 License

MIT License - see LICENSE file for details.

🆘 Support

For issues, questions, or contributions:

Note: This server is designed for secure, controlled access to SQLite databases through the Model Context Protocol. Always follow security best practices and regularly review audit logs in production environments.


Last Updated: 2025-12-20 20:00:00