Get the FREE Ultimate OpenClaw Setup Guide →

sqlite

my mcp server to handle sqlite, generated with cursor/claude

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
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:

  1. Create and activate a Python virtual environment (optional but recommended):
python -m venv venv
# Windows
venv\Scripts\activate
# macOS/Linux
source venv/bin/activate
  1. Install required Python packages:
pip install mcp pandas
  1. 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
  1. Run the MCP server locally (adjust path to script as needed):
python sqlite_mcp.py
  1. 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

Sponsor this space

Reach thousands of developers