mcp-sqlite-readonly
Provides read-only access to a SQLite database loaded into memory, allowing safe execution of read-only SELECT/WITH queries with safeguards such as single-statement validation, row/result-size limits, and parameter limits.
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.
@trysac/mcp-sqlite-readonly
Read-only MCP server over a SQLite database file loaded into memory with sql.js.
The Problem
Most SQLite MCP servers open real files with write access and rely on trust to ensure models only execute read-only queries. This package is read-only by construction, preventing accidental or malicious modification of your database files.
Related MCP server: analytics-mcp-server
Installation
Install the package as a dependency:
npm install @trysac/mcp-sqlite-readonlyUsage Example
import { openDatabase, createServer } from "@trysac/mcp-sqlite-readonly";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { readFile } from "node:fs/promises";
const dbBytes = await readFile("sample.db");
const db = await openDatabase(dbBytes);
const server = createServer(db);
await server.connect(new StdioServerTransport());API Summary
openDatabase(bytes: Uint8Array, opts?: { maxDbBytes?: number }): Promise<ReadonlyDb>createServer(db: ReadonlyDb, opts?: { name?: string, version?: string }): McpServercheckSql(sql: string): void(Validates read-only keywords: SELECT/WITH)SqliteMcpError: Thrown forNOT_READ_ONLY,MULTIPLE_STATEMENTS,SQL_ERROR,UNKNOWN_TABLE,TOO_LARGE,INVALID_PARAMS.
Limits
maxDbBytes: Default 100 MiB.
maxRows: Default 1,000.
maxResultBytes: Default 1 MiB.
maxCellChars: Default 10,000.
MAX_PARAMS_COUNT: 100.
Why not the reference SQLite MCP server?
Unlike reference implementations that trust the model to behave, this library enforces read-only access via the SQLite engine and loader, rather than relying on model prompt compliance.
Security
See docs/SECURITY.md for the threat model and defense boundaries.
This server cannot be deployed
Maintenance
Related MCP Connectors
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
SQL validation, formatting, parsing, metadata extraction, linting, and security analysis.
Executes SQL in a real ephemeral database: rows, typed errors with suggestions, plans, diffs.
Query 40 databases from Claude, ChatGPT, or Cursor — on any device. Read-only, encrypted, audited.
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
- AlicenseAqualityDmaintenanceEnables safe exploration and analysis of SQLite databases through guarded read-only queries, schema inspection, aggregations, and CSV imports.5MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to explore and query SQLite databases through read-only tools, with defense-in-depth sandboxing preventing any data modifications.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