mcpField
M
MCP MySQL Server

MCP MySQL Server

Local
github.com/CarlosfpcDatabases1Updated 79w ago

About MCP MySQL Server

MCP MySQL Server connects to MySQL through an SSH tunnel, for users who need MCP access to a remote database. Its README notes that SELECT operations are enabled by default and permissions can be configured.

Key features

  1. 01MySQL connection through SSH tunnel
  2. 02Environment-based connection configuration
  3. 03Configurable operation permissions
  4. 04SELECT enabled by default

Use cases

  1. 01Querying a remote MySQL database from Cursor
  2. 02Restricting database access to SELECT operations

MCP support

Exposes a MySQL connection to MCP clients. The server starts with `npm run start-mcp` and uses an SSH tunnel for remote databases.

Configuration

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

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

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 MySQL Server

Servidor MCP para conexión MySQL con túnel SSH.

Requisitos Previos

  • Node.js (versión 14 o superior)
  • Acceso SSH al servidor remoto
  • Cliente MySQL
  • Cursor IDE

Instalación

  1. Clona este repositorio:
git clone [URL_DEL_REPOSITORIO]
cd [NOMBRE_DEL_DIRECTORIO]
  1. Crea el archivo de configuración:
cp mcp-config.env.example mcp-config.env
  1. Configura las variables en mcp-config.env:
Variables de Configuración MySQL
# Configuración de conexión MySQL
MYSQL_HOST=127.0.0.1     # Host de MySQL (por defecto localhost)
MYSQL_PORT=3306          # Puerto de MySQL (por defecto 3306)
MYSQL_USER=              # Tu usuario de MySQL
MYSQL_PASS=              # Tu contraseña de MySQL
MYSQL_DB=                # Nombre de la base de datos

# Permisos de operaciones
ALLOW_INSERT_OPERATION=false    # Permitir operaciones INSERT
ALLOW_UPDATE_OPERATION=false    # Permitir operaciones UPDATE
ALLOW_DELETE_OPERATION=false    # Permitir operaciones DELETE
ALLOW_SELECT_OPERATION=true     # Permitir operaciones SELECT (consultas)

# Configuración SSH para túnel
SSH_HOST=                # Hostname del servidor SSH
SSH_USER=                # Usuario SSH
SSH_PORT_MAPPING=3306:127.0.0.1:3306  # Mapeo de puertos para el túnel SSH
  1. Instala las dependencias:
npm install

Configuración en Cursor IDE

  1. Localiza o crea el archivo mcp.json en la ruta C:\Users\[TU_USUARIO]\.cursor\mcp.json
  2. Añade la siguiente configuración (ajusta la ruta a la ubicación donde clonaste el repositorio):
{
  "mcpServers": {
    "MySQL": {
      "transportType": "stdio",
      "command": "npm",
      "args": ["--silent", "--prefix", "RUTA_A_TU_PROYECTO", "run", "start-mcp"]
    }
  }
}

Por ejemplo, si clonaste el proyecto en C:\proyectos\mcp-mysql, la configuración sería:

{
  "mcpServers": {
    "MySQL": {
      "transportType": "stdio",
      "command": "npm",
      "args": ["--silent", "--prefix", "C:\\proyectos\\mcp-mysql", "run", "start-mcp"]
    }
  }
}

Uso

Para iniciar el servidor:

npm run start-mcp

Estructura del Proyecto

  • start-mcp.js: Script principal que inicia el túnel SSH y el servidor MCP
  • mcp-config.env: Archivo de configuración (no incluido en el repositorio)
  • package.json: Definición de dependencias y scripts

Notas Importantes

  • No modifiques las versiones de las dependencias en package.json para mantener la compatibilidad
  • Asegúrate de tener acceso SSH configurado correctamente
  • No compartas tu archivo mcp-config.env
  • Por defecto, solo las operaciones SELECT están habilitadas. Modifica los permisos según tus necesidades
  • El túnel SSH es necesario para conexiones a bases de datos remotas. Si estás usando una base de datos local, puedes dejar la configuración SSH vacía

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.