J

mcp-server-mysql

...
Created 12/9/2024bybenborla

Language:

JavaScript

Stars:

37

Forks:

10

MCP Server for MySQL based on NodeJS

smithery badge Demo

A Model Context Protocol server that provides read-only access to MySQL databases. This server enables LLMs to inspect database schemas and execute read-only queries.

Components

Tools

  • mysql_query
    • Execute read-only SQL queries against the connected database
    • Input: sql (string): The SQL query to execute
    • All queries are executed within a READ ONLY transaction

Resources

The server provides schema information for each table in the database:

  • Table Schemas
    • JSON schema information for each table
    • Includes column names and data types
    • Automatically discovered from database metadata

Usage with Claude Desktop

To use this server with the Claude Desktop app, add the following configuration to the "mcpServers" section of your claude_desktop_config.json:

{
  "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": "",
        "MYSQL_DB": "db_name"
      }

    }
  }
}

Replace /db_name with your database name or leave it blank to retrieve all databases.

Troubleshooting

If you encounter an error "Could not connect to MCP server mcp-server-mysql", you may need to explicitly set the path of all required binaries such as the configuration below:

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

            
        
            
                        "PATH": "/path/to/node/bin:/usr/bin:/bin" 
Last updated: 3/1/2025

Publisher info

benborla's avatar

Ian Borla

Full Stack Developer with over 9 years of experience. Now also exploring System Development using Rust

4
followers
7
following
80
repos

More MCP servers built with JavaScript

emergency-medicare-planner-mcp-server

emergency-medicare-planner-mcp-server

By manolaz1
mcp-warpcast-server

MCP Server for Warpcast integration

By zhangzhongnan9281
mcp-tavily-server

Tavily MCP Server for Cline

By dkmaker1