SQLite
A SQLite database MCP service provided by Hawa Code (@dahawa/hawa-sqlite-mcp), based on the MCP (Model Context Protocol) protocol over stdio transport, giving AI the ability to query table schemas and execute SQL.
Recommended for use with Hawa Code Code Mode.
Quick Start
The package is published to npm and can be run directly via npx — no local build required.
Option 1: Specify the database path via command-line arguments
{ |
Option 2: Specify the database path via environment variable
{ |
Database path priority:
SQLITE_DB_PATHenvironment variable > command-line argument inargs> default./data.sqlite(relative to the MCP client’s working directory). If the client cannot findnpx/node, use the absolute path returned bywhich nodeinstead.
Tools Overview
| Tool | Description |
|---|---|
list_tables |
List all tables/views, optionally including CREATE DDL and column structure |
execute_ddl |
Execute DDL statements (CREATE / ALTER / DROP, supports batch execution of multiple statements) |
execute_sql |
Execute SQL (SELECT / INSERT / UPDATE / DELETE), supports ? parameter binding |
list_tables
Lists all tables and views in the SQLite database, optionally including the CREATE DDL and column structure for each table.
Input
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| includeSchema | boolean | No | true |
Whether to include the CREATE DDL statement and column structure for each table |
Output
| Field | Type | Description |
|---|---|---|
| database | string | Database file path |
| tables | array<TableInfo> | List of tables/views, sorted by name |
| error | string (optional) | Error message on failure; tables is [] on failure |
TableInfo
| Field | Type | Description |
|---|---|---|
| name | string | Table/view name |
| type | string | Object type: "table" or "view" |
| sql | string | null | CREATE DDL statement; null when includeSchema=false |
| columns | array<ColumnInfo> | null | Column structure; null when includeSchema=false or for non-table objects |
ColumnInfo
| Field | Type | Description |
|---|---|---|
| name | string | Column name |
| type | string | Declared column type (e.g. INTEGER, TEXT) |
| notnull | boolean | Whether the column has a NOT NULL constraint |
| defaultValue | string | null | Default value SQL expression |
| primaryKey | boolean | Whether the column is a primary key column |
Example
Request:
{ "includeSchema": true } |
Successful response (excerpt):
{ |
Failed response (isError: true):
{ |
execute_ddl
Executes DDL statements (CREATE / ALTER / DROP TABLE, CREATE INDEX, etc.), supporting batch execution of multiple statements.
Input
| Field | Type | Required | Description |
|---|---|---|---|
| sql | string | Yes | The DDL statement(s) to execute; multiple statements can be submitted at once separated by ; |
Output
| Field | Type | Description |
|---|---|---|
| success | boolean | Whether execution succeeded |
| changes | number | Number of affected rows (always 0 for DDL) |
| error | string (optional) | Error message on failure |
Example
Request:
{ "sql": "CREATE INDEX IF NOT EXISTS idx_users_name ON users(name)" } |
Successful response:
{ "success": true, "changes": 0 } |
Failed response (isError: true):
{ |
execute_sql
Executes arbitrary SQL statements (SELECT / INSERT / UPDATE / DELETE, etc.), supporting parameter binding.
Input
| Field | Type | Required | Description |
|---|---|---|---|
| sql | string | Yes | The SQL statement to execute, using ? placeholders for parameter binding |
| params | array<string | number | boolean | null> | No | Parameter values bound to the SQL placeholders, in order |
Output
| Field | Type | Description |
|---|---|---|
| columns | array<string> | List of column names |
| rows | array<object> | Result rows, each row is a “column name → value” object |
| rowCount | number | Number of result rows (number of affected rows for write operations) |
| error | string (optional) | Error message on failure; columns/rows are [] and rowCount is 0 on failure |
Behavior
- Query statements (SELECT, etc.):
columnscontains the result set column names,rowscontains the query results,rowCount = rows.length - Write statements (INSERT / UPDATE / DELETE, etc.):
columnsis always["changes", "lastInsertRowid"],rowsis a single row[{ changes, lastInsertRowid }],rowCount = changes
Example
SELECT
Request:
{ "sql": "SELECT * FROM users WHERE age > ?", "params": [18] } |
Response:
{ |
INSERT
Request:
{ "sql": "INSERT INTO users (name, age) VALUES (?, ?)", "params": ["Alice", 30] } |
Response:
{ |
Execution failure (isError: true)
{ |