ofershap avatar

Sqlite

ofershap/mcp-server-sqlite

A TypeScript reimplementation of SQLite database access for MCP clients, since the official reference server is Python only. Exposes five tools: query (SELECT, PRAGMA, EXPLAIN, WITH), schema (all tables with columns and types), table_info (single table details), explain (query plan analysis), and list_databases (find .db files in a directory). Opens databases read-only by default so you can explore safely, but supports an opt-in write mode for mutations. Built for Node.js environments where you want Claude to inspect local SQLite files, run analytical queries, or help optimize slow statements. Works with Claude Desktop, Cursor, and VS Code through npx, no authentication needed since it's all local filesystem access.

GitHub stars
2
tools
15
transport
STDIO
last updated
Mar 10, 2026

Tools

15 tools

Public tool metadata for what this MCP can expose to an agent.

sqlite_queryExecute a SELECT query on the SQLite database and return rows as a JSON array. Use this for reading data — supports any valid SELECT statement with optional parameter binding for safe queries.2 params

Execute a SELECT query on the SQLite database and return rows as a JSON array. Use this for reading data — supports any valid SELECT statement with optional parameter binding for safe queries.

Parameters* required
paramsarray
Array of bind parameter values for ? placeholders (e.g., [25])
sqlstring
SQL SELECT query to execute (e.g., "SELECT * FROM users WHERE age > ?")
sqlite_executeExecute a write statement (INSERT, UPDATE, DELETE, CREATE, ALTER, DROP) on the SQLite database. Returns the number of rows changed and the last inserted row ID. Use parameter binding for safe writes.2 params

Execute a write statement (INSERT, UPDATE, DELETE, CREATE, ALTER, DROP) on the SQLite database. Returns the number of rows changed and the last inserted row ID. Use parameter binding for safe writes.

Parameters* required
paramsarray
Array of bind parameter values for ? placeholders (e.g., ["Alice", 30])
sqlstring
SQL write statement to execute (e.g., "INSERT INTO users (name, age) VALUES (?, ?)")
sqlite_run_scriptExecute multiple SQL statements in a single transaction. All statements succeed or all fail (atomic). Separate statements with semicolons. Use for migrations, seed data, or batch operations.1 params

Execute multiple SQL statements in a single transaction. All statements succeed or all fail (atomic). Separate statements with semicolons. Use for migrations, seed data, or batch operations.

Parameters* required
sqlstring
Multiple SQL statements separated by semicolons (e.g., "CREATE TABLE t1 (id INTEGER); INSERT INTO t1 VALUES (1);")
sqlite_list_tablesList all tables and views in the database with their row counts. Use this as the first step to explore an unfamiliar database. Returns table name, type (table or view), and row count.1 params

List all tables and views in the database with their row counts. Use this as the first step to explore an unfamiliar database. Returns table name, type (table or view), and row count.

Parameters* required
_fieldsstring
Comma-separated list of fields to return (e.g., "name,type,rowCount"). Leave empty for all fields.
sqlite_describe_tableGet the column schema of a table — column names, data types, NOT NULL constraints, default values, and primary key flags. Also returns the CREATE TABLE SQL statement.1 params

Get the column schema of a table — column names, data types, NOT NULL constraints, default values, and primary key flags. Also returns the CREATE TABLE SQL statement.

Parameters* required
tablestring
Table name to describe (e.g., "users")
sqlite_list_indexesList all indexes on a table — index name, uniqueness, origin (manual or auto-created), and whether it is a partial index.1 params

List all indexes on a table — index name, uniqueness, origin (manual or auto-created), and whether it is a partial index.

Parameters* required
tablestring
Table name to list indexes for (e.g., "users")
sqlite_list_foreign_keysList foreign key constraints on a table — referenced table, local and remote columns, ON UPDATE and ON DELETE actions.1 params

List foreign key constraints on a table — referenced table, local and remote columns, ON UPDATE and ON DELETE actions.

Parameters* required
tablestring
Table name to list foreign keys for (e.g., "orders")
sqlite_create_tableCreate a new table with column definitions. Each column has a name, type, and optional constraints (PRIMARY KEY, NOT NULL, UNIQUE, DEFAULT). Use ifNotExists to skip if the table already exists.3 params

Create a new table with column definitions. Each column has a name, type, and optional constraints (PRIMARY KEY, NOT NULL, UNIQUE, DEFAULT). Use ifNotExists to skip if the table already exists.

Parameters* required
columnsarray
Array of column definitions with name, type, and optional constraints
ifNotExistsboolean
Skip creation if table already exists (default: false)
tablestring
Name for the new table (e.g., "users")
sqlite_alter_tableAlter an existing table — add a new column, rename a column, or rename the table. SQLite does not support dropping columns via ALTER TABLE.9 params

Alter an existing table — add a new column, rename a column, or rename the table. SQLite does not support dropping columns via ALTER TABLE.

Parameters* required
actionstring
Alter action: "add_column" to add a new column, "rename_column" to rename a column, "rename_table" to rename the tableone of add_column · rename_column · rename_table
columnstring
New column name (for add_column action)
defaultvalue
Default value for new column (for add_column)
newNamestring
New column name (for rename_column action)
newTableNamestring
New table name (for rename_table action)
notNullboolean
Add NOT NULL constraint to new column (for add_column, default: false)
oldNamestring
Current column name to rename (for rename_column action)
tablestring
Current table name to alter (e.g., "users")
typestring
Column data type (for add_column action, e.g., "TEXT", "INTEGER")
sqlite_drop_tableDrop (delete) a table and all its data permanently. This action is irreversible. Use ifExists to avoid errors if the table does not exist.2 params

Drop (delete) a table and all its data permanently. This action is irreversible. Use ifExists to avoid errors if the table does not exist.

Parameters* required
ifExistsboolean
Skip if table does not exist instead of throwing error (default: false)
tablestring
Table name to drop (e.g., "old_users")
sqlite_create_indexCreate an index on one or more columns to speed up queries. Optionally create a UNIQUE index to enforce uniqueness. Index name is auto-generated if not provided.5 params

Create an index on one or more columns to speed up queries. Optionally create a UNIQUE index to enforce uniqueness. Index name is auto-generated if not provided.

Parameters* required
columnsarray
Array of column names to index (e.g., ["email"] or ["last_name", "first_name"])
ifNotExistsboolean
Skip if index already exists (default: false)
indexNamestring
Custom index name (auto-generated as idx_table_col1_col2 if omitted)
tablestring
Table to create the index on (e.g., "users")
uniqueboolean
Create a UNIQUE index to enforce uniqueness (default: false)
sqlite_drop_indexDrop (delete) an index by name. Does not affect the table data, only removes the index. Use ifExists to avoid errors if the index does not exist.2 params

Drop (delete) an index by name. Does not affect the table data, only removes the index. Use ifExists to avoid errors if the index does not exist.

Parameters* required
ifExistsboolean
Skip if index does not exist instead of throwing error (default: false)
indexNamestring
Name of the index to drop (e.g., "idx_users_email")
sqlite_get_infoGet database metadata — file path, file size, table count, page count, page size, journal mode, WAL status, encoding, and SQLite version. Use this to understand the database state.1 params

Get database metadata — file path, file size, table count, page count, page size, journal mode, WAL status, encoding, and SQLite version. Use this to understand the database state.

Parameters* required
_fieldsstring
Comma-separated list of fields to return (e.g., "path,size,tables"). Leave empty for all fields.
sqlite_vacuumOptimize and compact the database file by rebuilding it. Reclaims space from deleted rows and defragments the file. Returns file size before and after. May take time on large databases.1 params

Optimize and compact the database file by rebuilding it. Reclaims space from deleted rows and defragments the file. Returns file size before and after. May take time on large databases.

Parameters* required
_fieldsstring
Comma-separated list of fields to return (e.g., "sizeBefore,sizeAfter"). Leave empty for all fields.
sqlite_integrity_checkRun PRAGMA integrity_check to verify the database is not corrupted. Returns "ok" if the database is healthy, or a list of issues found. Use after crashes or suspicious behavior.1 params

Run PRAGMA integrity_check to verify the database is not corrupted. Returns "ok" if the database is healthy, or a list of issues found. Use after crashes or suspicious behavior.

Parameters* required
_fieldsstring
Comma-separated list of fields to return (e.g., "ok,errors"). Leave empty for all fields.

Sponsors

Readme

mcp-server-sqlite

npm version npm downloads CI TypeScript License: MIT

Query SQLite databases, inspect schemas, and explain queries from your AI assistant. Read-only by default for safety.

npx mcp-sqlite-server

Works with Claude Desktop, Cursor, VS Code Copilot, and any MCP client. Reads local .db files, no auth needed.

MCP server for querying SQLite databases and inspecting schemas

Demo built with remotion-readme-kit

Why


View the full README on GitHub

Details

Repository
github.com/ofershap/mcp-server-sqlite
Categories
Databases, Data & Analytics
Package
mcp-sqlite-server
Transport
STDIO
Registry
MCP registry, active

More from ofershap

Related Databases MCP servers

View all
1pinion05 avatarPinion05 Supabase Mcp Litepinion05/supabase-mcp-liteSame functionality, consuming only 1/20 of the context window tokens.1stars
2daedalus avatarMcp Redis Serverdaedalus/mcp-redis-serverMCP server that exposes Redis API to AI models0stars
3aguantar avatarClickhouse Dataops Mcpaguantar/clickhouse-mcp-serverDataOps ClickHouse MCP server with query optimization and pipeline monitoring0stars
4rosch100 avatarMcp Sqliterosch100/mcp-sqliteMCP server for SQLCipher 4 encrypted SQLite databases with full CRUD operations and query support0stars
5elastic avatarElasticsearchelastic/mcp-server-elasticsearchProvides MCP access to Elasticsearch data, enabling index discovery, mappings, searches, and shard information.662stars
6richardhan avatarMicrosoft SQL Serverrichardhan/mssql_mcp_serverProvides MCP access to Microsoft SQL Server databases with multi-method authentication and SQL operations via Claude Desktop.345stars