Price Per TokenPrice Per Token

MCP Server MySQL

by benborla

0

About

MCP Server MySQL is a NodeJS-based Model Context Protocol server that enables AI assistants to connect to and interact with MySQL databases. It provides secure database access with built-in support for SSH tunnels to connect to remote databases. Key features: - Execute SQL queries and inspect database schemas directly through Claude Code, Cursor, and other MCP clients - Built-in SSH tunnel support for secure connections to remote MySQL instances - DDL operations including CREATE TABLE support via configurable read/write permissions - Multi-database configuration for managing connections across different projects - Automatic tunnel management with start/stop hooks integrated with Claude Code - Compatibility with MySQL 5.7+ and MySQL 8.0+

README

MCP Server for MySQL - Claude Code Edition

> 🚀 This is a modified version optimized for Claude Code with SSH tunnel support > Original Author: @benborla29 > Original Repository: https://github.com/benborla/mcp-server-mysql > License: MIT

MCP Server for MySQL based on NodeJS

[](https://archestra.ai/mcp-catalog/benborla__mcp-server-mysql)

Key Features of This Fork

  • Claude Code Integration - Optimized for use with Anthropic's Claude Code CLI
  • SSH Tunnel Support - Built-in support for SSH tunnels to remote databases
  • Auto-start/stop Hooks - Automatic tunnel management with Claude start/stop
  • DDL Operations - Added MYSQL_DISABLE_READ_ONLY_TRANSACTIONS for CREATE TABLE support
  • Multi-Project Setup - Easy configuration for multiple projects with different databases
  • Quick Start for Claude Code Users

    1. Read the Setup Guide: See PROJECT_SETUP_GUIDE.md for detailed instructions 2. Configure SSH Tunnels: Set up automatic SSH tunnels for remote databases 3. Use with Claude: Integrated MCP server works seamlessly with Claude Code

    A Model Context Protocol server that provides access to MySQL databases through SSH tunnels. This server enables Claude and other LLMs to inspect database schemas and execute SQL queries securely.

    Table of Contents

  • Requirements
  • Installation
  • - Smithery - Clone to Local Repository - Remote mode
  • Components
  • Configuration
  • Environment Variables
  • Multi-DB Mode
  • Schema-Specific Permissions
  • Testing
  • Troubleshooting
  • Contributing
  • License
  • Requirements

  • Node.js v20 or higher
  • MySQL 5.7 or higher (MySQL 8.0+ recommended)
  • MySQL user with appropriate permissions for the operations you need
  • For write operations: MySQL user with INSERT, UPDATE, and/or DELETE privileges
  • Installation

    Using Smithery

    There are several ways to install and configure the MCP server but the most common would be checking this website https://smithery.ai/server/@benborla29/mcp-server-mysql

    Cursor

    For Cursor IDE, you can install this MCP server with the following command in your project:

    1. Visit https://smithery.ai/server/@benborla29/mcp-server-mysql 2. Follow the instruction for Cursor

    MCP Get provides a centralized registry of MCP servers and simplifies the installation process.

    Codex CLI

    Codex CLI installation is similar to Claude Code below

    codex mcp add mcp_server_mysql \
      --env MYSQL_HOST="127.0.0.1" \
      --env MYSQL_PORT="3306" \
      --env MYSQL_USER="root" \
      --env MYSQL_PASS="your_password" \
      --env MYSQL_DB="your_database" \
      --env ALLOW_INSERT_OPERATION="false" \
      --env ALLOW_UPDATE_OPERATION="false" \
      --env ALLOW_DELETE_OPERATION="false" \
      -- npx -y @benborla29/mcp-server-mysql
    

    Claude Code

    #### Option 1: Import from Claude Desktop (Recommended if already configured)

    If you already have this MCP server configured in Claude Desktop, you can import it automatically:

    claude mcp add-from-claude-desktop
    

    This will show an interactive dialog where you can select your mcp_server_mysql server to import with all existing configuration.

    #### Option 2: Manual Configuration

    Using NPM/PNPM Global Installation:

    First, install the package globally:

    # Using npm
    npm install -g @benborla29/mcp-server-mysql

    Using pnpm

    pnpm add -g @benborla29/mcp-server-mysql

    Then add the server to Claude Code:

    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" \
      -e ALLOW_INSERT_OPERATION="false" \
      -e ALLOW_UPDATE_OPERATION="false" \
      -e ALLOW_DELETE_OPERATION="false" \
      -- npx @benborla29/mcp-server-mysql
    

    Using Local Repository (for development):

    If you're running from a cloned repository:

    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" \
      -e ALLOW_INSERT_OPERATION="false" \
      -e ALLOW_UPDATE_OPERATION="false" \
      -e ALLOW_DELETE_OPERATION="false" \
      -e PATH="/path/to/node/bin:/usr/bin:/bin" \
      -e NODE_PATH="/path/to/node/lib/node_modules" \
      -- /path/to/node /full/path/to/mcp-server-mysql/dist/index.js
    

    Replace:

  • /path/to/node with your Node.js binary path (find
  • Related MCP Servers

    AI Research Assistant

    AI Research Assistant

    hamid-vakilzadeh

    AI Research Assistant provides comprehensive access to millions of academic papers through the Semantic Scholar and arXiv databases. This MCP server enables AI coding assistants to perform intelligent literature searches, citation network analysis, and paper content extraction without requiring an API key. Key features include: - Advanced paper search with multi-filter support by year ranges, citation thresholds, field of study, and publication type - Title matching with confidence scoring for finding specific papers - Batch operations supporting up to 500 papers per request - Citation analysis and network exploration for understanding research relationships - Full-text PDF extraction from arXiv and Wiley open-access content (Wiley TDM token required for institutional access) - Rate limits of 100 requests per 5 minutes with options to request higher limits through Semantic Scholar

    Web & Search
    12 8
    Linkup

    Linkup

    LinkupPlatform

    Linkup is a real-time web search and content extraction service that enables AI assistants to search the web and retrieve information from trusted sources. It provides source-backed answers with citations, making it ideal for fact-checking, news gathering, and research tasks. Key features of Linkup: - Real-time web search using natural language queries to find current information, news, and data - Page fetching to extract and read content from any webpage URL - Search depth modes: Standard for direct-answer queries and Deep for complex research across multiple sources - Source-backed results with citations and context from relevant, trustworthy websites - JavaScript rendering support for accessing dynamic content on JavaScript-heavy pages

    Web & Search
    2 24

    context7

    huynguyen03dev

    5