Read-only SQLite MCP
Provides read-only tools for exploring SQLite database files, letting an AI assistant list databases, tables and views, describe schemas including columns, keys, foreign keys and indexes, get row counts and sample rows, run capped read-only queries (SELECT/WITH/PRAGMA/EXPLAIN) and export query results as CSV, with optional writes gated behind an explicit flag.
Click on "Deploy 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., "@Read-only SQLite MCPwhat tables are in this database and how many rows are in each?"
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.
Read-only SQLite MCP
Let your AI assistant explore your SQLite databases β without ever being able to change them.
Anthropic's original SQLite reference server was moved to the archive. This is a maintained replacement with a safety-first design:
π Read-only by default β connections use SQLite's own read-only mode, and queries are restricted to
SELECT / WITH / PRAGMA / EXPLAIN. Writes need an explicit--allow-writeflag at startup.π Only your files β the server can only open databases you name with
--db. The AI cannot wander your disk.β‘ Zero dependencies β pure Python standard library. No Docker, no Node, works offline.
Works with Claude Code, Cursor, VS Code, Windsurf and any MCP client.
Install
pip install readonly-sqlite-mcpRelated MCP server: shop-analytics-mcp
Connect it
Point the server at one or more database files:
Claude Code
claude mcp add sqlite -- readonly-sqlite-mcp --db /path/to/app.db --db /path/to/data.sqliteCursor / VS Code / Windsurf (mcp.json):
{
"mcpServers": {
"sqlite": {
"command": "readonly-sqlite-mcp",
"args": ["--db", "/path/to/app.db"]
}
}
}Then ask your assistant:
"What tables are in this database and how big is each one?"
"Show me the schema of the users table"
"Which products sold most last month? Give me CSV"
Tools
Tool | What it does |
| Databases this server may access |
| Tables and views in a database |
| Columns, types, keys, foreign keys, indexes |
| Row count for every table |
| Read-only SQL (SELECT/WITH/PRAGMA/EXPLAIN), capped results |
| A few example rows from a table |
| Run a read-only query, get CSV back |
| INSERT/UPDATE/DELETE/DDL β only with |
Safety model
Databases are allow-listed at startup (
--db, repeatable, or theSQLITE_MCP_DBSenvironment variable).Read connections are opened with SQLite URI
mode=roβ the database engine itself refuses writes, not just this server's code.read_queryadditionally rejects any statement that does not start with SELECT, WITH, PRAGMA or EXPLAIN.Results are capped (default 200 rows, max 1000) so a runaway query can't flood the conversation.
Development
git clone https://github.com/Deependra12349/readonly-sqlite-mcp
cd readonly-sqlite-mcp
python tests/test_mcp.py # creates a temp DB, runs real protocol checks,
# including "writes are blocked" and "file unchanged"Contributing
Issues and PRs welcome β see CONTRIBUTING.md. The zero-dependency and read-only-by-default rules are not negotiable.
License
MIT β see LICENSE.
Maintained by Deependra, with AI assistance for implementation.
Safety behaviour is covered by the automated tests in tests/.
Available Tools
7 toolsdescribe_tableB
Show a table's columns, types, keys and indexes.
Inputs: table (required), database (required).
export_csvC
Run a read-only query and return the result as CSV text.
Inputs: sql (required), database (required), limit.
list_databasesA
List the SQLite databases this server is allowed to access.
Inputs: no named parameters.
list_tablesB
List tables and views in a database.
Inputs: database (required).
read_queryB
Run a read-only SQL query (SELECT / WITH / PRAGMA / EXPLAIN only). Results are capped.
Inputs: sql (required), database (required), limit.
sample_rowsC
Fetch a few example rows from a table.
Inputs: table (required), database (required), limit.
table_statsB
Show row counts for every table in a database.
Inputs: database (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
TDQS
Scored across 7 tools
Each tool targets a distinct inspection level (databases, tables, columns, row counts, sample data) and descriptions make the boundaries clear. The only real overlap is read_query vs export_csv, which both execute a read-only query and differ only in output format, and sample_rows is a thin convenience wrapper around a SELECT.
Six of seven tools follow a clear verb_noun pattern (list_databases, list_tables, describe_table, read_query, sample_rows, export_csv). table_stats breaks the pattern with a noun_noun form, but it is still readable and unambiguous.
Seven tools is well-scoped for a read-only database inspection server. Every tool covers a distinct exploration step with no filler, and nothing feels missing from the count perspective.
The surface covers the full read-only lifecycle: discover databases, enumerate tables, inspect schema, gauge size, and pull sample or exported data. Minor gaps remain, such as finding which tables contain a given column name or dumping a full schema, but agents can work around these with read_query.
Maintenance
Related MCP Connectors
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view detβ¦
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Query your warehouse or a CSV with Claude/ChatGPT over MCP, governed by table-level ACL + audit.
Read authorized Loam tables and supported external databases through a bounded MCP connection.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables safe, read-only SQL access to SQLite databases for AI agents, allowing schema exploration and SELECT queries with defense-in-depth protections.3MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to read-only query a SQLite database, inspect schema and table summaries, and execute SELECT queries with pagination through MCP.MIT
- AlicenseAqualityBmaintenanceEnables querying SQLite databases in plain language through MCP, letting clients like Claude Code inspect schemas and run read-only SQL.31MIT
- AlicenseNot gradedqualityBmaintenanceEnables Claude and other MCP clients to map a SQLite database's schema and run read-only SQL queries against it, with writes blocked at the SQLite level through multiple enforcement layers. Results come back as context-friendly Markdown tables with row caps and a query timeout.2MIT