home / mcp / mariadb mcp server

MariaDB MCP Server

Provides a read-only MCP server that lets you query live MariaDB data via the CData JDBC Driver.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "cdatasoftware-mariadb-mcp-server-by-cdata": {
      "command": "java",
      "args": [
        "-jar",
        "/PATH/TO/CDataMCP-jar-with-dependencies.jar",
        "/PATH/TO/mariadb.prp"
      ]
    }
  }
}

You run a local, read-only MCP server that exposes live MariaDB data through a simple MCP interface. This lets your AI client query MariaDB data in natural language without writing SQL, while keeping the data access controlled and read-only.

How to use

Connect your MCP client to the local server using the standard MCP workflow. Once the server is running, you can ask questions like “What is the open ticket count by priority?” or “Show me opportunities by stage and expected revenue.” The built-in tools expose the tables, columns, and a SELECT capability to retrieve data as needed. You do not need to craft SQL queries yourself; simply request the information and the MCP server translates your request into the appropriate data retrieval.

How to install

Prerequisites you need before you start are Java and a Java runtime environment, plus the ability to run commands in your terminal or command prompt.

Step by step, follow these commands to set up the MCP server locally.

# 1. Prepare build and source
# Ensure you have Java installed and accessible in your PATH
# Build the MCP server project (requires Maven)

mvn clean install

# This produces the server JAR: CDataMCP-jar-with-dependencies.jar

# 2. Prepare the JDBC driver
# Download and install the CData JDBC Driver for MariaDB from the official site

# 3. License the JDBC driver
# Locate the lib folder of the JDBC driver installation and run the license command
# Example (adjust path to your installation):
java -jar cdata.jdbc.mariadb.jar --license

# 4. Create a connection configuration file
# Run the connection string utility to build and test your connection, then copy the JDBC URL
java -jar cdata.jdbc.mariadb.jar

# 5. Create a .prp file for your JDBC connection
# Example content for mariadb.prp (adjust values for your environment)
env
Prefix=mariadb
ServerName=CDataMariaDB
ServerVersion=1.0
DriverPath=PATH\TO\cdata.jdbc.mariadb.jar
DriverClass=cdata.jdbc.mariadb.MariaDBDriver
JdbcUrl=jdbc:mariadb:InitiateOAuth=GETANDREFRESH;
Tables=

Running the server

To run the MCP server locally, execute the Java command with the prepared .prp file. This starts the MCP server in stdio mode, which is intended for clients running on the same machine.

java -jar /PATH/TO/CDataMCP-jar-with-dependencies.jar /PATH/TO/mariadb.prp
```

> Note: The server runs in stdio mode and is designed for local use with the client on the same machine.

Configuration and usage notes

You interact with the server through the client’s built-in tools. The server exposes the following capabilities: retrieving available tables, listing columns for a table, and running a query to fetch data. These tools are invoked behind the scenes when you ask natural language questions, so you typically do not need to call them directly.

Troubleshooting and tips

If you cannot see the MCP server in your client, ensure you have fully closed and reopened the client after starting the server. If data retrieval fails, verify that your JDBC connection string and prp file are correct and that the MariaDB data source is reachable. If issues persist, re-check the connection configuration steps and ensure the JDBC driver license is properly applied.

Tools & usage details

The server provides tools to discover data structure and to query data: retrieving tables, listing columns, and running queries. You can use these tools implicitly through natural language prompts, or invoke them directly if your client exposes tool endpoints.

Available tools

mariadb_get_tables

Retrieves a list of tables available in the data source. The output is returned in CSV format with column headers on the first line.

mariadb_get_columns

Retrieves a list of columns for a specified table. The output is CSV with column headers on the first line.

mariadb_run_query

Executes a SQL SELECT query against the data source and returns the results.