sqlite-mcp-server
Provides tools for querying and exploring a SQLite database, including listing tables, describing schemas, running read-only queries, and executing write statements when enabled.
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-serverlist all tables in the database"
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
An MCP (Model Context Protocol) server that gives an AI assistant safe, structured access to a SQLite database.
Point it at any .db file and an MCP-compatible client (Claude Desktop,
Claude Code, etc.) can inspect the schema and query it directly.
Why this one
Read-only by default. The assistant can
SELECTall it wants, but can'tINSERT/UPDATE/DELETE/DROPanything unless you explicitly turn writes on with an environment variable.Every statement is checked before it runs — not just trusted blindly. Stacked statements (
SELECT 1; DROP TABLE users;) are rejected outright.Results are capped (1000 rows by default) so a
SELECT *on a huge table can't flood the assistant's context window.Schema-aware. The assistant can list tables, describe columns, and read the full schema before it ever writes a query — fewer guesses, fewer mistakes.
Related MCP server: sqlite-mcp
Install
git clone <this-repo-url>
cd sqlite-mcp-server
pip install -r requirements.txtTry it immediately with sample data
python3 seed_sample_db.pyThis creates ./data/app.db with two small tables (customers, orders)
so you can test the server without hooking it up to a real database first.
Run it standalone
python3 server.pyIt talks MCP over stdio, so it's meant to be launched by an MCP client, not run interactively on its own.
Connect it to Claude Desktop
Add this to your Claude Desktop MCP config (see
claude_desktop_config.example.json in this repo for the full snippet),
replacing the paths with the absolute path to where you cloned this repo:
{
"mcpServers": {
"sqlite-explorer": {
"command": "python3",
"args": ["/absolute/path/to/sqlite-mcp-server/server.py"],
"env": {
"MCP_SQLITE_DB_PATH": "/absolute/path/to/sqlite-mcp-server/data/app.db"
}
}
}
}Restart Claude Desktop, and the assistant will have list_tables,
describe_table, query, and execute tools available for that
database.
Configuration
Set these as environment variables (see .env.example):
Variable | Default | Meaning |
|
| Path to the SQLite file. Created automatically if missing. |
|
| Set to |
|
| Maximum rows a single |
Tools exposed
Tool | Description |
| List every table in the database. |
| Columns, types, nullability, primary keys, and indexes for one table. |
| Run a read-only |
| Run a write statement. Only works if |
Plus a resource, schema://database, exposing the full CREATE TABLE
statements for the database, so the assistant can read the whole schema
at a glance.
Safety model
query()only acceptsSELECT/PRAGMA/EXPLAIN/WITH. Anything else is rejected with an error before it touches the database.execute()is a hard no-op — it raisesPermissionError— unless the server was started withMCP_ALLOW_WRITE=true. This means an assistant can never modify or destroy data unless a human operator deliberately opted in.Multiple statements in one call (
SELECT 1; DROP TABLE users;) are rejected outright, whether writes are enabled or not.Known limitation: the multi-statement check is a simple semicolon scan, not a full SQL parser, so a semicolon inside a string literal (
SELECT ';' AS x) will also be (harmlessly) rejected. Being overly cautious here was a deliberate trade-off over a more permissive parser that could be tricked into missing a real stacked statement.
Development
The core SQL-safety logic lives in sql_guard.py, which has zero
dependency on the mcp package, so it can be tested without installing
the full SDK:
python3 -m unittest discover -s tests -vLicense
MIT — see LICENSE.
This server cannot be installed
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
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/alialle/sqlite-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server