MCP cover image
See in Github
2025-04-27

mcp model-context-protocol mysql cursor n8n

1

Github Watches

0

Github Forks

8

Github Stars

@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

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

Configuration

MCP settings configuration file:

recommended use

{
  "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

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

Env


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.

mysql-mcp-server ./docs/High-Level Architecture.png

Component Interaction

mysql-mcp-server ./docs/component-Interaction.png

Component Interaction

mysql-mcp-server ./docs/component-Interaction.png

Security Model

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

mysql-mcp-server ./docs/Security Model.png

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.

mysql-mcp-server ./docs/Integration with LLMs.png

License

MIT

相关推荐

  • microsoft
  • Python tool for converting files and office documents to Markdown.

  • sirmews
  • Read your Apple Notes with Claude Model Context Protocol

  • magarcia
  • An implementation of Giphy integration with Model Context Protocol

  • mzxrai
  • Chat with OpenAI models from Claude Desktop

  • Badhansen
  • A simple Model Context Protocol (MCP) server that integrates with Notion's API to manage my personal todo list.

  • ttommyth
  • Vibe coding should have human in the loop! interactive-mcp: Local, cross-platform MCP server for interact with your AI Agent

  • kopfrechner
  • Interact seamlessly with GitLab repositories to manage merge requests and issues. Fetch details, add comments, and streamline your code review process with ease.

    Reviews

    5 (0)