Cover image
Try Now
2025-04-09

Servidor MCP para mysql

3 years

Works with Finder

1

Github Watches

1

Github Forks

2

Github Stars

MySQL MCP Server

Overview

This project provides a read-only Model Context Protocol (MCP) server for interacting with MySQL databases. It allows clients compatible with MCP to inspect database schemas, retrieve metadata, and execute read-only SQL queries through a set of defined tools. The server is built with extensibility in mind and enforces read-only operations for safety.

Features & Implemented Tools

The server exposes several tools via MCP for database interaction. All tools are designed for read-only operations.

Schema & Metadata Tools

  • get_table_columns: Retrieves column definitions for a specific table.
  • get_schema: Fetches detailed schema information including tables, columns, indexes, and constraints, with varying detail levels.
  • get_indexes: Retrieves index information for a specific table or all tables.
  • get_constraints: Fetches constraint information (Primary Key, Foreign Key, Unique, Check) for a specific table or all tables.
  • compare_schemas: Compares the structure (tables and columns) of two different database schemas.
  • explain_schema: Generates a textual or structured (JSON) description of the database schema.
  • detect_schema_changes: Returns a snapshot of the current schema. (Note: Does not compare against a specific past time).
  • find_relationships: Discovers explicit foreign key relationships. Can optionally attempt to find implicit relationships based on naming conventions (use with caution).
  • find_navigation_paths: Finds paths between two tables using explicit foreign key relationships (BFS algorithm).

Query Execution Tools

  • execute_query: Executes a given read-only SQL query (SELECT, SHOW, DESCRIBE, EXPLAIN).
  • execute_batch: Runs multiple read-only SQL queries sequentially. Can stop on the first error or attempt all.
  • prepare_statement: Prepares and executes a read-only SQL statement with parameters.
  • explain_query: Executes EXPLAIN on a given SQL statement to show the query execution plan (TEXT or JSON format).
  • get_query_history: Placeholder tool. Server-side query history is not currently implemented.

Visualization Tools

  • visualize_schema: Generates schema representations (tables, columns, relationships) in JSON, DOT (Graphviz), or Mermaid syntax suitable for creating ER diagrams.

Performance Tools

  • get_performance_metrics: Retrieves selected global status variables from MySQL (e.g., Uptime, Threads, Queries). Does not provide query-specific history.

Setup & Installation

  1. Prerequisites:

    • Node.js
    • npm
    • Access to a MySQL database
  2. Clone the Repository:

    git clone https://github.com/kaulvimal/mysql-mcp
    cd mysql-mcp-server
    
  3. Install Dependencies:

    npm install
    
  4. Build the Project:

    npm run build
    

    This will create a build directory with the compiled code.

  5. Using the server

  • Create a shell script (e.g., mysql-mcp.sh) in the project root or a convenient location:

    #!/bin/bash
    # Set environment variables (if not using .env or want to override)
    # export DB_HOST=localhost
    # export DB_USER=root
    # export DB_PASSWORD=""
    # export DB_PORT=3306
    node $(dirname "$0")/build/index.js
    
  • Make the script executable:

    chmod +x mysql-mcp.sh
    
  • Integration Example (Cursor)

    To integrate this server with an Cursor, you can configure the client to run the server's execution script:

    
    mcpServers": {
    "mysql-mcp": {
    "command": "/path/to/your/mysql-mcp.sh" // Replace with the actual path to your script
    }
    
    
    

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • https://zenepic.net
  • Embark on a thrilling diplomatic quest across a galaxy on the brink of war. Navigate complex politics and alien cultures to forge peace and avert catastrophe in this immersive interstellar adventure.

  • apappascs
  • Descubra la colección más completa y actualizada de servidores MCP en el mercado. Este repositorio sirve como un centro centralizado, que ofrece un extenso catálogo de servidores MCP de código abierto y propietarios, completos con características, enlaces de documentación y colaboradores.

  • ShrimpingIt
  • Manipulación basada en Micrypthon I2C del expansor GPIO de la serie MCP, derivada de AdaFruit_MCP230xx

  • pontusab
  • La comunidad de cursor y windsurf, encontrar reglas y MCP

  • ravitemer
  • Un poderoso complemento Neovim para administrar servidores MCP (protocolo de contexto del modelo)

  • jae-jae
  • Servidor MCP para obtener contenido de la página web con el navegador sin cabeza de dramaturgo.

  • patruff
  • Puente entre los servidores Ollama y MCP, lo que permite a LLM locales utilizar herramientas de protocolo de contexto del modelo

  • HiveNexus
  • Un bot de chat de IA para equipos pequeños y medianos, que apoyan modelos como Deepseek, Open AI, Claude y Gemini. 专为中小团队设计的 ai 聊天应用 , 支持 Deepseek 、 Open ai 、 Claude 、 Géminis 等模型。

  • JackKuo666
  • 🔍 Habilitar asistentes de IA para buscar y acceder a la información del paquete PYPI a través de una interfaz MCP simple.

  • av
  • Ejecute sin esfuerzo LLM Backends, API, frontends y servicios con un solo comando.

    Reviews

    1 (1)
    Avatar
    user_5yTwE24H
    2025-04-16

    As a dedicated user of mysql-mcp, I must say this tool is exceptional for managing MySQL configurations and processes effectively. Created by kaulvimal, it streamlines database management tasks with ease. The open-source nature and clear documentation on GitHub make it accessible for developers of all levels. Highly recommend checking it out!