mysql -by-cdata
This read-only MCP Server allows you to connect to MySQL data from Claude Desktop through CData JDBC Drivers. For full CRUD support, check out the first managed MCP platform: CData Connect AI (https://www.cdata.com/ai/).
claude mcp add --transport stdio cdatasoftware-mysql-mcp-server-by-cdata java -jar CDataMCP-jar-with-dependencies.jar /PATH/TO/mysql.prp \ --env CLASSPATH="Optional if needed" \ --env JAVA_HOME="Path to your Java installation"
How to use
This MCP server exposes a read-only interface to your MySQL data through the CData MCP server built on top of the CData JDBC Driver for MySQL. Once running, clients such as Claude Desktop can query live data by invoking the built-in MCP tools rather than writing SQL directly. The server presents a set of tools for discovering the data schema and executing read-only queries: mysql_get_tables to list available tables, mysql_get_columns to inspect table columns, and mysql_run_query to execute SELECT queries against your MySQL data. The server runs locally (stdio-based), so you typically start it on the same machine as your client and point your MCP client configuration to the generated JAR and your .prp file.
To use with Claude Desktop, add an entry in claude_desktop_config.json under mcpServers for your server, providing the path to Java and the jar, followed by the path to your mysql.prp connection descriptor. For example, on Windows the command might look like: "PATH\TO\java.exe" with arguments ["-jar", "PATH\TO\CDataMCP-jar-with-dependencies.jar", "PATH\TO\mysql.prp"]. On Linux/macOS, the paths would be similar but use /PATH/TO style. After saving the config, restart Claude Desktop or refresh the config so the MCP server is discovered. Once connected, you can simply ask the AI client questions like: What are the top customers by revenue, or show tables and columns available in the data source. The tools automatically return results in CSV format for tables and columns, and the run_query tool returns the SQL results you request without exposing write capabilities in this read-only setup.
How to install
Prerequisites:
- Java runtime environment (JRE/JDK) installed and accessible on the machine running the MCP server.
- Maven (for building the MCP server from source).
- Access to the CData JDBC Driver for MySQL (installation and licensing steps performed separately).
Installation steps:
-
Clone the repository: git clone https://github.com/cdatasoftware/mysql-mcp-server-by-cdata.git cd mysql-mcp-server-by-cdata
-
Build the server: mvn clean install This creates the JAR file named CDataMCP-jar-with-dependencies.jar in the target directory.
-
Install and license the CData JDBC Driver for MySQL (performed outside this repository):
- Download the JDBC driver from the CData website.
- Install the driver following the vendor instructions.
- License the driver by running the command from the driver's lib directory, e.g. java -jar cdata.jdbc.mysql.jar --license and entering your details.
-
Create a .prp configuration file for your JDBC connection (example content): 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= Save this as mysql.prp and place it at a known path.
-
Run the MCP server: java -jar /PATH/TO/CDataMCP-jar-with-dependencies.jar /PATH/TO/mysql.prp Note: The server uses stdio and is intended for local clients on the same machine.
Additional notes
Tips and common issues:
- The MCP server is read-only in this configuration. Write/update/delete capabilities are not enabled in this setup.
- The server communicates over stdio, so use clients running on the same host.
- Ensure the JDBC driver is licensed and the connection string (within mysql.prp) is correctly configured for your MySQL data source.
- If Claude Desktop (or another MCP client) does not detect the server, fully quit and restart the client so the new MCP server appears in the config. Check that the paths in your config are correct and accessible.
- When testing connections, verify your Oracle/driver class and JDBC URL syntax in the prp file match the driver documentation and your MySQL instance settings.