Get the FREE Ultimate OpenClaw Setup Guide →

text2sql

MCP server from mariaccc/text2sql-mcp-server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio mariaccc-text2sql-mcp-server docker compose up --build -d \
  --env SPRING_DATASOURCE_URL="jdbc:mysql://127.0.0.1:3306/mysql?characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true" \
  --env SPRING_DATASOURCE_PASSWORD="password" \
  --env SPRING_DATASOURCE_USERNAME="root"

How to use

This MCP server exposes an SSE-based interface for a text-to-SQL capability. It is configured to connect to a MySQL database and provide endpoints that can be consumed by clients using the server-sent events (SSE) mechanism. To start, you can deploy via Docker Compose as described in the installation steps. Once running, the server will be reachable via the configured base URL and port (as per your deployment, commonly http://localhost:8080 or via the docker-compose network). Use the SSE client in your tooling to subscribe to the server and send your natural language prompts to obtain SQL queries.

The client configuration example included in the repository shows how to connect to the SSE endpoint. The server is designed to accept textual prompts and respond with generated SQL statements or related guidance, enabling rapid prototyping of natural language to SQL translation workflows. Ensure your MySQL instance is accessible with the provided credentials, and that the database schema you intend to query is available in the configured database.

How to install

Prerequisites:

  • Docker and Docker Compose installed on your system
  • A MySQL database instance accessible from the server (default host 127.0.0.1:3306 in the example)

Installation steps:

  1. Clone the MCP server repository: git clone <repository-url> cd text2sql-mcp-server

  2. Prepare environment variables (example using Docker Compose):

    • Create or edit docker-compose.yaml to expose the Spring datasource settings: 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"
  3. Start the server with Docker Compose: docker compose up --build -d

  4. Verify the server is running by checking logs or hitting a health check endpoint if provided in the project.

Alternative (non-Docker) approach – if running directly with Java:

  • Ensure JDK is installed (Java 11+).
  • Build and run the Spring Boot application per the project’s instructions (e.g., mvn spring-boot:run or java -jar target/*.jar).
  • Set the same SPRING_DATASOURCE_* environment variables or application.yaml properties before starting.

Additional notes

Tips and caveats:

  • Ensure the MySQL datasource is reachable from the server. If running in Docker, consider using a Docker network or a linked container for MySQL.
  • The README example uses docker-compose for convenience; if you modify ports, update the baseUrl in client config accordingly.
  • The client configuration example shows a minimal SSE client setup; adapt the baseUrl to your deployment address.
  • If you encounter connection errors, double-check that the database user has the required privileges and that characterEncoding and SSL settings align with your MySQL server configuration.
  • For production, consider securing the SSE endpoint and properly managing database credentials (e.g., via secrets management).
  • If you need to reconfigure database credentials, update the SPRING_DATASOURCE_* values and restart the server.

Related MCP Servers

Sponsor this space

Reach thousands of developers