ClaudeCodeMod

All shelves / MCP servers

MCP MySQL Server

JamesSmith888/mcp-mysql-server · 26 stars · Java

MCP server A Spring AI-based MCP capable of executing any SQL query. 一个基于 Spring AI 的MCP服务,可执行任意 SQL。

Install

The repo has no one-line install. Follow its README.

Open the repo

Files

README.md

MCP MySQL Server

一个基于 Spring AI 的MCP,可执行任意 SQL。

关于其他数据库支持,请查看 mcp-db-server

中文文档 | English Documentation

快速上手

1. MCP JSON 配置

方式一:Maven Wrapper 启动

{
  "mcpServers": {
    "mcp-mysql-server": {
      "command": "/Users/xin.y/IdeaProjects/mcp-mysql-server/mvnw",
      "args": [
        "-q",
        "-f",
        "/Users/xin.y/IdeaProjects/mcp-mysql-server/pom.xml",
        "spring-boot:run"
      ]
    }
  }
}

方式二:JAR 包启动

构建jar

./mvnw clean package

配置MCP服务器

{
  "mcpServers": {
    "mcp-mysql-server": {
      "command": "java",
      "args": [
        "-Dloader.path=/Users/xin.y/IdeaProjects/mcp-mysql-server/src/main/resources/groovy",
        "-jar",
        "/Users/xin.y/IdeaProjects/mcp-mysql-server/target/mcp-mysql-server-0.0.1-SNAPSHOT.jar"
      ]
    }
  }
}

注意: -Dloader.path 参数为可选,仅在需要运行扩展功能时才需要指定。

2. 数据源配置

修改 mcp-mysql-server/src/main/resources/datasource.yml 文件:

datasource:
  datasources:
    your_db1_name:
      url: jdbc:mysql://localhost:3306/db1
      username: root
      password: password
      default: true  # 标记为默认数据源

功能特点

  • 多数据源支持 - 配置和管理多个数据库数据源
  • 动态数据源切换 - 运行时动态切换不同的数据源
  • 扩展功能 - 通过 Groovy 脚本扩展功能
  • SQL 安全控制 - 防止 AI 模型执行危险 SQL 操作

详细文档

文档 描述
扩展功能文档 Groovy 脚本扩展的详细配置和开发指南
数据源配置文档 数据源的详细配置、多环境管理和最佳实践
SQL 安全控制文档 SQL 安全策略的配置和管理

环境要求

  • JDK 21+
  • Maven 3.6+

Facts

Kind
MCP server
Repo
JamesSmith888/mcp-mysql-server
Group
Uncategorized
Stars
26
Language
Java
Last push
2025-09-09
Forks
5
Topics
mcp, mysql, springai

More on this shelf

  1. 1REAio.github.morluto/reaReverse engineer anything from your terminal or agent with one CLI and MCP server.125.3k
  2. 2com.browser-use/browser-usecom.browser-use/browser-useControl a real Chrome browser to complete any task: fill forms, extract data, book flights.117.7k
  3. 3World Monitorapp.worldmonitor/mcpLive markets, conflicts, country risk, chokepoints, energy, and China decision signals. 93 tools.88.3k
  4. 4Scrapling MCP Serverd4vinci/scrapling🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scraplingdev86.9k
  5. 5Everythingmodelcontextprotocol/serversThis MCP server attempts to exercise all the features of the MCP protocol. It is not intended to be a useful server, but rather a test server for builders of MCP clients. It implements prompts, tools, resources, sampling, and more to showcase MCP capabilities.85.8k
  6. 6Fetchmodelcontextprotocol/serversA Model Context Protocol server that provides web content fetching capabilities. This server enables LLMs to retrieve and process content from web pages, converting HTML to markdown for easier consumption.85.8k