text2sql-mcp-server

MCP.Pizza Chef: mariaccc

text2sql-mcp-server is an MCP server that translates natural language queries into SQL statements. It connects to a MySQL database and exposes an API for real-time text-to-SQL conversion, enabling applications to query databases using plain language. It supports configuration via application.yml or Docker Compose and integrates with MCP clients like cherry-studio for seamless query generation.

Use This MCP server To

Translate user questions into SQL queries automatically Enable natural language database querying in applications Integrate with MCP clients for real-time SQL generation Deploy as a Docker container for easy database query service Configure MySQL datasource for dynamic query execution

README

text2sql-mcp-server

使用

服务启动

修改application.yml,直接运行

  datasource:
    url: ${SPRING_DATASOURCE_URL:jdbc:mysql://127.0.0.1:3306/mysql?characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true}
    username: ${SPRING_DATASOURCE_USERNAME:root}
    password: ${SPRING_DATASOURCE_PASSWORD:password}

或者修改docker-compose.yaml,使用docker compose up --build -d

environment:
  SPRING_DATASOURCE_URL: "jdbc:mysql://127.0.0.1:3306/mysql?characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true"
  SPRING_DATASOURCE_USERNAME: "root"
  SPRING_DATASOURCE_PASSWORD: "password"

客户端配置

cherry-studio配置

{
  "name": "text2sql-mcp-server",
  "type": "sse",
  "description": "",
  "isActive": true,
  "baseUrl": "http://localhost:8080/sse"
}

提示词模板

数据库:xxx 查询xxx

text2sql-mcp-server FAQ

How do I configure the database connection for text2sql-mcp-server?
Modify the application.yml or docker-compose.yaml to set MySQL datasource URL, username, and password.
Can I run text2sql-mcp-server using Docker?
Yes, you can use docker compose up --build -d with the provided docker-compose.yaml configuration.
How does text2sql-mcp-server integrate with MCP clients?
It exposes an SSE endpoint that MCP clients like cherry-studio can connect to for real-time SQL query generation.
What databases are supported by text2sql-mcp-server?
It is primarily configured for MySQL but can be adapted to other JDBC-compatible databases with configuration changes.
Is there a prompt template for generating SQL queries?
Yes, the server uses prompt templates specifying the database and query context to guide SQL generation.
What is the recommended way to activate the server in MCP clients?
Set the client configuration with type 'sse', baseUrl pointing to the server's SSE endpoint, and isActive true.