
Mcp Sqlite Tools
io.github.spences10由 GitHub 帳號 spences10 發布v0.0.11更新於 Oct 24, 2026
MCP server for local SQLite database operations
概覽
讓助理透過明確的讀取、寫入、結構與交易工具,開啟、查詢、修改、備份與維護本機 SQLite 資料庫檔案。
- 可以做什麼
- 這是一個用於 SQLite 資料庫操作的本機 stdio MCP 伺服器。它提供彼此獨立的工具:開啟與關閉資料庫、列出資料表與檢視表、描述資料表結構、執行分頁唯讀查詢、執行明確的寫入與結構語句、批次插入、匯入匯出含表頭的 CSV、以 SQL 或 JSON 匯出與匯入結構、管理交易與巢狀儲存點、建立線上備份,以及執行 vacuum。唯讀查詢受 SQLite authorizer 限制,破壞性工具被獨立區分,方便用戶端要求核准。
- 適用情境
- 當助理需要檢視或修改本機 SQLite 檔案時使用,例如探索資料集、執行臨時查詢、匯入 CSV、套用結構變更或建立備份。適合資料庫位於同一台機器、且用戶端支援 stdio 伺服器的桌面工作流程。
- 執行需求
- 需要 Node.js 24.12 或更新版本,以及支援 stdio 的 MCP 用戶端;用戶端透過 npx 啟動,不需要全域安裝。選用環境變數可設定預設資料庫路徑、是否允許絕對路徑、備份路徑、忙碌等待逾時、日誌模式與除錯記錄。不需要帳號、API 金鑰或網路存取。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Mcp Sqlite Tools,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
mcp-sqlite-tools
A Model Context Protocol (MCP) server for safe, local SQLite database operations. It gives MCP clients explicit read, write, schema, transaction, CSV, backup, and maintenance tools.
Features
- Open, create, inspect, back up, vacuum, and close SQLite databases
- List, describe, create, and drop tables
- Run paginated read queries with named or positional parameters
- Run explicit write and schema queries
- Import and export headered CSV files
- Use transactions with nested savepoints
- Export and import schemas as SQL or JSON
- Restrict database and CSV paths through configuration
- Classify destructive tools for client approval policies
- Use Node's built-in SQLite driver with no native addon dependency
Requirements
- Node.js 24.12 or later
- An MCP client with stdio server support
Configure your MCP client
The MCP client starts this server through npx; a global installation
is not required.
Install with MCPick
MCPick can add the server to a supported client without manual JSON editing. This command targets Claude Code's local scope by default:
Select a client and scope explicitly when needed:
The add command supports Claude Code, Gemini CLI, VS Code, Cursor,
Windsurf, OpenCode, and Pi. Run npx mcpick clients to see current
client capabilities, scopes, and configuration locations.
The examples track the latest package release. For reproducible
configuration, replace mcp-sqlite-tools in --args with an exact
version such as [email protected].
Manual configuration
For unsupported clients or advanced configuration, add the server manually:
VS Code uses a servers object instead of mcpServers. See the
configuration guide
for more client-specific examples.
Environment variables
When SQLITE_ALLOW_ABSOLUTE_PATHS=false, relative and absolute paths
must resolve inside SQLITE_DEFAULT_PATH. Symbolic links cannot be
used to escape that directory.
Use SQLITE_JOURNAL_MODE=delete for databases in file-synchronized
directories. The unsafe SQLite modes memory and off are not
accepted.
SQLITE_MAX_QUERY_TIME remains available as a deprecated alias for
SQLITE_BUSY_TIMEOUT. It does not limit wall-clock query runtime.
Tools
Tools are separated by intent so MCP clients can apply clear approval rules.
Safe and read-only
Writes, schema, and maintenance
See the complete API reference for parameters, responses, examples, pagination, and CSV options.
Safety model
The server does not treat every SQL string as equivalent:
execute_read_queryuses SQLite's authorizer API to reject writes, schema changes, unsafe PRAGMAs, attachment, and multiple statements.- Write, schema, transaction, and destructive administration actions use separate tools so clients can request approval.
- Database and CSV paths are resolved and validated before access.
- Identifiers generated by tools are quoted.
- Values are bound as parameters rather than interpolated into SQL.
- Backups use SQLite's online backup API and include committed WAL data.
A client can allow read-only tools and require approval for destructive tools. Always review SQL and file paths before approving changes. Back up important databases before schema changes, imports, or large writes.
Why native SQLite?
Using node:sqlite removes the native addon, its install script, and
its platform-specific binaries. A clean production install fell from
31.3 MB with better-sqlite3 to 3.6 MB with native SQLite, an 88.5%
reduction. The npm tarball itself is similar in size: 63.1 KB native
versus 60.0 KB published. The large saving is in the installed
dependency tree.
The migration also removes better-sqlite3 and its type package. It
makes installation independent of prebuilt addon availability or a
working native compiler.
Driver benchmark
Lower times are better. These medians use 20,000 rows, two warmups, and seven measured runs per driver. Each sample uses a new database and the driver order alternates. Setup is outside the measured region except for the insert workload.
Measured on Linux x64 with Node.js 24.15.0 and an AMD Ryzen AI 9
HX 370. Node used SQLite 3.51.3; [email protected] used SQLite
3.53.3. These microbenchmarks show driver trade-offs, not complete MCP
performance. MCP transport and validation costs are not included.
Development
See development and architecture for module responsibilities and other development commands.
Documentation
Contributing
Issues and pull requests are welcome.
License
MIT License. See LICENSE.
來源:README.md,提交 104e092
工具
0版本歷史
1- v0.0.11最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分