Provides live MySQL data via MCP tools for querying with no SQL needed.
Configuration
View docs{
"mcpServers": {
"cdatasoftware-mysql-mcp-server-by-cdata": {
"command": "java",
"args": [
"-jar",
"/PATH/TO/CDataMCP-jar-with-dependencies.jar",
"/PATH/TO/mysql.prp"
]
}
}
}You can run a local, read-only MCP server that exposes live MySQL data via the CData JDBC Driver. This enables large language models to query your MySQL data using natural language, returning live results without writing SQL.
To use the server with an MCP client, start the local MCP server on your machine and point the client at it. The server presents a set of tools that let you list tables and columns, and run read-only queries against your MySQL data. You can then ask the client questions in natural language, and the MCP tools will fetch the relevant data from MySQL for you. Typical usage includes asking questions like what is the distribution of a specific field, or how a particular metric has trended across tables, without writing SQL.
# Prerequisites
- Install Java Runtime Environment (JRE/JDK) 11+
- Install Maven (for building the MCP server)
# 1) Clone the project
git clone https://github.com/cdatasoftware/mysql-mcp-server-by-cdata.git
cd mysql-mcp-server-by-cdata
# 2) Build the server
mvn clean install
# This creates the JAR: CDataMCP-jar-with-dependencies.jar4) Install the CData JDBC Driver for MySQL and license it. Follow the driver’s installer steps to reach the lib directory, then license the driver with the provided command.
# License the driver (example path; adjust to your installation)
java -jar cdata.jdbc.mysql.jar --license
```
Enter your name, email, and your license key (or TRIAL).5) Configure your connection to the data source. Use the driver’s Connection String utility to build a JDBC URL, test the connection, and copy the JDBC URL for later use.
java -jar cdata.jdbc.mysql.jar
```
Follow prompts to configure and test the connection. If OAuth is used, complete authentication in your browser. Save the resulting JDBC URL.6) Create a properties file for the JDBC connection. Save it as mysql.prp (or another name you choose) with these required fields.
Prefix=mysql
ServerName=CDataMySQL
ServerVersion=1.0
DriverPath=PATH\TO\cdata.jdbc.mysql.jar
DriverClass=cdata.jdbc.mysql.MySQLDriver
JdbcUrl=jdbc:mysql:InitiateOAuth=GETANDREFRESH;
Tables=
```
Place this file where you will reference it when starting the MCP server.7) Run the MCP server locally. The server is started as a standard Java process and reads the .prp configuration file you created.
java -jar /PATH/TO/CDataMCP-jar-with-dependencies.jar /PATH/TO/mysql.prp
```
The server runs on stdio and can be consumed by clients on the same machine.- The MCP server uses stdio, so it can be used with clients running on the same machine. Start the server with the Java command above and pass your .prp file as the final argument.
- When you later update the configuration, you may need to restart the MCP client or fully quit and relaunch your client to detect the server.
The MCP server exposes a small set of tools for interaction. You can retrieve tables, list columns for a table, and run a read-only query against the data source. These tools are named to reflect the underlying data source and actions, and you will use them from your MCP client.
If the MCP server does not appear in your client, ensure you have fully exited and restarted the client after starting the server. Verify the JDBC connection string is correct and that the server’s .prp file points to the proper JDBC URL and driver path. If you encounter issues with your data source connection, verify the license and configuration of the CData JDBC Driver for MySQL.
Retrieves a list of tables available in the MySQL data source; output is CSV with headers.
Retrieves the columns for a specified table; output is CSV with headers.
Executes a SQL SELECT query against the data source and returns results.