Skip to main content
Glama
local-mysql

local-mysql

Local MySQL MCP Server

This is a small read-only MCP server for a MySQL database running on your machine.

1. Install dependencies

cd C:\Users\ADMIN\Documents\1st\mysql-mcp
npm.cmd install

Related MCP server: MySQL MCP Server

2. Create a restricted MySQL user

Run this in MySQL, replacing the database name and password:

CREATE USER 'mcp_reader'@'localhost' IDENTIFIED BY 'strong_password_here';
GRANT SELECT, SHOW VIEW ON your_database.* TO 'mcp_reader'@'localhost';
FLUSH PRIVILEGES;

Avoid using root for MCP access.

3. Configure your MCP client

Use this server command in your MCP client configuration:

{
  "mcpServers": {
    "local-mysql": {
      "command": "node",
      "args": [
        "C:\\Users\\ADMIN\\Documents\\1st\\mysql-mcp\\src\\index.js"
      ],
      "env": {
        "MYSQL_HOST": "127.0.0.1",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "mcp_reader",
        "MYSQL_PASSWORD": "strong_password_here",
        "MYSQL_DATABASE": "your_database",
        "MYSQL_MAX_ROWS": "200"
      }
    }
  }
}

Tools

  • query: runs one read-only SQL statement.

  • list_databases: lists databases visible to the MySQL user.

  • list_tables: lists tables in the configured database or a named database.

  • describe_table: shows column metadata for a table.

Current database snapshot

The configured product_db database currently includes these tables:

  • categories

  • customers

  • orders

  • products

  • suppliers

Customer chart

A customer order-count pie chart is available at:

..\customers_pie_chart.svg

The chart shows 5 customers with 1 order each, so every customer represents 20% of the total order count.

Safety

The server rejects non-read-only statements and should still be paired with a restricted MySQL user. Database permissions are the final safety boundary.

Smoke test

This verifies that the MCP server starts and exposes tools. It does not query MySQL.

cd C:\Users\ADMIN\Documents\1st\mysql-mcp
npm.cmd run smoke

Available Tools

4 tools
describe_tableDescribe tableC

Show column metadata for a table.

Inputs: table (required), database.

list_databasesList databasesA

List databases visible to the configured MySQL user.

Inputs: no named parameters.

list_tablesList tablesA

List tables in the configured database or in the database argument.

Inputs: database.

queryRun read-only SQLB

Run a single read-only MySQL query. SELECT, SHOW, DESCRIBE, DESC, EXPLAIN, and WITH are allowed.

Inputs: sql (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: describe_table for column metadata, list_databases for databases, list_tables for tables, and query for arbitrary read-only SQL. No overlap.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern: describe_table, list_databases, list_tables, query. The pattern is uniform and predictable.

    Tool Count5/5

    With 4 tools, the set is well-scoped for a read-only MySQL server. It covers the essential operations without unnecessary extras.

    Completeness4/5

    The tools cover listing databases and tables, describing table structure, and running arbitrary read queries. Minor omissions like SHOW VARIABLES could be added but are accessible via query.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Provides secure, read-only access to MariaDB/MySQL databases, allowing users to list databases, explore table schemas, and execute SQL queries with built-in security measures.
      4
      62 npm
      4
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables safe interaction with MySQL databases through SELECT queries, table structure inspection, and database schema exploration. Provides read-only access to query data and examine database metadata.
      1
      -
    • A
      license
      A
      quality
      D
      maintenance
      Enables read-only MySQL database connectivity, allowing execution of SELECT queries, listing tables, and describing table structures via natural language.
      3
      10 npm
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables read-only MySQL database access, allowing listing databases, tables, describing schemas, and executing SELECT/SHOW/DESCRIBE/EXPLAIN queries.
      7
      45 npm
      4
      MIT