@davewind/mysql-mcp-server

@davewind/mysql-mcp-server

Read-only Model Context Protocol server for secure MySQL access with LLM integration.

11
Stars
4
Forks
11
Watchers
2
Issues
Provides a Model Context Protocol-compliant server offering read-only access to MySQL databases, enabling LLMs to inspect schemas and execute SELECT queries. Enforces strict SQL validation to allow only read-only operations and exposes table schema information in JSON format. Communication occurs over JSON-RPC via stdio to ensure compatibility with LLM systems. Features simple configuration, automatic schema discovery, and robust security measures.

Key Features

Read-only MySQL database access
Automatic schema discovery and exposure
SQL query tool supporting only SELECT statements
Strict SQL validation and READ ONLY transaction enforcement
Model Context Protocol compliance for LLM interoperability
Easy configuration with minimal setup requirements
Provides JSON schema information for tables
Integration with LLMs over JSON-RPC stdio
Security model preventing data or schema modification
NPM package with command-line support

Use Cases

Enabling language models to safely query business databases
Automating data retrieval from MySQL for analysis without write access
Providing LLMs contextual understanding of database schemas
Ensuring secure, audit-friendly read-only database operations
Integrating MySQL data into AI-driven data exploration tools
Developing AI assistants capable of answering questions based on live databases
Testing LLM-to-database query workflows without risk of data mutation
Sandboxed access to production databases for analysis
Enforcing strict separation between analytic and transactional database usage
Streaming schema metadata to LLMs for enhanced prompt engineering

README

@davewind/mysql-mcp-server

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.

Key Features

1.Read-Only Database Access: Enforces read-only operations through SQL validation and READ ONLY transactions
2.Schema Discovery: Automatically identifies and exposes database table structures
3.SQL Query Execution: Provides a query tool that accepts and executes SELECT statements
4.Model Context Protocol Compliance: Implements the MCP specification for seamless integration with compatible LLMs
5.Simple Configuration: Easy setup with minimal configuration required

Tools

  • 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 (mysql://user:password@localhost:3306/database)
    • JSON schema information for each table
    • Includes column names and data types
    • Automatically discovered from database metadata

Install

bash
npm install @davewind/mysql-mcp-server -g

Configuration

MCP settings configuration file:

recommended use

json
{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": ["-y", "@davewind/mysql-mcp-server", "mysql://user:password@localhost:port/database"],
    }
  }
}

Test

Replace mysql://user:password@localhost:port/ and npm run inspector

js
  "scripts": {
    "inspector": "npx @modelcontextprotocol/inspector@0.10.2 build/index.js mysql://user:password@localhost:port/database
  }

Env

js

node v18 +

System Architecture

The MySQL MCP Server acts as an intermediary between LLMs and MySQL databases, processing requests according to the Model Context Protocol.

Component Interaction

Component Interaction

Security Model

The MySQL MCP Server implements a strict security model to ensure that database access is read-only.

Security measures include:

1.SQL query validation to allow only SELECT statements 2.Execution of all queries within READ ONLY transactions 3.No support for data modification operations (INSERT, UPDATE, DELETE, etc.) 4. No support for database schema modification (CREATE, ALTER, DROP, etc.)

Integration with LLMs

The MySQL MCP Server is designed to work with any LLM system that supports the Model Context Protocol. It communicates through JSON-RPC over stdio, following the MCP specification.

License

MIT

Star History

Star History Chart

Repository Owner

dave-wind
dave-wind

User

Repository Details

Language JavaScript
Default Branch master
Size 177 KB
Contributors 1
License MIT License
MCP Verified Nov 12, 2025

Programming Languages

JavaScript
95.85%
Dockerfile
4.15%

Tags

Join Our Newsletter

Stay updated with the latest AI tools, news, and offers by subscribing to our weekly newsletter.

We respect your privacy. Unsubscribe at any time.

Related MCPs

Discover similar Model Context Protocol servers

  • go-mcp-mysql

    go-mcp-mysql

    Zero-burden Model Context Protocol (MCP) server for MySQL automation.

    go-mcp-mysql is a ready-to-use server that implements the Model Context Protocol (MCP) for seamless interaction and automation with MySQL databases. Written in Go, it enables users to perform CRUD operations and check query plans without requiring a Node.js or Python environment. The server supports both command-line and DSN configurations, includes a read-only mode, and features a set of tools for managing schema and data. It is designed for low-overhead deployment and flexible MySQL automation workflows.

    • 46
    • MCP
    • Zhwt/go-mcp-mysql
  • @f4ww4z/mcp-mysql-server

    @f4ww4z/mcp-mysql-server

    Standardized MySQL operations server for Model Context Protocol environments.

    Provides a Model Context Protocol server that allows AI models to interact with MySQL databases through a standardized interface. Supports secure connection, prepared statements, and robust error handling. Enables models to connect, query, execute statements, list tables, and describe schema with simple commands. Designed for seamless integration with tools like Smithery and evaluation frameworks.

    • 130
    • MCP
    • f4ww4z/mcp-mysql-server
  • MySQL MCP Server

    MySQL MCP Server

    Secure MCP interface for MySQL database interaction with AI applications.

    MySQL MCP Server implements the Model Context Protocol (MCP) to provide a secure bridge between AI applications and MySQL databases. It enables structured exploration and controlled queries through a standardized communication interface, ensuring safe and logged access to data. Designed for integration with tools such as Claude Desktop and Visual Studio Code, MySQL MCP Server allows users to list, read, and query MySQL tables securely. Environment variable-based configuration and comprehensive logging enhance its reliability for sensitive database interactions.

    • 980
    • MCP
    • designcomputer/mysql_mcp_server
  • SQLite Explorer MCP Server

    SQLite Explorer MCP Server

    Secure, read-only access to SQLite databases for LLMs via the Model Context Protocol.

    SQLite Explorer MCP Server provides a safe, read-only interface to SQLite databases using the Model Context Protocol (MCP). Built with the FastMCP framework, it enables large language models to explore, query, and retrieve database schema information with robust safety and validation mechanisms. The server exposes structured tools such as read_query, list_tables, and describe_table, ensuring secure and reliable access to database contents. Designed for integration with platforms like Claude Desktop and Cline VSCode Plugin.

    • 93
    • MCP
    • hannesrudolph/sqlite-explorer-fastmcp-mcp-server
  • MCP MongoDB Server

    MCP MongoDB Server

    A Model Context Protocol server for LLM interaction with MongoDB databases.

    MCP MongoDB Server enables large language models to interact with MongoDB databases through the standardized Model Context Protocol interface. It provides schema inspection, document querying, aggregation, and write operations with intelligent ObjectId handling and flexible read-only configurations. Designed for seamless integration with tools like Claude Desktop, it offers collection completions, schema inference, and robust support for both development and production environments.

    • 267
    • MCP
    • kiliczsh/mcp-mongo-server
  • mcp_mysql_server_pro

    mcp_mysql_server_pro

    Advanced MySQL server tool with Model Context Protocol support and database health analysis.

    mcp_mysql_server_pro enables seamless MySQL database operations and analysis, supporting all Model Context Protocol (MCP) transfer modes including STDIO, SSE, and Streamable HTTP. It provides flexible permission control, advanced anomaly detection, and health status monitoring, with easy extensibility via custom tools. OAuth2.0 authentication is supported, and users can execute multi-statement SQL queries, perform index and lock analysis, and leverage prompt template invocation.

    • 273
    • MCP
    • wenb1n-dev/mysql_mcp_server_pro
  • Didn't find tool you were looking for?

    Be as detailed as possible for better results