Uses environment variables for configuration, allowing database credentials to be securely stored and accessed through a .env file.
Hosts the repository for the MCP server, enabling users to clone and install the server from GitHub.
Provides database interaction capabilities through MySQL, enabling SQL query execution, table management, schema analysis, and business intelligence generation with automatic insights creation.
Used for dependency management and running build scripts for the server implementation.
zaj-MySQL-MCP
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.
Features
Execute SQL queries against a MySQL database
Create and manage database tables
Analyze database schema
Generate and store business insights
Access a continuously updated business insights memo
Tools
Query Tools
read_query: Execute SELECT queries to read data from the database
Input:
query
(string) - The SELECT SQL query to executeReturns: Query results as array of objects
write_query: Execute INSERT, UPDATE, or DELETE queries
Input:
query
(string) - The SQL modification queryReturns:
{ affected_rows: number }
create_table: Create new tables in the database
Input:
query
(string) - CREATE TABLE SQL statementReturns: Confirmation of table creation
Schema Tools
list_tables: Get a list of all tables in the database
No input required
Returns: Array of table names
describe_table: View schema information for a specific table
Input:
table_name
(string) - Name of table to describeReturns: Array of column definitions with names and types
Analysis Tools
append_insight: Add new business insights to the memo resource
Input:
insight
(string) - Business insight discovered from data analysisReturns: Confirmation of insight addition
Triggers update of memo://insights resource
Resources
The server exposes a single resource:
memo://insights: A continuously updated business insights memo that aggregates discovered insights during analysis
Auto-updates as new insights are discovered via the append-insight tool
Implementation Details
This MCP server implements the Model Context Protocol directly, without relying on external SDK dependencies. It uses:
mysql2: For MySQL database connectivity
yargs: For command-line argument parsing
readline: For handling stdin/stdout communication
The server follows the JSON-RPC 2.0 protocol for communication with Claude, handling requests for tool listings, resource listings, and tool execution.
Configuration
The MySQL MCP server uses environment variables for configuration. Create a .env
file in the root directory with the following variables:
A .env.example
file is provided as a template. Copy it to .env
and update the values:
Usage with Claude Desktop
Add the server to your cline_mcp_settings.json
:
Note that database credentials are now configured through the .env
file, not through command line arguments.
Building and Running
Clone the repository:
Create and configure your .env file:
Install dependencies:
Build the server:
Run the server:
Demo and Examples
We've included example materials to help you get started with the MySQL MCP server:
Sample Database: A complete e-commerce database schema with customers, products, orders, and sales data
Example Queries: Pre-written queries demonstrating various capabilities of the MCP server
Usage Scenarios: Examples of how Claude can interact with your MySQL database
To try the demo:
Check out the Demo Guide for step-by-step instructions
Run the Setup SQL Script to create the sample database
Configure the MCP server to connect to the demo database
Start asking Claude questions about your data!
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.
License
This MCP server is licensed under the MIT License.
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
A Model Context Protocol server that enables SQL query execution, database management, and business intelligence capabilities through MySQL connections.
- Features
- Tools
- Resources
- Implementation Details
- Configuration
- Usage with Claude Desktop
- Building and Running
- Demo and Examples
- License
Related Resources
Related MCP Servers
- AsecurityAlicenseAqualityA Model Context Protocol server that enables AI models to interact with MySQL databases, providing tools for querying, executing statements, listing tables, and describing table structures.Last updated -5310MIT License
- AsecurityFlicenseAqualityA Model Context Protocol server that enables AI models to interact with MySQL databases through a standardized interface, providing tools for querying, executing commands, and managing database schemas.Last updated -7
- -securityFlicense-qualityA Model Context Protocol server that enables AI models to interact with MySQL databases through natural language, supporting SQL queries, table creation, and schema exploration.Last updated -3
- AsecurityAlicenseAqualityA Model Context Protocol server that enables executing SQL queries and managing connections with Microsoft SQL Server databases.Last updated -1876MIT License