iven86/sqlite-mcp-server
If you are the rightful owner of sqlite-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
SQLite MCP Server is a modular server designed for secure SQLite database operations, providing a RESTful HTTP API that integrates with VS Code and AI agents.
SQLite MCP Server
A modular Model Context Protocol (MCP) server for SQLite database operations with HTTP API support.
Project Information
- Version: 1.0.0
- License: CC BY-NC-SA 4.0 (Non-Commercial)
- Python: 3.8+ (Tested on 3.12.3)
- Dependencies: Python standard library only
Overview
SQLite MCP Server implements the Model Context Protocol specification for secure SQLite database operations. It provides a RESTful HTTP API that integrates seamlessly with VS Code and AI agents for database management tasks.
Key Features
- Modular Architecture - Clean separation of concerns with dedicated modules
- HTTP API - RESTful endpoints following MCP protocol
- Security First - SQL injection protection, query validation, timeout controls
- System Integration - Comprehensive logging, graceful shutdown, systemd support
- Multi-Database - Support for multiple SQLite database connections
- AI Integration - Compatible with VS Code MCP settings for AI agent interactions
Quick Start
Prerequisites
- Python 3.8+ (Tested on Python 3.12.3)
- No external dependencies required
Installation & Basic Usage
# Start the server
python3 main.py
# Or use the start script (Linux/macOS)
chmod +x scripts/start_server.sh
./scripts/start_server.sh
Quick Test
# Health check
curl http://localhost:9999/health
# List available tools
curl -X POST http://localhost:9999/ \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "tools/list", "id": "1"}'
Available Tools
Tool | Description | Use Case |
---|---|---|
connect_database | Connect to a SQLite database file | Database connection |
query | Execute SQL queries with parameters | Data retrieval and operations |
get_tables | List all tables in database | Schema exploration |
get_schema | Get table schema information | Schema inspection |
create | Insert new records into tables | Data creation |
read | Read records with filtering and sorting | Data retrieval |
update | Update existing records | Data modification |
delete | Delete records from tables | Data deletion |
analyze_table | Get table statistics and analysis | Performance analysis |
search_data | Search across multiple tables | Data discovery |
VS Code Integration
Add to your VS Code settings.json
:
{
"mcp": {
"servers": {
"sqlite-database": {
"url": "http://localhost:9999"
}
}
}
}
Then ask AI agents:
- "Show me all tables in the database"
- "Execute this SQL query: SELECT * FROM users LIMIT 10"
- "What's the schema of the products table?"
Architecture
The project follows a modular structure:
sqlite_mcp_server/
āāā LICENSE # MIT license file
āāā main.py # Entry point and CLI parsing
āāā README.md # Project documentation
āāā requirements.txt # Python dependencies
āāā src/ # Core MCP modules
ā āāā __init__.py # Package initialization
ā āāā server.py # Core MCP server implementation
ā āāā tools.py # MCP tool definitions and handlers
ā āāā http_handler.py # HTTP request/response handling
ā āāā database.py # Database operations and utilities
ā āāā models.py # Data models and error classes
ā āāā utils.py # Common utility functions
āāā scripts/
ā āāā start_server.sh # Server startup script
ā āāā deploy.sh # System deployment script
āāā logs/ # Server logs directory
āāā wiki/ # Documentation files
āāā API-Reference
āāā Configuration
āāā Contributing
āāā Examples
āāā Getting-Started
āāā Production-Deployment
āāā Troubleshooting
Documentation
- Getting Started - Installation and setup guide
- Configuration - Configuration reference
- API Reference - API documentation and MCP tools
- Examples - Usage examples and code samples
- System Deployment - Service setup and management
- Troubleshooting - Common issues and solutions
- Contributing - Development guide
Visit our complete Wiki Documentation for more information.
System Deployment
# Deploy as systemd service
sudo ./scripts/deploy.sh
# Service management
sudo systemctl start sqlite-mcp-server
sudo systemctl enable sqlite-mcp-server
sudo systemctl status sqlite-mcp-server
Security Features
- SQL injection protection with parameterized queries
- Query validation and timeout controls
- Result size limits to prevent memory exhaustion
- File access control for database security
- Request size limits to prevent DoS attacks
Contributing
See the Contributing Guide for development setup, code standards, testing requirements, and pull request process.
License
This project is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Commercial use requires explicit permission from the author. See the file for details.
Links
- GitHub Wiki - Complete project documentation
- MCP Protocol Specification - Model Context Protocol details
For help, check the Troubleshooting Guide.