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.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
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 Postgres, MySQL, BigQuery, Iceberg and files with DuckDB, with per-query cost checks.
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
- AlicenseAqualityBmaintenanceEnables AI agents and developers to introspect SQLite schemas, run sandboxed read-only queries with pagination, inspect query plans, and generate token-dense database summaries for LLM context. All operations enforce multi-layer read-only safety so databases can be explored without risk of mutation.5MIT
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients to explore a local SQLite database through read-only table listing, schema inspection, and restricted SELECT or WITH queries with row and time limits.315 PyPI1MIT