sqlite-mcp-server is an open-source MCP server whose goal is to connect local SQLite databases to LLM assistants (such as Claude Desktop and Cursor) in a safe, controlled manner.
Purpose: to enable AI assistants to view database schemas and execute read-only queries while avoiding accidental data modification or dangerous operations.
Main capabilities:
- Automated schema discovery: can inspect table lists, object types (table/view), row count estimates, columns, primary keys, foreign keys, and full DDL definitions.
- Strict read-only safety: rejects mutating statements such as INSERT, UPDATE, DELETE, DROP, ALTER, CREATE, ATTACH, VACUUM, and REINDEX at the parser level; blocks multi-statement execution chained with semicolons; restricts dangerous PRAGMAs; and opens connections in read-only URI mode (file:path?mode=ro) while enabling PRAGMA query_only = ON.
- Context overflow protection: truncates oversized query results via max_rows and prompts the AI to use LIMIT and OFFSET.
- AI-oriented structured errors: returns JSON error objects containing error_type, message, query, and suggestion, covering categories such as DisallowedQueryError, SyntaxError, TableNotFoundError, ColumnNotFoundError, DatabaseNotFoundError, DatabaseConfigError, and ValidationError, making it easy for models to self-correct.
- Full MCP capabilities: provides Tools, direct Resources (sqlite://schema, sqlite://tables), and guided Prompts (schema_analysis, safe_query_assistant).
Usage:
- The database path can be specified dynamically via the CLI argument --db-path, the environment variable SQLITE_DB_PATH, or the db_path parameter on each tool call.
- Installation methods include running directly with uvx (recommended), or installing from source.
- It can be configured in Claude Desktop's claude_desktop_config.json, or in Cursor's settings interface or the project-level .cursor/mcp.json.
- The project provides an automated test suite based on pytest.
Use cases: developer scenarios that require an AI assistant to analyze local SQLite database schemas, generate safe SELECT queries, and perform read-only data exploration.
Limitations: only targets local SQLite databases; supports only read-only queries and does not support any data writes or schema changes; the specific installation commands and configuration examples are not fully provided in the materials and are not yet available.