Skip to main content
Glama
myexperimenthub

local-mysql

README.md
# Local MySQL MCP Server

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

## 1. Install dependencies

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

## 2. Create a restricted MySQL user

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

```sql
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:

```json
{
  "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:

```text
..\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.

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

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 issues