MySqlMcpServerDemo

roinheart/MySqlMcpServerDemo

3.1

If you are the rightful owner of MySqlMcpServerDemo 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.

The MySQL MCP Server is developed using the Spring AI framework, designed to facilitate communication with tools like cline and Tongyi Lingma.

使用Spring AI开发的MySQL MCP服务器 - MysqlMcpServer

项目简介

基于Spring AI框架的MySQL MCP服务器,可用于cline,通义灵码等工具。

安装与配置步骤

  1. 获取项目代码
   git clone https://github.com/roinheart/MySqlMcpServerDemo.git
  1. 配置数据库连接
spring:
   application:
      name: Mysql-Mcp-Server
   datasource:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://127.0.0.1:3306/you_db?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
      username: root
      password: root
   ai:
      mcp:
         server:
            stdio: true
   main:
      banner-mode: off
      web-application-type: none

logging:
   pattern:
      console:

  1. 构建项目
   mvn install
  1. 配置mcpServers
{
   "mcpServers": {
      "mysql": {
         "command": "java",
         "args": [
            "-Dspring.ai.mcp.server.stdio=true",
            "-Dspring.main.web-application-type=none",
            "-Dlogging.pattern.console=",
            "-jar",
            "/you/path/Mysql-Mcp-Server-0.0.1-SNAPSHOT.jar"
         ]
      }
   }
}

注意

  1. 配置文件路径为:/you/path/Mysql-Mcp-Server-0.0.1-SNAPSHOT.jar,请自行修改。
  2. 系统已安装JDK17及以上版本