mcp-sqlite-readonly
Provides read-only access to a local SQLite database file specified at startup: listing tables, inspecting table schemas, retrieving records with filters, limits and offsets, and running validated SELECT/EXPLAIN/CTE queries with parameterized values (all write and DDL statements are blocked).
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 Server (Read-Only Fork)
This is a Model Context Protocol (MCP) server that provides read-only SQLite database interaction capabilities with enterprise-grade security.
Note: This is a security-hardened fork of mcp-sqlite by Justin Parker. The original project provided full CRUD operations. This fork transforms it into a read-only server with multiple layers of security protection.
Credits
Original Project: mcp-sqlite by Justin Parker Original Maintainer: eQuill Labs This Fork: Security-hardened read-only version by Fanom2813
Related MCP server: analytics-mcp-server
Features
π Read-only access - Database opened with
SQLITE_OPEN_READONLYflagπ‘οΈ Multi-layer security - Whitelist-based query validation, SQL injection protection
π Database exploration - List tables, inspect schemas, query data
π Custom read queries - Execute SELECT queries with parameterized values
β Input validation - Table names, column names, and parameters are strictly validated
Security Features
This server implements defense-in-depth security:
Database-level protection: Opened with
SQLITE_OPEN_READONLYflagWhitelist validation: Only SELECT, EXPLAIN, and WITH (CTE) queries allowed
Blacklist dangerous commands: Blocks INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, ATTACH, DETACH, PRAGMA, etc.
SQL injection prevention: Parameterized queries and strict identifier validation
Comment stripping: Removes SQL comments to prevent injection attacks
Multi-statement validation: Each statement in multi-query requests is validated
Setup
Define the command in your IDE's MCP Server settings:
e.g. Cursor:
{
"mcpServers": {
"MCP SQLite Server (Read-Only)": {
"command": "npx",
"args": [
"-y",
"mcp-sqlite-readonly",
"<path-to-your-sqlite-database.db>"
]
}
}
}e.g. VSCode:
{
"servers": {
"MCP SQLite Server (Read-Only)": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"mcp-sqlite-readonly",
"<path-to-your-sqlite-database.db>"
]
}
}
}Your database path must be provided as an argument.
Available Tools
Database Information
db_info
Get detailed information about the connected database.
Example:
{
"method": "tools/call",
"params": {
"name": "db_info",
"arguments": {}
}
}list_tables
List all tables in the database.
Example:
{
"method": "tools/call",
"params": {
"name": "list_tables",
"arguments": {}
}
}get_table_schema
Get detailed information about a table's schema.
Parameters:
tableName(string): Name of the table
Example:
{
"method": "tools/call",
"params": {
"name": "get_table_schema",
"arguments": {
"tableName": "users"
}
}
}Read Operations
read_records
Query records from a table with optional filtering. All inputs are validated to prevent SQL injection.
Parameters:
table(string): Name of the table (alphanumeric and underscores only)conditions(object, optional): Filter conditions as key-value pairslimit(number, optional): Maximum number of records to returnoffset(number, optional): Number of records to skip
Example:
{
"method": "tools/call",
"params": {
"name": "read_records",
"arguments": {
"table": "users",
"conditions": {
"age": 30
},
"limit": 10,
"offset": 0
}
}
}Custom Read-Only Queries
query
Execute a read-only SQL query against the database. Only SELECT, EXPLAIN, and WITH (CTE) queries are allowed.
The query validator will:
Strip SQL comments to prevent injection
Validate each statement in multi-query requests
Block dangerous commands (INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, ATTACH, DETACH, PRAGMA, etc.)
Allow parameterized queries for safe value substitution
Parameters:
sql(string): The SELECT query to executevalues(array, optional): Array of parameter values for placeholders (?)
Example:
{
"method": "tools/call",
"params": {
"name": "query",
"arguments": {
"sql": "SELECT * FROM users WHERE age > ? AND status = ?",
"values": [25, "active"]
}
}
}Allowed:
SELECT * FROM users WHERE id = ?EXPLAIN QUERY PLAN SELECT * FROM usersWITH active_users AS (SELECT * FROM users WHERE status = 'active') SELECT * FROM active_users
Blocked:
INSERT INTO users ...UPDATE users SET ...DELETE FROM users ...DROP TABLE usersATTACH DATABASE ...
Built with
License
ISC License - Same as the original project
Appreciation
If you found the original project helpful, please consider supporting the original author:
Original Author: Justin Parker (jparkerweb)
Support: π΅ tip here
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.
SQL validation, formatting, parsing, metadata extraction, linting, and security analysis.
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
- 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 gradedqualityCmaintenanceEnables exploring and querying a SQLite database loaded into memory through validated read-only SELECT/WITH statements, with enforced limits on database size, rows, result bytes, cells, and parameters.MIT