mysql-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mysql-mcplist all tables in the database"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MySQL MCP Server
A read-only MySQL MCP server for OpenCode. Exposes a single safe_query tool that executes SELECT and SHOW queries while blocking all write operations.
Install
git clone <this-repo>
cd mysql-mcp
npm installRelated MCP server: mysql-readonly-mcp
Configuration
Add the following to your opencode.json (or opencode.jsonc):
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"local-safe-mysql": {
"type": "local",
"enabled": true,
"command": [
"node",
"/ABSOLUTE_PATH_TO_SCRIPT/mysql-mcp/server.js"
],
"environment": {
"DB_HOST": "HOST",
"DB_PORT": "3306",
"DB_USER": "USER",
"DB_PASSWORD": "PASSWORD",
"DB_NAME": "DBNAME"
}
}
}
}Replace the placeholder values:
Variable | Description |
| Absolute path to the |
| MySQL host (e.g. |
| MySQL port (default |
| MySQL username |
| MySQL password |
| Database name |
Tool
safe_query
Run a read-only SQL query. Write operations (INSERT, UPDATE, DELETE, DROP, ALTER, CREATE, REPLACE, TRUNCATE, GRANT, REVOKE, CALL, LOAD, HANDLER, RENAME) are blocked.
Input: { "sql": "SELECT * FROM users LIMIT 10" }
This server cannot be deployed
Maintenance
Related MCP Connectors
Read-only MCP server for ClassQuill, a tutoring-business-management platform.
Read-only MCP server for The Quiet Protocol's engines, benchmarks, proof, and business data.
An MCP server that provides read access to your cloud storage providers, bank accounts and more.
Read-only MCP server for interior design studios: projects, overviews, weekly activity. No writes.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA lightweight MCP server providing safe, read-only access to MySQL databases. It enables users to query multiple MySQL instances securely while preventing write operations.630 npmMIT
- AlicenseNot gradedqualityDmaintenanceRead-only MySQL MCP server for safe schema inspection and SELECT-style queries.4 npmMIT
- AlicenseAqualityCmaintenanceRead-only MySQL/MariaDB MCP server for running SELECT queries safely, with automatic read-only enforcement and query limits.33 npmMIT
- AlicenseNot gradedqualityDmaintenanceA readonly MCP server for MySQL databases that ensures safety by whitelisting only SELECT, SHOW, DESCRIBE, and EXPLAIN statements, with table blacklist support and configurable limits.MIT