MySQL MCP Server

MySQL MCP Server

Provides structured MySQL database operations for Claude Desktop, converting natural language requests into safe, parameterized queries.

Category
Visit Server

README

MySQL MCP Server

A Model Context Protocol (MCP) server that provides structured MySQL database operations for Claude Desktop. Converts natural language database requests into safe, parameterized queries.

Features

  • 7 tools: list_tables, describe_table, fetch, update, delete, truncate, modify_bulk
  • Safety first: No raw SQL, parameterized queries, identifier sanitization
  • Guard rails: UPDATE/DELETE require filters, TRUNCATE requires confirmation
  • Preview mode: Bulk operations show impact before executing
  • Stdio transport: Designed for Claude Desktop integration

Project Structure

mysql-mcp/
├── package.json
└── src/
    ├── index.js       # MCP server entry point (stdio transport)
    ├── db.js          # MySQL connection pool
    ├── tools.js       # Tool definitions (JSON Schema)
    └── handlers.js    # Tool execution logic + safety checks

Setup

1. Install dependencies

cd mysql-mcp
npm install

2. Configure Claude Desktop

Open your Claude Desktop config file:

  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Add this to the mcpServers section:

{
  "mcpServers": {
    "mysql": {
      "command": "node",
      "args": ["D:/100xDev/mysql-mcp/src/index.js"],
      "env": {
        "DB_HOST": "localhost",
        "DB_PORT": "3306",
        "DB_USER": "root",
        "DB_PASSWORD": "your_password_here",
        "DB_NAME": "your_database_name"
      }
    }
  }
}

Important: Use the full absolute path to index.js in the args array. Update the env values to match your MySQL setup.

3. Restart Claude Desktop

Close and reopen Claude Desktop. You should see the MySQL tools available in the tools menu.

Available Tools

Tool Description
list_tables Show all tables in the database
describe_table Show column structure of a table
fetch SELECT with filters, sorting, pagination
update UPDATE with required filters
delete DELETE with required filters
truncate Drop all rows (requires confirm: true)
modify_bulk Deduplicate, normalize, or cleanup data

Safety Rules

  1. No raw SQL — All queries are built from structured input
  2. Identifier sanitization — Table/column names are validated against [a-zA-Z_][a-zA-Z0-9_]*
  3. Parameterized queries — All values use ? placeholders (no SQL injection)
  4. UPDATE requires filters — Cannot update all rows accidentally
  5. DELETE requires filters — Cannot delete all rows accidentally
  6. TRUNCATE requires confirmation — Must pass confirm: true
  7. Bulk operations preview first — Shows impact before executing
  8. Row limit cap — Fetch is capped at 1000 rows max

Example Prompts

Once connected in Claude Desktop, you can use natural language:

  • "Show me all tables"
  • "What columns does the users table have?"
  • "Get all users where status is active"
  • "Update the name to 'Zoher' where id is 5"
  • "Delete all orders where status is cancelled"
  • "Find duplicate entries in users by email"
  • "Normalize status values: replace 'actve' with 'active' in users"

Environment Variables

Variable Default Description
DB_HOST localhost MySQL host
DB_PORT 3306 MySQL port
DB_USER root MySQL username
DB_PASSWORD password MySQL password
DB_NAME test_db Database name

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured