mcp-sqlite
Provides tools for exploring and querying a SQLite database: listing user tables with row counts, describing a table's columns, foreign keys and indexes, and executing a single read-only statement (SELECT/WITH/VALUES/EXPLAIN) with positional or named bound parameters and a capped row limit that reports truncation. A sqlite://schema resource exposes CREATE statements for tables, indexes, views and triggers, and an opt-in run_write tool adds INSERT/UPDATE/DELETE/REPLACE when --allow-writes is set. Statement-level guardrails reject DDL, ATTACH, VACUUM, multiple statements and non-allowlisted PRAGMAs.
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
A safety-first Model Context Protocol server for SQLite. Let an AI agent explore and query a database without letting it drop tables, run DDL, or smuggle a second statement past you.
Why another SQLite MCP server
Exposing a database to an agent is useful and dangerous. Most servers either
allow arbitrary SQL or only handle a fixed schema. mcp-sqlite sits in between:
Read-only by default. The database is opened read-only and the write tool is not registered unless you opt in with
--allow-writes.Statement-aware guardrails. Every statement is classified before it runs. DDL,
ATTACH,VACUUM, and multiple statements are rejected.PRAGMAis limited to a safe allowlist.Schema first. Dedicated tools for tables, columns, foreign keys, and indexes, plus a
sqlite://schemaresource, so agents inspect before querying.Bounded results. Reads are capped (default 100 rows, max 1000) and report whether they were truncated.
Typed and tested. TypeScript, Zod-validated tool inputs, and an in-memory MCP client integration test.
Related MCP server: PgSafe MCP
Quick start
Requires Node 24+ (it uses the built-in node:sqlite module).
npm install
npm run build
# Read-only against an existing database
node dist/index.js --db ./data.db
# Allow writes
node dist/index.js --db ./data.db --allow-writes
# Create a new database
node dist/index.js --db ./data.db --create --allow-writesThe server speaks MCP over stdio, so stdout is reserved for protocol messages and logs go to stderr.
Client configuration
{
"mcpServers": {
"sqlite": {
"command": "node",
"args": ["/absolute/path/to/mcp-sqlite/dist/index.js", "--db", "/absolute/path/to/data.db"]
}
}
}Add --allow-writes to the args array to enable run_write.
Tools
Tool | Description |
| List user tables with row counts |
| Columns, foreign keys, and indexes for one table |
| Execute one read-only statement with optional bound params and a row limit |
| Execute one |
Reads accept positional (?) or named (:name) parameters:
{
"sql": "SELECT id, title FROM notes WHERE team_id = :team",
"params": { "team": 1 },
"limit": 50
}Resources
URI | Contents |
|
|
Safety model
classifyStatement parses the leading keyword after comments and enforces:
exactly one statement (a semicolon anywhere but the end is rejected)
reads may be
SELECT,WITH,VALUES, orEXPLAIN, and may not contain write or DDL keywords (this also blocks writes hidden in a CTE)writes are limited to
INSERT,UPDATE,DELETE, andREPLACEPRAGMAis limited to a read-only allowlist
This is deliberately conservative. It is a guardrail, not a sandbox: run the
server against a database and credentials scoped to what the agent should reach.
For untrusted input, put the database behind a read replica and keep
--allow-writes off.
Development
npm run typecheck
npm test
npm run buildThe test suite covers statement classification, introspection, query limits, parameter binding, write behavior, and a full MCP round-trip using an in-memory transport.
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
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.
SQLite databases for AI agents: build custom apps, share data between agents, optimize agent runs
Query 40 databases from Claude, ChatGPT, or Cursor — on any device. Read-only, encrypted, audited.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to safely query and explore SQLite databases through read-only, guard-protected tools that block writes, sensitive table access, and runaway queries.1MIT
- AlicenseAqualityBmaintenanceEnables AI agents to inspect database schemas and run strictly read-only SQL queries with guardrails against destructive statements, multi-statement chaining, and unbounded scans. Supports SQLite natively and PostgreSQL optionally.453 PyPIMIT
- AlicenseAqualityCmaintenanceEnables AI agents to explore and query SQLite databases through read-only, sandboxed tools for listing tables, describing schemas, fetching DDL, and running a single capped SELECT statement. Also supports plain-English questions that are converted to SQL and routed through the same sandbox.4MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to safely explore and query SQLite or PostgreSQL databases through read-only, guarded SELECT queries with column masking, row limits, timeouts, and audit logging.MIT