MCP MySQL Server is an MCP server that executes arbitrary SQL queries against configured MySQL databases using Spring AI. It connects AI clients to local or remote MySQL instances, providing developers, data analysts, and automated agents with the capability to run SQL operations and retrieve structured relational data directly during conversation. The server supports multiple data source configurations defined in a YAML configuration file, enabling dynamic switching between different database environments at runtime. To protect database integrity, MCP MySQL Server integrates SQL security controls designed to prevent models from executing potentially dangerous database commands. In addition to core querying capabilities, it provides an extension mechanism powered by Groovy scripts, allowing users to define custom behaviors and tasks that integrate directly into the Spring AI execution context.
Category: Databases & Data Stores
Tags: database, mysql, spring-ai, SQL
mcp-mysql-server/src/main/resources/datasource.yml under the datasource.datasources section with your MySQL URL, credentials, and default selection. 3. Build the project executable JAR by running ./mvnw clean package. 4. Register the server in your MCP client configuration (such as Claude Desktop) under mcpServers: json { "mcpServers": { "mcp-mysql-server": { "command": "java", "args": [ "-jar", "/absolute/path/to/mcp-mysql-server/target/mcp-mysql-server-0.0.1-SNAPSHOT.jar" ] } } } Alternatively, specify the Maven Wrapper command to run with spring-boot:run.Part of MCP Servers
MCP MySQL Server is an open source Model Context Protocol server built with Spring AI. It exposes tools allowing AI assistants to execute arbitrary SQL statements against configured MySQL database instances.
MCP MySQL Server requires Java Development Kit (JDK) version 21 or higher and Apache Maven version 3.6 or higher to compile and run the application.
You define your connection strings, usernames, passwords, and default targets inside the datasource.yml file located under the src/main/resources directory of the project repository.
Yes, it supports multi-datasource management. Multiple MySQL database profiles can be defined simultaneously in the YAML configuration, and the server can switch between them at runtime.
Yes, MCP MySQL Server is an open source project available on GitHub under the repository JamesSmith888/mcp-mysql-server.