MCP ExplorerExplorer

Mysql Mcp Server Java

@kioyongon a year ago
9 MIT
FreeCommunity
AI Systems
The MySQL MCP Server is a Spring Boot application that implements the Model Context Protocol for MySQL operations. It allows executing SELECT queries, listing all database tables, and retrieving table schema information, making database management efficient and straightforward.

Overview

What is Mysql Mcp Server Java

mysql-mcp-server-java is a Spring Boot server that implements the Model Context Protocol (MCP) for performing MySQL database operations.

Use cases

Use cases include querying data from a MySQL database, retrieving table structures for dynamic applications, and integrating with other services that require database access.

How to use

To use mysql-mcp-server-java, add the provided configuration to your MCP server config file, specifying the command to run the server and the database connection details.

Key features

Key features include executing SELECT queries, listing all tables in the database, and retrieving schema information for specific tables.

Where to use

mysql-mcp-server-java can be used in applications that require interaction with MySQL databases, such as web applications, data analysis tools, and backend services.

Content

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"
    }
  }
}

001.png

Example

002.png

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.

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers