About this product
SQLCraft MCP is a Model Context Protocol server that translates Chinese natural-language requests into SQL, purely with local rules. Zero network requests, zero data upload, no database connections — safe for environments where data must stay local.
What you get: the complete source package as the listing download. Setup: unzip, run `npm install`, then register it with any MCP client, for example `claude mcp add sqlcraft -- node /path/to/mcp-sqlcraft/index.js`. Requires Node.js >= 18. The included e2e suite (13 checks) passes as of 2026-11-25: run `npm test`.
Tools:
1. sqlcraft_generate — input: query (Chinese requirement), dialect (optional: mysql | postgresql | sqlite | sqlserver | oracle | clickhouse; dialect names mentioned in the query are auto-detected). Output: { sql, warnings[], dialect }. Supports SELECT, aggregation (COUNT/AVG/SUM/MAX/MIN), conditions, ORDER BY, LIMIT/TOP/FETCH FIRST, UPDATE, DELETE, INSERT, CREATE TABLE. Emits Chinese risk warnings for SELECT *, full-table COUNT, leading-wildcard LIKE, and WHERE-less DELETE/UPDATE.
2. sqlcraft_explain — input: sql. Output: { statement_type, clauses[], warnings[] } with per-clause explanations and high-risk pattern alerts (e.g. DELETE without WHERE).
3. sqlcraft_dialects — no input. Output: { dialects[] } with each dialect's identifier quoting and row-limit syntax.
Example — input: 查 users 表里 age 大于 30 的用户,按 created_at 降序,前 10 条 (dialect=mysql):
SELECT *
FROM `users`
WHERE `age` > 30
ORDER BY `created_at` DESC
LIMIT 10;