
text2sql
io.github.cpenniman12由 GitHub 帳號 cpenniman12 發布v0.1.2更新於 Oct 24, 2026
Ask any SQL database in natural language. Agent explores schema, writes SQL, self-corrects.
概覽
讓助理以自然語言查詢 SQL 資料庫,自動探索 schema、撰寫並執行 SQL,並在出錯時自我修正。
- 可以做什麼
- 以自然語言向資料庫提問,取得產生的 SQL、查詢結果、錯誤與列數。
- 適用情境
- 當你想直接用自然語言向 SQLite、Postgres、MySQL、Snowflake 或 BigQuery 資料庫提問,而不想手寫 SQL 或事先建立 schema 說明與向量索引時,適合加入此伺服器。
- 執行需求
- 需在本機以 Python 套件執行(pip 或 uvx),並依資料庫安裝對應 extra(postgres、mysql、snowflake、bigquery)。需設定 TEXT2SQL_DATABASE_URL,以及 ANTHROPIC_API_KEY 或 OPENAI_API_KEY;可選用 TEXT2SQL_MODEL、TEXT2SQL_INSTRUCTIONS、TEXT2SQL_EXAMPLES。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 text2sql,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
text2sql-mcp
MCP server for text2sql-framework. Plugs into Claude Desktop, Cursor, Goose, or any other MCP-compatible assistant and lets it ask a SQL database questions in natural language.
The agent explores the schema, writes SQL, executes it against the real DB, and self-corrects on errors — no RAG layer, no schema descriptions, no pre-computed embeddings.
Install
Out of the box, text2sql-mcp supports SQLite + Anthropic:
For other databases or LLM providers, install with the matching extra so the right driver gets installed:
Configure
Set environment variables in your MCP client config:
Claude Desktop / Cursor / generic MCP
Goose CLI
Tools
query(question, max_rows=100)— ask the database a natural-language question. Returns{sql, data, error, row_count, tool_calls_made}.
How it works
Under the hood this is a thin wrapper around text2sql-framework, which uses LangChain Deep Agents to do iterative tool-calling against a single execute_sql tool. See the framework README for benchmarks (19/20 on Spider zero-shot across 80 tables) and architecture details.
License
MIT
來源:README.md,提交 97142b4
工具
0版本歷史
1- v0.1.2最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分