
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 分