The `mcp-sqlite-tools` package provides a Model Context Protocol (MCP) server designed to enable AI assistants and LLMs to safely and efficiently interact with local SQLite databases. Currently at version 0.0.17, it is under active development, indicating potential API changes before a stable 1.0 release. It offers comprehensive features for database management, table and query operations (read, write, schema), transaction control (with savepoints), schema export/import, and database maintenance like backups and vacuuming. Key differentiators include built-in security features such as query classification, path validation, input validation using Valibot, and advanced connection pooling. The server explicitly categorizes database operations into 'SAFE', 'DESTRUCTIVE', 'SCHEMA CHANGE', and 'TRANSACTION' tools, allowing for granular permission control in MCP clients, preventing unintended data modifications or schema changes by LLMs.
npm install mcp-sqlite-toolsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to instantiate and run the `mcp-sqlite-tools` server, configuring it to listen on a specific port and manage a local SQLite database within a restricted directory for security. It includes basic error handling and graceful shutdown.
Pin exact versions (e.g., `"mcp-sqlite-tools": "0.0.17"`) in `package.json` and review changelogs carefully when upgrading.
Carefully define `allowedPaths` to include only necessary directories. Implement robust client-side approval flows as suggested in the README for 'DESTRUCTIVE' and 'SCHEMA CHANGE' tools to prevent accidental or malicious actions by LLMs.
Understand that this package is the backend for database operations. If you need direct Node.js SQLite access within your application, consider using libraries like `sqlite3` or `better-sqlite3` directly, or interact with this server via its defined MCP interface.
Install a compatible SQLite driver: `npm install sqlite3` or `npm install better-sqlite3`. Ensure native dependencies are correctly built, especially on different operating systems or Node.js versions.
Verify that `databasePath` and any paths used within queries are correctly configured and explicitly listed in the `allowedPaths` array when instantiating `MCPSQLiteServer`.
Ensure `import { MCPSQLiteServer } from 'mcp-sqlite-tools';` is present and that you are instantiating the server correctly with `new MCPSQLiteServer(...)` before calling `.start()`.