Text2sqlMCP

DeepLearn1998/Text2sqlMCP

3.1

If you are the rightful owner of Text2sqlMCP and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

Text2sqlMCP is a server that enables querying databases using natural language.

Text2sqlMCP

支持使用自然语言查询数据库的 MCP server

input:自然语言

output:可执行 SQL / 目前暂无相关数据

Python Version

环境配置

  • Python >= 3.12
  • 安装依赖:
  • 修改配置:

项目结构

/Text2sqlMCP
├── data
├── llm
|   └── BAAI-bge-m3    # embedding 模型
├── schema    # 数据库连接
|   ├── __init__.py
|   └── db_config.py
├── utils    # 工具包
|   ├── __init__.py    # 初始化日志
|   ├── config_load.py    # 加载配置信息
|   ├── embedding.py    # embedding 匹配
|   ├── llm.py    # API 调用 LLM
|   ├── logging_setting.py    # 日志设置
|   ├── question_match.py    # 问题匹配
|   └── sql_process.py    # SQL 处理
├── config.ini    # 配置文件
├── evaluation    # Text2sql 生成性能评估
├── main.py    # Text2sql MCP server
├── project_path.py    # 定位项目根路径
├── README.md    # 说明文档
└── requirements.txt    # 依赖需求

sql_execute_result

根据用户提问,使用 SQL(考虑到安全性,目前仅支持 SELECT ...)查询数据库,并返回相应结果

input:用户提问

output:数据库查询结果

STDIO 配置

--directory
path/to/text2sql
run
--with
mcp
main.py