sqlite-mcp-server
Provides tools for listing tables, describing table schemas, and executing read-only SELECT/WITH queries on any SQLite database, with safety guarantees to prevent writes or multi-statement injections.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@sqlite-mcp-serverShow me the schema of the orders table"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
SQLite MCP Server
A read-only Model Context Protocol (MCP) server that lets an LLM (like Claude) safely explore and query any SQLite database in natural language.
What is this?
MCP is the open standard that connects LLMs to external tools and data. This server speaks MCP and exposes a SQLite database to any MCP client (Claude Desktop, IDEs, custom agents) through three small, safe tools.
Ask "Which product category generated the most revenue last quarter?" and the model discovers the schema, writes the SQL itself, runs it through this server, and answers — without you writing a single query.
Related MCP server: sqlite-mcp
Why it's safe by design
Giving an LLM database access is risky if done naively. This server is read-only on two independent levels:
The connection is opened with SQLite's
file:...?mode=roURI — the OS-level handle physically cannot write.Every query is validated to be a single
SELECT/WITHstatement before execution. Writes (INSERT/UPDATE/DELETE/DROP) and multi-statement injections (SELECT 1; DROP TABLE ...) are rejected with a clear error.
Results are also capped (SQLITE_MAX_ROWS, default 100) so a careless SELECT * can't flood the context window.
Tools exposed
Tool | Description |
| List all user tables. |
| Show a table's columns, types and keys. |
| Run a read-only |
Plus a schema://database resource exposing the full DDL, so the model can load the whole schema at once.
Architecture
┌────────────────┐ MCP (stdio) ┌──────────────────────┐ read-only ┌────────────┐
│ Claude / MCP │ ◄────────────► │ sqlite-mcp-server │ ◄───────────► │ SQLite DB │
│ client │ tool calls │ list/describe/query │ mode=ro │ (*.db) │
└────────────────┘ └──────────────────────┘ └────────────┘Quickstart
# 1. Install
git clone https://github.com/helmi75/mcp-sqlite-server.git
cd mcp-sqlite-server
pip install -e .
# 2. Create the demo e-commerce database (customers, products, orders, order_items)
python scripts/seed_db.py
# 3. Run the server (stdio)
python -m sqlite_mcp_server.serverPoint it at your own database instead with the SQLITE_DB_PATH environment variable.
Use it with Claude Desktop
Add this to your claude_desktop_config.json (see examples/):
{
"mcpServers": {
"sqlite-explorer": {
"command": "python",
"args": ["-m", "sqlite_mcp_server.server"],
"env": { "SQLITE_DB_PATH": "/absolute/path/to/demo.db" }
}
}
}Restart Claude Desktop, then try:
"What tables are in the database?"
"Show me the schema of the orders table."
"Top 3 customers by total spend, with their country."
"Monthly revenue trend for delivered orders."
Configuration
Variable | Default | Description |
|
| Path to the SQLite database to serve. |
|
| Maximum rows returned by |
Testing
pip install -e ".[dev]"
python scripts/seed_db.py
pytest -vThe suite covers schema introspection, query execution, the row limit, and — importantly — that writes and multi-statement injections are rejected at both the SQL-guard and connection levels. CI runs on Python 3.10–3.12 via GitHub Actions.
Project structure
mcp-sqlite-server/
├── src/sqlite_mcp_server/
│ └── server.py # MCP server: tools + read-only safety
├── scripts/seed_db.py # Reproducible demo database
├── tests/test_server.py # Pytest suite (incl. security tests)
├── examples/ # Claude Desktop config
├── .github/workflows/ci.yml # CI: pytest on 3.10–3.12
└── pyproject.tomlRoadmap
EXPLAIN QUERY PLANtool to help the model optimise queriesOptional per-table allowlist / column masking
PostgreSQL backend behind the same interface
License
MIT — see LICENSE.
Built by Helmi Chiha — AI / Backend Engineer (RAG · LLM agents · MCP · FastAPI).
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/helmi75/mcp-sqlite-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server