sqlite-mcp-server

enesmanan/sqlite-mcp-server

3.3

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 dayong@mcphub.com.

A general-purpose Model Context Protocol (MCP) server for SQLite databases, providing read and write access through Claude Desktop and other MCP clients.

Tools
8
Resources
0
Prompts
0

SQLite MCP Server

A general-purpose Model Context Protocol (MCP) server for SQLite databases. This server provides read and write access to any SQLite database in the database folder through Claude Desktop and other MCP clients.

Features

  • Multi-Database Support: Work with multiple SQLite databases in a single server
  • Read Operations: Query tables, list databases, describe schemas
  • Write Operations: Insert, update, and delete data safely
  • Safety Features: Parameterized queries, validation, and required WHERE clauses for destructive operations

Available Tools

Database Discovery

  • list_databases - List all available .db files in the database folder
  • list_tables - List all tables in a specific database
  • describe_table - Get detailed table structure (columns, types, constraints)

Read Operations

  • query_database - Execute SELECT queries with automatic LIMIT protection

Write Operations

  • insert_data - Insert new rows into tables
  • update_data - Update existing rows (requires WHERE clause)
  • delete_data - Delete rows (requires WHERE clause)
  • execute_raw_sql - Execute any SQL query (use with caution)

Installation

Prerequisites

  • Python 3.10 or higher
  • pip (Python package manager)

Setup

  1. Clone or download this repository

  2. Install dependencies:

pip install -r requirements.txt
  1. Add your databases:
    • Place your SQLite .db files in the database/ folder
    • The server will work with any .db file you add to this folder
    • You can add multiple databases and switch between them

Usage

Running Locally

Test the server locally:

python sqlite_mcp.py

Claude Desktop Integration

Add the server to your Claude Desktop configuration file:

Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json

Option A: Using Python directly
{
  "mcpServers": {
    "sqlite-mcp-server": {
      "command": "python",
      "args": [
        "C:/Users/YOUR_USERNAME/path/to/sqlite-mcp-server/sqlite_mcp.py"
      ]
    }
  }
}
Option B: Using uv with fastmcp
{
  "mcpServers": {
    "sqlite-mcp-server": {
      "command": "uv",
      "args": [
        "run",
        "--with", "fastmcp",
        "fastmcp", "run",
        "C:/Users/YOUR_USERNAME/path/to/sqlite-mcp-server/sqlite_mcp.py"
      ]
    }
  }
}

Replace C:/Users/YOUR_USERNAME/path/to/sqlite-mcp-server/ with your actual project path.

Restart Claude Desktop

After updating the configuration:

  1. Completely quit Claude Desktop
  2. Restart the application
  3. The SQLite MCP Server should now be available

Example Usage in Claude

Once connected, you can interact with your databases through Claude:

"List all available databases"
"Show me the tables in ecommerce.db"
"Describe the structure of the users table in ecommerce.db"
"Query the top 10 products from the products table in ecommerce.db"
"Insert a new user with name 'John Doe' and email 'john@example.com' into ecommerce.db"

Security Notes

  • The server uses parameterized queries to prevent SQL injection
  • Write operations require explicit WHERE clauses to prevent accidental mass updates/deletes
  • Query results are limited to 1000 rows by default

Project Structure

sqlite-mcp-server/
├── sqlite_mcp.py         # Main MCP server
├── database/             # SQLite database files go here
│   └── *.db              # Your database files
├── requirements.txt      # Python dependencies
├── .gitignore            # Git ignore rules
└── README.md