mcp-sqlite-explorer
Safely exposes a local SQLite database with read-only access, providing tools to list tables and views, describe a table's columns/types/keys, and run guarded SELECT queries with row limits, plus a schema resource and an explore-table prompt for context.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
mcp-sqlite-explorer
A Model Context Protocol (MCP) server that safely exposes a local SQLite database to Claude and any other MCP client. Point Claude Desktop (or Claude Code) at a .db file and ask questions about your data in plain English — Claude discovers the schema and runs read-only queries through this server.
Built with the official @modelcontextprotocol/server TypeScript SDK (v2).
What it exposes
Kind | Name | Purpose |
Tool |
| List every table and view |
Tool |
| Columns, types and keys for one table |
Tool |
| Run a read-only SQL query (SELECT / WITH … SELECT) and get JSON rows |
Resource |
| The full schema as text, for context |
Prompt |
| A ready-made "profile this table" request |
Safety — read-only by design
Three layers stop any write reaching your database:
The connection is opened read-only (
better-sqlite3{ readonly: true }) — writes fail at the SQLite level.A textual guard rejects anything that isn't a single
SELECT/WITH … SELECT(blocksINSERT/UPDATE/DELETE/DROP/PRAGMA, multiple statements, and writes smuggled into a CTE).Each prepared statement is checked with better-sqlite3's
statement.readonlybefore it runs.
Results are capped (default 100 rows, max 1000) so a huge table can't flood the context.
Related MCP server: mcp-sqlite
Requirements
Node.js 20+
Setup
npm install
npm run seed # creates data/sample.db (customers, products, orders, order_items)
npm run build # compile to dist/Use it with Claude Desktop
Add this to your claude_desktop_config.json (use absolute paths):
{
"mcpServers": {
"sqlite-explorer": {
"command": "node",
"args": [
"/absolute/path/to/mcp-sqlite-explorer/dist/index.js",
"/absolute/path/to/your-database.db"
]
}
}
}Restart Claude Desktop, then ask things like "What tables are in the database?" or "Which product category has the most orders?" — Claude will call list_tables, describe_table and query as needed.
With Claude Code:
claude mcp add sqlite-explorer -- node /absolute/path/to/dist/index.js /absolute/path/to/your.dbThe database path can also be given via the MCP_SQLITE_DB environment variable; it defaults to data/sample.db.
Quick check (no client needed)
You can drive the server over stdio directly to confirm it works:
printf '%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"c","version":"1"}}}' \
'{"jsonrpc":"2.0","method":"notifications/initialized"}' \
'{"jsonrpc":"2.0","id":2,"method":"tools/list"}' \
| node dist/index.js data/sample.dbScripts
npm run dev # run from source with tsx
npm run seed # (re)create the sample database
npm run build # compile to dist/
npm start # run the compiled server
npm run typecheck # tsc --noEmit
npm test # vitestProject structure
src/
sql-safety.ts Pure read-only query guard + identifier check
db.ts Read-only SQLite wrapper (list/describe/query/schema)
server.ts MCP server: tools, resource, prompt
index.ts stdio entry point (logs to stderr only)
seed.ts Builds the sample databasestdio note: the MCP stdio transport uses stdout for the JSON-RPC protocol, so the server logs only to stderr — writing to stdout would corrupt the stream.
Tests
npm testThe suite covers the read-only guard (write statements, multi-statement, CTE-smuggled writes, comment handling) and the database wrapper (listing, describing, querying, row-limit truncation, and write rejection) against an in-memory database.
License
Released under the MIT License.
This server cannot be deployed
Maintenance
Related MCP Connectors
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
Query 40 databases from Claude, ChatGPT, or Cursor — on any device. Read-only, encrypted, audited.
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
Query your warehouse or a CSV with Claude/ChatGPT over MCP, governed by table-level ACL + audit.
Related MCP Servers
- FlicenseAqualityCmaintenanceEnables AI agents to safely inspect and query a SQLite database through read-only MCP tools for listing tables, describing schemas, and running paginated SELECT queries.3-
- AlicenseNot gradedqualityCmaintenanceEnables Claude to safely explore and query a SQLite database through natural language, including listing tables, inspecting schemas, and running read-only SELECT queries.1,683 npmMIT
- 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
- 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