Easy Sqlite Mcp

by chenkumi

264 downloads
Not rated
GitHub

About

A Model Context Protocol (MCP) server implemented in Node.js and TypeScript, designed to enable LLMs to interact directly with SQLite databases.

Details

Author
chenkumi
Downloads
264
Categories
Database

- Connection Management: sqlite_open, sqlite_close, sqlite_status (manual mode only for open/close)
- Data Operations: sqlite_query (read-only SELECT), sqlite_execute (INSERT/UPDATE/DELETE/CREATE/DROP)
- Schema Discovery: sqlite_list_tables, sqlite_describe_table (columns, types, row count)

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Easy Sqlite Mcp
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Run via npx easy-sqlite-mcp. For manual mode, no environment variable; for fixed mode, set the SQLITE_PATH environment variable to a database file path. Configuration examples are provided for Claude Desktop, Codex, and OpenCode clients.

sqlite_open

Open an SQLite database file at the specified path. Args: - file_path (string): Absolute or relative path to the .db / .sqlite file. Returns: { "success": boolean, "message": string } Examples: - "Open the users database" -> file_path="/data/users.db" Error Handling: - Returns success=false with message if the file cannot be opened.

sqlite_close

Close the currently open SQLite database connection. Returns: { "success": boolean, "message": string } Error Handling: - Returns success=false if no database is currently open.

sqlite_status

Get the current status of the SQLite database connection. Returns: { "isOpen": boolean, "filePath": string | null, "memoryUsage": number | null, "tables": number | null }

sqlite_query

Execute a read-only SQL query (SELECT) on the currently open database. Args: - sql (string): The SQL SELECT statement to execute. - params (object, optional): Named parameters for the query. Use placeholder names without the SQL prefix in the params object, e.g. SQL ":id" uses params { "id": 1 }. Returns: { "columns": string[], "rows": unknown[][], "rowCount": number } Error Handling: - Throws if no database is open. Use sqlite_open first. - Returns SQL error message if the query is invalid.

sqlite_execute

Execute a write SQL statement (INSERT, UPDATE, DELETE, CREATE, DROP, ALTER) on the currently open database. Args: - sql (string): The SQL statement to execute. - params (object, optional): Named parameters for the statement. Use placeholder names without the SQL prefix in the params object, e.g. SQL ":id" uses params { "id": 1 }. Returns: { "changes": number, "lastInsertRowid": number } Error Handling: - Throws if no database is open. Use sqlite_open first. - Returns SQL error message if the statement is invalid.

sqlite_list_tables

List all user tables in the currently open SQLite database. Returns: { "tables": string[] } Error Handling: - Throws if no database is open. Use sqlite_open first.

sqlite_describe_table

Describe the schema of a specific table in the currently open SQLite database. Args: - table_name (string): Name of the table to describe. Returns: { "name": string, "columns": [ { "cid": number, "name": string, "type": string, "notnull": boolean, "defaultValue": unknown, "pk": boolean } ], "rowCount": number } Error Handling: - Throws if no database is open. Use sqlite_open first. - Returns error if the table does not exist.

sqlite_manual

Return the SQLite MCP manual. Use this first when you are unsure how to use sqlite_open, sqlite_query, sqlite_execute, or when an operation fails and you need the safe usage rules, placeholder rules, or database lifecycle guidance.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "easy sqlite mcp": {
            "easy-sqlite-mcp": {
                "command": "npx",
                "args": [
                    "-y",
                    "easy-sqlite-mcp"
                ]
            }
        }
    }
}

McpServers

{
    "easy-sqlite-mcp": {
        "command": "npx",
        "args": [
            "-y",
            "easy-sqlite-mcp"
        ]
    }
}

Easy SQLite MCP

A Model Context Protocol (MCP) server implemented in Node.js and TypeScript, designed to enable LLMs to interact directly with SQLite databases.

Modes

Easy SQLite MCP supports two startup modes. The server description is generated at startup so MCP clients and agents can clearly understand which mode is active.

Manual Mode

Manual mode is used when SQLITE_PATH is not provided.

In this mode, the agent must explicitly open and close a database:

1. Call sqlite_open(path) before using database tools.
2. Use query, execute, and schema discovery tools.
3. Call sqlite_close when finished.

Only one SQLite database file can be open at a time. Opening another file closes the previous connection first.

Server description:

Manual: This is a SQLite tool. Before using it, call sqlite_open(path) to open a database file. After use, call sqlite_close to close it. Only one database file can be open at a time.

Available tools in Manual mode:

- sqlite_open
- sqlite_close
- sqlite_status
- sqlite_query
- sqlite_execute
- sqlite_list_tables
- sqlite_describe_table

Fixed Mode

Fixed mode is used when SQLITE_PATH is provided as an environment variable.

In this mode, the server automatically opens the configured SQLite database during startup. The agent does not need to call sqlite_open, and connection switching is disabled.

Server description:

Fixed: This is a SQLite tool connected to Path:<SQLITE_PATH>

Available tools in Fixed mode:

- sqlite_status
- sqlite_query
- sqlite_execute
- sqlite_list_tables
- sqlite_describe_table

Example:

SQLITE_PATH=/data/app.sqlite npx easy-sqlite-mcp

Features

This server provides SQLite tools covering all requirements from connection management to data querying:

1. Connection Management:
sqlite_open: Open a specific SQLite database file path. Manual mode only.
sqlite_close: Close the current database connection. Manual mode only.
sqlite_status: Check connection status, file path, and database summary.
2. Data Operations:
sqlite_query: Execute read-only SELECT queries and return results in a structured format.
sqlite_execute: Execute write or modification operations (e.g., INSERT, UPDATE, DELETE, CREATE, DROP).
3. Schema Discovery:
sqlite_list_tables: List all user-defined tables in the database.
* sqlite_describe_table: Get column information, types, and total row count for a specific table.

Installation and Execution

1. Run via npx

If the project is published on npm, you can start it directly using npx without prior installation:
npx easy-sqlite-mcp

2. Local Development and Build

To develop locally or build from source, follow these steps:
npm install
npm run build
npm run dev # Watch for changes and run in development mode

Claude Desktop Example

Manual mode:

{
  "mcpServers": {
    "easy-sqlite-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "easy-sqlite-mcp"
      ]
    }
  }
}

Fixed mode example:

{
  "mcpServers": {
    "easy-sqlite-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "easy-sqlite-mcp"
      ],
      "env": {
        "SQLITE_PATH": "/absolute/path/to/database.sqlite"
      }
    }
  }
}

Codex config.toml Example

Manual mode:

[mcp_servers.easy-sqlite-mcp]
args = ["-y", "easy-sqlite-mcp"]
command = "npx"
enabled = true

Fixed mode example:

[mcp_servers.easy-sqlite-mcp]
args = ["-y", "easy-sqlite-mcp"]
command = "npx"
enabled = true

[mcp_servers.easy-sqlite-mcp.env]
SQLITE_PATH = "/absolute/path/to/database.sqlite"

OpenCode opencode.jsonc Example

Manual mode:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "easy-sqlite-mcp": {
      "type": "local",
      "command": ["npx", "-y", "easy-sqlite-mcp"],
      "enabled": true,
    },
  },
}

Fixed mode example:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "easy-sqlite-mcp": {
      "type": "local",
      "command": ["npx", "-y", "easy-sqlite-mcp"],
      "enabled": true,
      "environment": {
        "SQLITE_PATH": "/absolute/path/to/database.sqlite"
      },
    },
  },
}

Tech Stack

- Runtime: Node.js (>= 18) - Language: TypeScript - SDK: @modelcontextprotocol/sdk - Database: better-sqlite3 (High performance with support for synchronous operations) - Validation: Zod (Strict parameter validation)

---
Developed with the assistance of Antigravity.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.