Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

mysql-mcp-server-java

MCP.Pizza Chef: kioyong

mysql-mcp-server-java is a Spring Boot-based MCP server that enables structured interaction with MySQL databases. It supports executing SELECT queries, listing all tables, and retrieving detailed table schema information. Designed for integration with MCP clients, it facilitates real-time database querying and schema exploration within AI-enhanced workflows.

Use This MCP server To

Execute SELECT queries on MySQL databases via MCP Retrieve list of all tables in a MySQL database Fetch detailed schema information for specific tables Integrate MySQL data querying into AI copilot workflows Enable real-time database inspection for LLM-powered tools

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

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.

mysql-mcp-server-java FAQ

How do I build the mysql-mcp-server-java?
Use Maven with the command 'mvn install' to build the server.
What types of SQL queries does this MCP server support?
It supports only SELECT queries to ensure safe read-only access.
How can I retrieve the schema of a specific table?
Use the 'getTableSchema' tool with the table name as input to get column details.
Can this server list all tables in the connected MySQL database?
Yes, the 'listAllTablesName' tool returns a comma-separated list of all table names.
Is this MCP server compatible with popular LLM clients?
Yes, it can be integrated with clients like Claude Desktop and Cline for enhanced database querying.
Are there any limitations on query result size?
Query results are truncated after 4000 characters to manage response size.
How do I configure this server for use with MCP clients?
Add the server command configuration in your MCP server config file as shown in usage examples.