mcpField
M
MCP Server for MySQL based on NodeJS

MCP Server for MySQL based on NodeJS

Local
github.com/benborlaDatabases2.2kUpdated 13w ago

About MCP Server for MySQL based on NodeJS

MCP Server for MySQL is a Node.js MCP server that gives Claude and other LLMs read-only access to MySQL databases for inspecting schemas and running queries. Write operations are disabled by default and must be enabled through environment flags.

Key features

  1. 01Read-only access by default
  2. 02Write operations opt-in per statement type
  3. 03SSH tunnel support for remote databases
  4. 04Multi-database mode without reconnecting
  5. 05Per-database read and write permissions
  6. 06Automatic PII redaction in query results

Use cases

  1. 01Letting an LLM query business data in read-only mode
  2. 02Inspecting table structures from Claude Code
  3. 03Reaching a remote MySQL instance through an SSH tunnel

MCP support

This is an MCP server that exposes the mysql_query tool and the mysql://tables resource to MCP clients for running SQL and listing table metadata.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"mysql": {
"command": "npx",
"args": [
"-y",
"@benborla29/mcp-server-mysql"
],
"env": {
"MYSQL_HOST": "<MYSQL_HOST>",
"MYSQL_PORT": "<MYSQL_PORT>",
"MYSQL_USER": "<MYSQL_USER>",
"MYSQL_PASS": "<MYSQL_PASS>",
"MYSQL_DB": "<MYSQL_DB>",
"ALLOW_INSERT_OPERATION": "<ALLOW_INSERT_OPERATION>",
"ALLOW_UPDATE_OPERATION": "<ALLOW_UPDATE_OPERATION>",
"ALLOW_DELETE_OPERATION": "<ALLOW_DELETE_OPERATION>"
}
}
}
}
Run commandnpx -y @benborla29/mcp-server-mysql
Environment variables to set
MYSQL_HOST
MYSQL_PORT
MYSQL_USER
MYSQL_PASS
MYSQL_DB
ALLOW_INSERT_OPERATION
ALLOW_UPDATE_OPERATION
ALLOW_DELETE_OPERATION

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@benborla29/mcp-server-mysql

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

MCP Server for MySQL

MCP Toplist

Trust Score

Sponsor — Bloome

Bloome

Using mcp-server-mysql to let your AI query MySQL? Bloome brings that to your whole team — an AI-agent IM platform where AI agents are members of the chat. Connect your MCP tools and have agents inspect schemas, run queries, and answer data questions for everyone in one thread. Zero local setup, runs in the cloud, on web and mobile.


MCP server that gives Claude and other LLMs access to MySQL — inspect schemas, run queries, and optionally write data, all through the Model Context Protocol.

Key Features

  • Read-only by default — write operations opt-in via env flags
  • Claude Code integration — optimized for Anthropic's Claude Code CLI
  • SSH tunnel support — built-in support for remote databases
  • Multi-DB mode — query across multiple databases without reconnecting
  • Schema-specific permissions — per-database read/write control
  • PII redaction — automatic masking of sensitive data in results
  • Remote mode — HTTP transport with bearer token auth
  • SSL/TLS support — encrypted connections with mTLS option

Requirements

  • Node.js v20+
  • MySQL 5.7+ (8.0+ recommended)
  • MySQL user with appropriate privileges

Quick Install

Claude Code (simplest):

claude mcp add mcp_server_mysql \
  -e MYSQL_HOST="127.0.0.1" \
  -e MYSQL_PORT="3306" \
  -e MYSQL_USER="root" \
  -e MYSQL_PASS="your_password" \
  -e MYSQL_DB="your_database" \
  -- npx @benborla29/mcp-server-mysql

Claude Desktop / other clients:

{
  "mcpServers": {
    "mcp_server_mysql": {
      "command": "npx",
      "args": ["-y", "@benborla29/mcp-server-mysql"],
      "env": {
        "MYSQL_HOST": "127.0.0.1",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "root",
        "MYSQL_PASS": "your_password",
        "MYSQL_DB": "your_database"
      }
    }
  }
}

All write operations are disabled by default. Enable with ALLOW_INSERT_OPERATION=true, ALLOW_UPDATE_OPERATION=true, ALLOW_DELETE_OPERATION=true.

Documentation

Tools & Resources

Tool: mysql_query Execute SQL queries. Read-only by default. Write operations enabled per flag.

Resources: mysql://tables Lists all tables and column metadata for the connected database.

Contributing

PRs welcome at github.com/benborla/mcp-server-mysql.

git clone https://github.com/benborla/mcp-server-mysql.git
pnpm install
pnpm run build
pnpm test

Contributors

License

MIT — see LICENSE for details.

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.