sqlite
my mcp server to handle sqlite, generated with cursor/claude
claude mcp add --transport stdio mekanixms-sqlite-mcp-server python sqlite_mcp.py \ --env DB_PATH="Path to your SQLite database file (e.g., /path/to/database.sqlite)"
How to use
This MCP server provides a Python-based interface to manage and analyze a SQLite database. It exposes tools to explore the database schema, run safe read-only or modification-capable SQL queries, and perform basic to detailed statistical analyses on table data. With the available resources, you can list tables, inspect detailed table schemas, query data, and execute updates or inserts as needed. The server is designed to validate inputs, separate read-only queries from modifications, and provide descriptive error messages for common issues, making it suitable for integration with LLM workflows and desktop automation setups like Claude Desktop.
How to install
Prerequisites:
- Python 3.8 or higher
- SQLite database file accessible on your machine
- Optional: Claude Desktop for desktop integration
Installation steps:
- Create and activate a Python virtual environment (optional but recommended):
python -m venv venv
# Windows
venv\Scripts\activate
# macOS/Linux
source venv/bin/activate
- Install required Python packages:
pip install mcp pandas
- Acquire the SQLite MCP server script (sqlite_mcp.py):
# Example: download via curl (adjust URL to your source)
curl -O https://raw.githubusercontent.com/yourusername/sqlite-mcp/main/sqlite_mcp.py
- Run the MCP server locally (adjust path to script as needed):
python sqlite_mcp.py
- Optional Claude Desktop integration (if using Claude):
# Install using MCP CLI with the proper script path and environment variable for DB_PATH
mcp install sqlite_mcp.py --name "SQLite Explorer" --env DB_PATH=/path/to/your/database.sqlite
Note: Ensure the DB_PATH environment variable points to your SQLite database file before starting the server.
Additional notes
Tips and considerations:
- Set DB_PATH to your SQLite database file before launching the server so tools can access the database.
- The server supports schema exploration, including listing all tables and viewing detailed table schemas.
- Use query for read-only SELECT statements and update_data for modifying operations (INSERT, UPDATE, DELETE). All data-modifying operations should be performed with appropriate error handling.
- For Claude Desktop or other integrations, ensure the path to sqlite_mcp.py and the Python interpreter are correctly configured in the MCP configuration.
- If you encounter connection or syntax errors, verify that the SQLite database file is not locked by another process and that the SQL statements are parameterized where applicable.
- The analyze_table tool provides basic and detailed statistics; results include row counts, column counts, null counts, and numeric statistics when applicable.
Related MCP Servers
mcp-vegalite
MCP server from isaacwasserman/mcp-vegalite-server
github-chat
A Model Context Protocol (MCP) for analyzing and querying GitHub repositories using the GitHub Chat API.
nautex
MCP server for guiding Coding Agents via end-to-end requirements to implementation plan pipeline
pagerduty
PagerDuty's official local MCP (Model Context Protocol) server which provides tools to interact with your PagerDuty account directly from your MCP-enabled client.
futu-stock
mcp server for futuniuniu stock
mcp -boilerplate
Boilerplate using one of the 'better' ways to build MCP Servers. Written using FastMCP