KM

kioyong/mysql-mcp-server-java

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

11 stars 6 forks 质量 50 趋势 18MIT

Spring Boot server implementing Model Context Protocol (MCP) for MySQL database operations.

概览

Spring Boot server implementing Model Context Protocol (MCP) for MySQL database operations. - Execute SELECT queries - List all tables in database - Get table schema information - - Execute a SELECT SQL query and return results - Input: sql (string) - Returns: List of query results (truncated after 4000 characters) - Note: Only SELECT queries are allowed - - List all table names in the database - No input required - Returns: Comma-separated list of table names - - Get schema information for a specific table - Input: tableName (string) - Returns: Comma-separated list of column information including: - Column name - Data type - Nullable constraint - Default value Add this to your mcp server config file: This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.

README

MySQL MCP Server

Spring Boot server implementing Model Context Protocol (MCP) for MySQL database operations.

Features

  • Execute SELECT queries
  • List all tables in database
  • Get table schema information

API

Tools

  • query

    • Execute a SELECT SQL query and return results
    • Input: sql (string)
    • Returns: List of query results (truncated after 4000 characters)
    • Note: Only SELECT queries are allowed
  • listAllTablesName

    • List all table names in the database
    • No input required
    • Returns: Comma-separated list of table names
  • getTableSchema

    • Get schema information for a specific table
    • Input: tableName (string)
    • Returns: Comma-separated list of column information including:
      • Column name
      • Data type
      • Nullable constraint
      • Default value

Build

Maven build:

mvn install

Usage with Claude Desktop or Cline

Add this to your mcp server config file:

{
  "mysql-server": {
    "command": "java",
    "args": [
      "-jar",
      "{{ProjectDirectory}}\\target\\mcp-mysql-server-1.0.0.jar"
    ],
    "env": {
      "SPRING_DATASOURCE_URL": "jdbc:mysql://username:password@localhost:3306/database"
    }
  }
}

Example

License

This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →