Skip to main content
Glama

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 install

Related 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_SCRIPT

Absolute path to the mysql-mcp directory

HOST

MySQL host (e.g. localhost)

DB_PORT

MySQL port (default 3306)

USER

MySQL username

PASSWORD

MySQL password

DBNAME

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" }

A
license - permissive license
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    -
    quality
    D
    maintenance
    A lightweight MCP server providing safe, read-only access to MySQL databases. It enables users to query multiple MySQL instances securely while preventing write operations.
    Last updated
    1,130
    MIT
  • A
    license
    -
    quality
    D
    maintenance
    A 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.
    Last updated
    MIT

View all related MCP servers

Related MCP Connectors

  • Read-only MCP server for ClassQuill, a tutoring-business-management platform.

  • Read-only MCP server for wafergraph.com's semiconductor & AI supply-chain data: 30 tools, no auth.

  • An MCP server for deep research or task groups

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/charlesaugust44/mysql-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server