A Model Context Protocol (MCP) server implementation that provides database interaction and business intelligence capabilities through MySQL. This server enables running SQL queries, analyzing business data, and automatically generating business insight memos.
read_query: Execute SELECT queries to read data from the database
query
(string) - The SELECT SQL query to executewrite_query: Execute INSERT, UPDATE, or DELETE queries
query
(string) - The SQL modification query{ affected_rows: number }
create_table: Create new tables in the database
query
(string) - CREATE TABLE SQL statementlist_tables: Get a list of all tables in the database
describe_table: View schema information for a specific table
table_name
(string) - Name of table to describeinsight
(string) - Business insight discovered from data analysisThe server exposes a single resource:
This MCP server implements the Model Context Protocol directly, without relying on external SDK dependencies. It uses:
The server follows the JSON-RPC 2.0 protocol for communication with Claude, handling requests for tool listings, resource listings, and tool execution.
The MySQL MCP server uses environment variables for configuration. Create a .env
file in the root directory with the following variables:
## Database Connection
DB_CONNECTION=mysql
## Database Host
DB_HOST=localhost
## Database Port
DB_PORT=3306
## Database Username (required)
DB_USER=your_mysql_username
## Database Password (required)
DB_PASSWORD=your_mysql_password
## Database Name (required)
DB_NAME=your_database_name
A .env.example
file is provided as a template. Copy it to .env
and update the values:
cp .env.example .env
## Then edit .env with your database credentials
Add the server to your cline_mcp_settings.json
:
"mcpServers": {
"mysql": {
"command": "node",
"args": [
"/path/to/zaj_MySQL_MCP/build/index.js"
],
"disabled": false,
"autoApprove": []
}
}
Note that database credentials are now configured through the .env
file, not through command line arguments.
git clone https://github.com/zajTools/zaj-MySQL-MCP.git
cd zaj-MySQL-MCP
cp .env.example .env
## Edit .env with your database credentials
npm install
npm run build
node build/index.js
We’ve included example materials to help you get started with the MySQL MCP server:
To try the demo:
These examples are designed to show the potential of using Claude with MySQL databases, but the MCP server works with any MySQL database you have access to.
This MCP server is licensed under the MIT License.