Provides comprehensive SQLite database access with granular permissions, enabling secure query execution, schema introspection, transaction management, and database operations through a controlled interface with SQL injection protection and audit logging.
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.
📋 Table of Contents
⚡ Quick Start
Get up and running in 30 seconds:
Or add to your MCP client configuration:
🚀 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-sqlite3for optimal performanceGranular 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 schemasread- SELECT queries and data retrievalcreate- INSERT operationsupdate- UPDATE operationsdelete- DELETE operationsexecute- Execute stored procedures/functionsddl- 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)
Global Installation
Local Installation
🔗 Integration Guide
Standard MCP Configuration
Add this configuration to your MCP client's config file:
Arguments Explained:
# | Argument | Description |
1 |
| Auto-confirm npx installation |
2 |
| Package name |
3 |
| Database connection string |
4 |
| Comma-separated permissions |
Config File Locations by Client
Client | Config File Location |
Claude Desktop (macOS) |
|
Claude Desktop (Windows) |
|
Claude Desktop (Linux) |
|
Cursor IDE (macOS/Linux) |
|
Cursor IDE (Windows) |
|
Windsurf IDE |
|
Cline (VS Code) | VS Code
under
|
Platform-Specific Path Examples
Multiple Databases
🔧 Configuration
Connection String Formats
The server supports multiple SQLite connection string formats:
Permission Combinations
Detailed Permission Descriptions
Common permission combinations for different use cases:
🔌 Available Tools
The MCP server provides 28 powerful tools for comprehensive SQLite database management:
Tools Summary
# | Tool | Description | Permission |
1 | Execute SELECT queries with parameterized support |
| |
2 | Insert single records into tables |
| |
3 | Update existing records |
| |
4 | Delete records from tables |
| |
5 | Get comprehensive schema information |
| |
6 | List all tables in database |
| |
7 | Analyze table relationships and foreign keys |
| |
8 | Execute multiple queries atomically |
| |
9 | Create database backup |
| |
10 | Bulk insert with relational support |
| |
11 | Bulk update with progress tracking |
| |
12 | Bulk delete with cascade support |
| |
13 | Schema management (CREATE/ALTER/DROP) |
| |
14 | Create and manage database views |
| |
15 | Index management and optimization |
,
| |
16 | View constraints and foreign keys |
| |
17 | Data migration between tables |
,
,
| |
18 | Backup tables and restore from SQL |
,
,
| |
19 | Column statistics and data profiling |
| |
20 | Database summary and metadata |
| |
21 | Entity relationship diagram data |
| |
22 | RAG context for AI models |
| |
23 | Query analysis and execution plans |
| |
24 | Query optimization suggestions |
| |
25 | Database health and integrity checks |
| |
26 | Find unused or redundant indexes |
| |
27 | Connection pool statistics |
|
Tool Categories
Data Query & Retrieval:
sqlite_query- Run SELECT statementssqlite_schema- Inspect database structuresqlite_tables- List available tablessqlite_relations- Analyze table relationships and foreign keys
Data Manipulation (CRUD):
sqlite_insert- Create new recordssqlite_update- Modify existing recordssqlite_delete- Remove records
Bulk Operations:
sqlite_bulk_insert- Insert many records efficientlysqlite_bulk_update- Update many records at oncesqlite_bulk_delete- Delete many records with cascade support
Schema Management:
sqlite_ddl- CREATE/ALTER/DROP tables and indexessqlite_views- Create, drop, and manage database viewssqlite_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 executionsqlite_backup- Database backup utilitysqlite_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
Principle of Least Privilege: Only grant necessary permissions
Use Parameterized Queries: Always use parameters for dynamic values
Regular Backups: Implement automated backup strategies
Monitor Audit Logs: Review operation logs regularly
Connection Limits: Set appropriate connection pool limits
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:
GitHub Issues: Repository Issues
Documentation: Full Documentation
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