JoyfulSQL_MCP

JoyfulSQL_MCP

3.4

A Model Context Protocol (MCP) server that allows AI assistants like Cascade to interact with both local and remote MySQL databases.

The MySQL MCP Server is designed to facilitate seamless interaction between AI assistants and MySQL databases, both local and remote. It supports secure connections through SSH tunneling, allowing for both read-only and read-write operations. The server can automatically detect and list available databases, providing an interactive workflow that prompts users to select a database before executing queries. This ensures that queries are executed with the correct context, enhancing both security and usability. The server is particularly useful for development environments where secure and efficient database access is required.

Features

  • Connect to local MySQL databases
  • Connect to remote MySQL databases via SSH tunneling (ODI)
  • Execute read-only or read-write queries (configurable)
  • Secure access through SSH tunneling for remote databases
  • Automatic database detection and listing when no database is specified

MCP Tools

  • {'local_mysql_query': 'Execute queries on your local MySQL database'}
  • {'odi_mysql_query': 'Execute queries on remote MySQL databases via SSH tunnel'}

Usage with Different Platforms

Using with Cascade


{
  "mcpServers": {
       "mysql": {
          "command": "node",
          "args": [
            "/path/to/your/server/build/index.js",
            "--env-file",
            "/path/to/your/env"
          ]
      },
  }
}

Running Locally

bash
node build/index.js

ENV


LOCAL_HOST=[host]
LOCAL_USER=[user]
LOCAL_PASSWORD=[password]
LOCAL_PORT=[port]

ODI_SSH_KEY=[path/to/ssh/key]
ODI_USER=[user]
ODI_PASSWORD=[password]
ODI_HOST=[host]
ODI_PORT=[port]
ODI_SSH_PORT=[ssh_tunnel_port]

WRITE_ACCESS=[bool]