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_FILEThe database file is created on demand in read-write mode. In --readonly mode it must already exist.
Flags
| Flag | Default | Description |
|---|---|---|
--readonly | off | Open 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.
| Field | Type | Required | Description |
|---|---|---|---|
sql | string | yes | SQL to execute. Use ? placeholders for parameters. |
params | array | no | Positional 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.
| Field | Type | Required | Description |
|---|---|---|---|
sql | string | yes | SQL to execute. |
params | array | no | Positional 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