Skip to content

sqlite

Read and write a SQLite database file. Backed by modernc.org/sqlite, a pure-Go port of SQLite — no CGO, the binary stays statically linked.

Usage

bash
native-mcp sqlite [--readonly] DB_FILE

The database file is created on demand in read-write mode. In --readonly mode it must already exist.

Flags

FlagDefaultDescription
--readonlyoffOpen the database in read-only mode and hide the execute tool from tools/list.

Tools

list_tables

Returns the user-table names (excluding sqlite_* internals).

schema

Returns the CREATE statements for every table, view, index, and trigger.

query

Run a read-side SQL statement.

FieldTypeRequiredDescription
sqlstringyesSQL to execute. Use ? placeholders for parameters.
paramsarraynoPositional parameters bound to ? placeholders.

Returns a pipe-separated table:

text
name | age
---------
Alice | 30
Bob | 25

(2 rows)

execute (disabled in --readonly)

Run a write-side SQL statement (INSERT, UPDATE, DELETE, CREATE, …). Returns rows affected and lastInsertId.

FieldTypeRequiredDescription
sqlstringyesSQL to execute.
paramsarraynoPositional parameters.

Always use parameters

Pass user-supplied values via params, not by string-concatenating them into sql. The driver handles escaping and types correctly:

json
{ "sql": "SELECT * FROM users WHERE id = ?", "params": [42] }

Register in Claude Code

bash
# Read-write
claude mcp add native-sqlite native-mcp sqlite /var/data/app.db

# Read-only (analytics, reporting)
claude mcp add native-sqlite-ro native-mcp sqlite --readonly /var/data/warehouse.db

Released under the MIT License.