Get the FREE Ultimate OpenClaw Setup Guide →

sqlite-explorer-fastmcp

An MCP server that provides safe, read-only access to SQLite databases through Model Context Protocol (MCP). This server is built with the FastMCP framework, which enables LLMs to explore and query SQLite databases with built-in safety features and query validation.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio hannesrudolph-sqlite-explorer-fastmcp-mcp-server uv run --with fastmcp --with uvicorn fastmcp run sqlite_explorer.py \
  --env SQLITE_DB_PATH="<path-to-your-database.db>"

How to use

This MCP server provides safe, read-only access to a SQLite database via the Model Context Protocol. It exposes tools that let an LLM explore the schema and execute read-only queries against the database with built-in safety validations, parameter binding, and row-limiting to prevent large or unsafe results. Key tools include read_query for executing SELECT statements with validation, list_tables to enumerate available tables, and describe_table to fetch detailed schema information such as column types, nullability, defaults, and primary keys. To use the server, point your client or environment to the uv-based runtime (as shown in the installation instructions) and supply the path to your SQLite database via the SQLITE_DB_PATH environment variable. The server will enforce read-only access and sanitize queries to prevent unsafe operations.

How to install

Prerequisites:

  • Python 3.6+
  • Git (optional, for cloning)
  • Access to the internet to install dependencies

Option A: Install and run locally

  1. Clone or download the repository containing sqlite_explorer.py and requirements.txt
  2. Create and activate a Python environment (recommended):
    • python3 -m venv venv
    • source venv/bin/activate (Linux/macOS) or venv\Scripts\activate (Windows)
  3. Install dependencies:
    • pip install -r requirements.txt
  4. Set up your database path (example):
    • export SQLITE_DB_PATH=/path/to/your/database.db
  5. Run the MCP server using the provided uv-based command:
    • uv run --with fastmcp --with uvicorn fastmcp run sqlite_explorer.py
    • Ensure SQLITE_DB_PATH is set in the environment before starting (the server will read this variable at startup)

Option B: Use Claude Desktop or Cline VSCode plugin (as described in the README)

  1. Ensure Python and dependencies are installed as in Option A
  2. Start the server with the appropriate environment variable and command configuration as shown in the README example.

Additional notes

Environment variables:

  • SQLITE_DB_PATH: Full path to the SQLite database file to explore. Safety features:
  • Read-only access to the database to prevent modifications.
  • Query validation and sanitization with parameter binding.
  • Row limit enforcement to avoid large payloads.
  • Progress output suppression to ensure clean JSON responses. Common issues:
  • Ensure SQLITE_DB_PATH is accessible by the user running the server.
  • If the server fails to start, verify that Python 3.6+ is installed and dependencies from requirements.txt are installed.
  • When using the UVicorn-based runtime, ensure that the uv command is available in your PATH.

Related MCP Servers

Sponsor this space

Reach thousands of developers