sqlite-mcp-server

iven86/sqlite-mcp-server

3.2

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.

Tools
10
Resources
0
Prompts
0

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

ToolDescriptionUse Case
connect_databaseConnect to a SQLite database fileDatabase connection
queryExecute SQL queries with parametersData retrieval and operations
get_tablesList all tables in databaseSchema exploration
get_schemaGet table schema informationSchema inspection
createInsert new records into tablesData creation
readRead records with filtering and sortingData retrieval
updateUpdate existing recordsData modification
deleteDelete records from tablesData deletion
analyze_tableGet table statistics and analysisPerformance analysis
search_dataSearch across multiple tablesData 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

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


For help, check the Troubleshooting Guide.


Support the Project