cdata-mysql-data-adapter-mcp
Facilitates natural language querying and metadata retrieval for MySQL databases via a standardized Model Context Protocol (MCP) interface. This component is engineered specifically for seamless integration with Large Language Models (LLMs) accessing live relational data.
Author

CDataSoftware
Quick Info
Actions
Tags
CData MySQL Connector for Model Context Protocol (MCP)
This repository details the implementation of a read-only MCP server designed to bridge Large Language Models with underlying MySQL data stores, utilizing the robust CData JDBC Driver for MySQL.
:warning: Important Note on Capabilities: This distribution provides read-only access. For comprehensive data manipulation capabilities (Read, Write, Update, Delete, plus custom actions) alongside a streamlined setup process, please explore the complimentary CData MCP Server for MySQL (Beta release).
Core Functionality
This read-only MCP Server leverages the power of the CData JDBC Driver for MySQL to expose MySQL schemas as structured SQL models. By wrapping this driver, the server translates high-level, natural language inquiries from LLMs (such as Claude Desktop) directly into data retrieval operations against the live database, eliminating the need for the LLM to generate raw SQL.
Deployment and Configuration
Follow these sequential steps to deploy and configure the MySQL MCP Server:
-
Source Code Acquisition: bash git clone https://github.com/cdatasoftware/mysql-mcp-server-by-cdata.git cd mysql-mcp-server-by-cdata
-
Artifact Compilation: Execute the Maven build process to package the application: bash mvn clean install
The resulting executable JAR is named CDataMCP-jar-with-dependencies.jar.
3. JDBC Driver Acquisition:
Download and install the necessary CData JDBC Driver for MySQL from: https://www.cdata.com/drivers/mysql/download/jdbc
4. Driver Licensing:
* Navigate to the installed driver's library directory (e.g., C:\Program Files\CData\CData JDBC Driver for MySQL\ on Windows or /Applications/CData JDBC Driver for MySQL/ on macOS/Linux).
* Run the licensing utility:
bash
java -jar cdata.jdbc.mysql.jar --license
* Input your required personal details and use "TRIAL" or your procured license key.
-
Data Source Connection Specification:
-
Launch the Connection String configuration utility: bash java -jar cdata.jdbc.mysql.jar
-
Use the utility to establish and validate connectivity to your target MySQL instance (OAuth authentication may require browser interaction).
- Once validated, capture the generated JDBC connection string.
- Configuration File Creation (
.prp): Generate a properties file (e.g.,mysql.prp) defining the adapter settings: - Prefix: A namespace tag for the exposed tools.
- ServerName: A human-readable identifier for the service.
- ServerVersion: Version tracking for the adapter instance.
- DriverPath: Absolute path to the installed JDBC driver JAR file.
- DriverClass: Fully qualified name of the MySQL JDBC driver class (e.g.,
cdata.jdbc.mysql.MySQLDriver). - JdbcUrl: The connection string copied in the previous step.
- Tables: (Optional) A comma-separated list of specific tables to expose; leave empty (
Tables=) for full schema access. env 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=
-
Integrating with LLM Clients (e.g., Claude Desktop)
To enable the LLM client to discover and utilize this server, configure its settings file (claude_desktop_config.json):
-
Configuration File Assembly: Add an entry under
mcpServers, substituting placeholders with actual paths.Windows Client Setup:
{ "mcpServers": { "{classname_dash}": { "command": "PATH\TO\java.exe", "args": [ "-jar", "PATH\TO\CDataMCP-jar-with-dependencies.jar", "PATH\TO\mysql.prp" ] }, ... } }
Linux/Mac Client Setup:
{ "mcpServers": { "{classname_dash}": { "command": "/PATH/TO/java", "args": [ "-jar", "/PATH/TO/CDataMCP-jar-with-dependencies.jar", "/PATH/TO/mysql.prp" ] }, ... } }
-
Configuration Deployment: Ensure the modified config file is placed in the client's designated configuration location (e.g., Windows:
%APPDATA%\Claude\claude_desktop_config.json). - Client Reload: Restart or refresh the LLM client application to load the new MCP server definition.
Standalone Execution
The server can be launched independently for direct interaction, communicating via standard input/output (stdio):
bash java -jar /PATH/TO/CDataMCP-jar-with-dependencies.jar /PATH/TO/mysql.prp
Note: Standalone mode requires the client application (which invokes the server) to run on the same host machine.
Tool Interface Specification
Once connected, the LLM gains access to operational tools. Users typically interact via natural language prompts, allowing the client to dispatch the necessary tool calls.
Tool definitions are referenced using {servername}, which corresponds to the configuration prefix (e.g., mysql).
{servername}_get_tables: Fetches a catalog of all accessible tables within the MySQL schema. Output is formatted as CSV, including a header row.{servername}_get_columns: Retrieves detailed column schema information for a specified table. Requires thetableargument. Output is CSV with header.{servername}_run_query: Executes arbitrary SQL SELECT statements against the database. Requires thesqlargument containing the query string.
JSON-RPC Invocation Examples (Following JSON-RPC 2.0)
Retrieving Table List (mysql_get_tables)
{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "mysql_get_tables", "arguments": {} } }
Inspecting Table Structure (mysql_get_columns)
{ "jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": { "name": "mysql_get_columns", "arguments": { "table": "Account" } } }
Executing a SELECT Statement (mysql_run_query)
{ "jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": { "name": "mysql_run_query", "arguments": { "sql": "SELECT * FROM [Account] WHERE [IsDeleted] = true" } } }
Support and Licensing
This software is distributed under the permissive MIT License. Full licensing terms are available in the repository's LICENSE file.
For technical difficulties, consult CData Support. Community feedback and general MCP server discussions are welcome on the CData Community Forum.
Supported Data Sources (Driver Capability)
This framework inherits connectivity from the CData JDBC ecosystem, supporting a vast array of external systems, including (but not limited to):
| Category | Examples | Category | Examples | |
|---|---|---|---|---|
| CRM/ERP | Salesforce, Dynamics 365, SAP, NetSuite | Cloud Storage | Amazon S3, Google Cloud Storage, Azure Data Lake | |
| Databases | PostgreSQL, SQL Server, Oracle, MongoDB, Cassandra | Analytics | BigQuery, Snowflake, Redshift, Databricks | |
| SaaS/Web | Google Sheets, Jira, ServiceNow, HubSpot, MailChimp | File Formats | JSON, XML, CSV, Parquet |
(A comprehensive list of all connectors supported by the underlying driver technology is extensive, encompassing dozens more sources than listed here.)
