- Home
- MCP servers
- MySQL
MySQL
- javascript
0
GitHub Stars
javascript
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"mcp-mirror-benborla_mcp-server-mysql": {
"command": "npx",
"args": [
"-y",
"@benborla29/mcp-server-mysql"
],
"env": {
"MYSQL_DB": "db_name",
"MYSQL_HOST": "127.0.0.1",
"MYSQL_PORT": "3306",
"MYSQL_USER": "root"
}
}
}
}This MCP server provides read-only access to MySQL databases, enabling large language models to inspect database schemas and execute safe read-only queries. It exposes table schemas and supports structured, read-only data exploration without altering data.
How to use
Connect to the MCP server from your MCP client to let your AI agents inspect database schemas and run read-only queries. You will configure the client to talk to the server, providing the database connection details via environment variables. Use the server to retrieve table schemas, view column data types, and execute mysql_query operations within a READ ONLY transaction to safely explore data.
How to install
Prerequisites you need before starting:
- Node.js and npm installed on your machine
- Access to a MySQL database you want to query
- Basic familiarity with environment variable configuration for local services
Start the MCP server locally using the provided runtime command and environment configuration. The server is typically run with an MCP-compatible runner such as npx, which executes the package and exposes the required endpoints for your MCP client.
Run the following command to start the server and connect to your MySQL instance. Replace the environment values with your actual database details.
npx -y @benborla29/mcp-server-mysql
# Example environment (adjust to your setup)
export MYSQL_HOST=127.0.0.1
export MYSQL_PORT=3306
export MYSQL_USER=root
export MYSQL_PASS=
export MYSQL_DB=db_name
Allow the server to initialize and confirm it connects to the MySQL instance. The server will expose read-only endpoints for schema discovery and safe read-only queries.
## Additional content
Configuration tips and troubleshooting are available to ensure reliable operation. If you use Claude Desktop or another MCP client, you can provide the following configuration to connect the client to this MCP server.
{ "mcpServers": { "mcp_server_myqsl": { "command": "npx", "args": [ "-y", "@benborla29/mcp-server-mysql", ], "env": { "MYSQL_HOST": "127.0.0.1", "MYSQL_PORT": "3306", "MYSQL_USER": "root", "MYSQL_PASS": "", "MYSQL_DB": "db_name" } } } }
## Notes on configuration, security, and troubleshooting
- The server runs in read-only mode for all queries, ensuring that no data modification occurs during explorations by the AI.
- Provide precise MySQL connection details via environment variables to enable schema discovery and safe querying.
- If you encounter connectivity issues, verify that the host, port, user credentials, and database name are correct and that the MySQL server accepts connections from the MCP host.
## Available tools
### mysql\_query
Execute read-only SQL queries against the connected database. Each query runs within a READ ONLY transaction to ensure data integrity while exploring the schema and data.