Skip to main content

SQLite MCP Server

A Model Context Protocol (MCP) server that provides comprehensive SQLite database management and analysis capabilities. This server allows LLMs to explore database schemas, query data, perform updates, and conduct statistical analysis.

Features

  • Schema Exploration

    • List all tables in the database
    • View detailed schema information for specific tables
    • Examine column types and constraints
  • Data Management

    • Execute read-only SQL queries
    • Perform data modifications (UPDATE, INSERT, DELETE)
    • Safe execution with error handling
  • Data Analysis

    • Basic statistical analysis (row counts, null counts, numeric stats)
    • Detailed analysis including categorical data distributions
    • Automatic type detection and appropriate statistical measures

Prerequisites

  • Python 3.8 or higher
  • SQLite database file
  • Claude Desktop (optional, for desktop integration)

Installation

  1. First, ensure you have the required Python packages:
pip install mcp pandas
  1. Download the SQLite MCP server script:
# Clone this repository or download sqlite_mcp.py directly
curl -O https://raw.githubusercontent.com/yourusername/sqlite-mcp/main/sqlite_mcp.py
  1. For Claude Desktop integration:
# Install using MCP CLI
mcp install sqlite_mcp.py --name "SQLite Explorer" --env DB_PATH=/path/to/your/database.sqlite

Usage

  • Locate the claude_desktop_config.json file and add below to the mcpServers section
  • change the paths to the correct ones for your system.
  • Set database location in DB_PATH variable in the .env file.
"sqlite_mcp": {
    "command": "C:\\path\\to\\python.exe",
    "args": [
    "C:\\path\\to\\sqlite-mcp\\server.py"
    ]
}

Available Resources

The server exposes the following MCP resources:

  • schema://tables

    • Lists all available tables in the database
    • Example response:
      Available tables:
      - users
      - products
      - orders
      
  • schema://{table}

    • Returns detailed schema information for a specific table
    • Example response:
      Table: users
      
      Create Statement:
      CREATE TABLE users (
          id INTEGER PRIMARY KEY,
          name TEXT NOT NULL,
          email TEXT UNIQUE
      )
      
      Columns:
      - id (INTEGER) NOT NULL PRIMARY KEY
      - name (TEXT) NOT NULL
      - email (TEXT)
      

Available Tools

query

Execute read-only SQL queries:

SELECT * FROM users LIMIT 5

update_data

Perform data modifications:

INSERT INTO users (name, email) VALUES ('John Doe', 'john@example.com')
UPDATE users SET email = 'new@example.com' WHERE id = 1

analyze_table

Perform statistical analysis on table data:

Parameters:

  • table: Name of the table to analyze
  • analysis_type: Either 'basic' or 'detailed'

Example response:

{
  "row_count": 1000,
  "column_count": 5,
  "null_counts": {
    "id": 0,
    "name": 0,
    "email": 15
  },
  "numeric_columns": {
    "id": {
      "mean": 500.5,
      "std": 288.819,
      "min": 1,
      "max": 1000
    }
  }
}

Security Considerations

The server implements several security measures:

  1. Input validation for all SQL operations
  2. Read-only queries are separated from data modifications
  3. Database connection error handling
  4. SQL injection protection through parameterized queries

Error Handling

The server provides clear error messages for common issues:

  • Database connection failures
  • Invalid SQL syntax
  • Table not found errors
  • Permission issues
  • Type mismatches

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for iflow-mcp-mekanixms-sqlite-mcp-server 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iflow-mcp-mekanixms-sqlite-mcp-server 0.1.0
File Size Uploaded
iflow_mcp_mekanixms_sqlite_mcp_server-0.1.0.tar.gz 6.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for iflow-mcp-mekanixms-sqlite-mcp-server 0.1.0
File Interpreter ABI Platform
iflow_mcp_mekanixms_sqlite_mcp_server-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.7 kB

Release files / iflow_mcp_mekanixms_sqlite_mcp_server-0.1.0.tar.gz

Download URL iflow_mcp_mekanixms_sqlite_mcp_server-0.1.0.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
04da0eafca5619a7fed6f2140bbca1a7034b9761ead95da1a5b63ec677236dde
BLAKE2b-256 checksum
How to use checksums
c7b766c4f72633be7db6d9ab98ac0aacc1218cb9b1ef78d9b03210045032e435
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / iflow_mcp_mekanixms_sqlite_mcp_server-0.1.0-py3-none-any.whl

Download URL iflow_mcp_mekanixms_sqlite_mcp_server-0.1.0-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3efec43887db7995310185800e8a4f94d1e70e51e862f8f2fb342b2b6693ebb6
BLAKE2b-256 checksum
How to use checksums
97bba5215e0abde871cfdf3759ba406ed5ed38e74566f64ef039e5d9ce5abe9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page