Get the FREE Ultimate OpenClaw Setup Guide →

mysql

极易部署 • 高性能 • 低内存占用 • 云原生支持 •Java版本的MySql MCP服务

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio gokeep-projects-mysql-mcp-server java -jar mysql-mcp-server-runner.jar \
  --env MYSQL_HOST="MySQL host address" \
  --env MYSQL_PORT="MySQL port (default 3306)" \
  --env MYSQL_DATABASE="MySQL database name" \
  --env MYSQL_PASSWORD="MySQL password" \
  --env MYSQL_USERNAME="MySQL username"

How to use

This MCP server provides a lightweight, cloud-native MySQL-focused MCP service built with Quarkus. It exposes two communication protocols for clients: Server-Sent Events (SSE) at /mcp/sse and a streamable HTTP endpoint at /mcp, allowing AI-assisted interactions with your MySQL data source. The server is designed for fast startup and low memory usage, and supports a suite of MySQL query tools to inspect databases, tables, and execute SQL queries. To get started, run the packaged runner (a Java-based jar) and configure the MySQL connection via command-line arguments or environment variables as documented in the startup parameters. Once running, you can connect your MCP-enabled client to the endpoints and begin issuing queries through the MCP tooling interface.

How to install

Prerequisites:

  • Java 17+ (Java 21 recommended)
  • Maven 3.8+ (for building from source)
  • A MySQL server instance to connect to

Installation steps:

  1. Download or build the MCP server:
    • If using a prebuilt jar: obtain mysql-mcp-server-runner.jar from the releases page
    • If building from source:
      mvn clean package
      
    • For native image (optional):
      mvn package -Dnative
      
  2. Prepare runtime environment:
    • Ensure Java is installed and accessible via PATH
    • Create a directory for the server artifacts, e.g. /opt/mysql-mcp-server
    • Place the downloaded mysql-mcp-server-runner.jar (and any lib dependencies) in that directory
  3. Run the server (examples):
    • JVM mode (default):
      java -jar /opt/mysql-mcp-server/mysql-mcp-server-runner.jar
      
    • If you need to specify MySQL connection via environment variables (recommended for container usage):
      export MYSQL_HOST=127.0.0.1
      export MYSQL_PORT=3306
      export MYSQL_USERNAME=root
      export MYSQL_PASSWORD=yourpassword
      export MYSQL_DATABASE=yourdb
      java -jar /opt/mysql-mcp-server/mysql-mcp-server-runner.jar
      
  4. Verify startup and connect to MCP endpoints:
    • SSE: http://{host}:29000/mcp/sse
    • Streamable: http://{host}:29000/mcp

Notes:

  • The default endpoints listen on 0.0.0.0:29000 when running in typical environments. Adjust startup parameters or environment variables as needed.

Additional notes

Tips and common considerations:

  • The server supports both SSE and Streamable HTTP endpoints; choose the protocol that best fits your client integration.
  • Use the environment variable approach for containerized deployments to simplify configuration management (MYSQL_HOST, MYSQL_PORT, MYSQL_USERNAME, MYSQL_PASSWORD, MYSQL_DATABASE).
  • If you encounter connectivity issues, verify that the MySQL server is reachable from the MCP host and that user permissions allow the specified database operations.
  • For production, consider using the native image build to reduce startup time and memory footprint.
  • If you plan to customize or extend tooling, refer to the project’s development docs which describe how to add new tools within MysqlMcpServer.java and the tool annotation usage.

Related MCP Servers

Sponsor this space

Reach thousands of developers