SM

shibayu36/mysql-schema-explorer-mcp

Database management

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

22 stars 1 forks 品質 69 トレンド 10MIT

This is a Model Context Protocol (MCP) server that provides compressed schema information for MySQL databases.

概要

This is a Model Context Protocol (MCP) server that provides compressed schema information for MySQL databases. This MCP server is useful when the schema dump file does not fit in the context size because you are using a large database schema. https://github.com/user-attachments/assets/0cecef84-cd70-4f84-95cb-01c6ec7c9ac7 - List Tables (list_tables) - Lists all table information in the specified database. Includes table name, comment, primary key, unique key, and foreign key information. - Parameters - dbName: The name of the database to retrieve information from (not required when DB_NAME environment variable is set) - Describe Tables (describe_tables) - Displays detailed information for specific tables in the specified database. Provides formatted information such as column definitions, key constraints, and indexes.

README

以下は原文 README の抜粋です。原文を見る。

MySQL Schema MCP Server

This is a Model Context Protocol (MCP) server that provides compressed schema information for MySQL databases. This MCP server is useful when the schema dump file does not fit in the context size because you are using a large database schema.

https://github.com/user-attachments/assets/0cecef84-cd70-4f84-95cb-01c6ec7c9ac7

Provided Tools

  • List Tables (list_tables)
    • Lists all table information in the specified database. Includes table name, comment, primary key, unique key, and foreign key information.
    • Parameters
      • dbName: The name of the database to retrieve information from (not required when DB_NAME environment variable is set)
  • Describe Tables (describe_tables)
    • Displays detailed information for specific tables in the specified database. Provides formatted information such as column definitions, key constraints, and indexes.
    • Parameters
      • dbName: The name of the database to retrieve information from (not required when DB_NAME environment variable is set)
      • tableNames: An array of table names to retrieve detailed information for

Quick Start

  1. Configure mcp.json

    {
      "mcpServers": {
        "mysql-schema-explorer-mcp": {
          "command": "docker",
          "args": ["run", "-i", "--rm", "--pull", "always", "--network=host",
            "-e", "DB_HOST=127.0.0.1",
            "-e", "DB_PORT=3306",
            "-e", "DB_USER=root",
            "-e", "DB_PASSWORD=your_password",
            "ghcr.io/shibayu36/mysql-schema-explorer-mcp:latest"
          ]
        }
      }
    }
    

    If using Claude Code:

    claude mcp add mysql-schema-explorer-mcp -- docker run -i --rm --pull always --network=host \
      -e DB_HOST=127.0.0.1 \
      -e DB_USER=root \
      -e DB_PASSWORD=your_password \
      -e DB_PORT=3306 \
      ghcr.io/shibayu36/mysql-schema-explorer-mcp:latest
    
  2. Execute SQL generation using the agent

    Example: Using the structure of the ecshop database, list the names of the 3 most recently ordered products by the user shibayu36.

Usage

Fixing to a Specific Database

When accessing only one database, you can set the DB_NAME environment variable to avoid specifying the database name each time.

{
  "mcpServers": {
    "mysql-schema-explorer-mcp": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "--network=host",
        "-e", "DB_HOST=127.0.0.1",
        "-e", "DB_PORT=3306",
        "-e", "DB_USER=root",
        "-e", "DB_PASSWORD=your_password",
        "-e", "DB_NAME=ecshop",
        "ghcr.io/shibayu36/mysql-schema-explorer-mcp:latest"
      ]
    }
  }
}

Using Binary Instead of Docker

If you have a Go development environment, you can also install and use the binary directly.

  1. Install the command

    go install github.com/shibayu36/mysql-schema-explorer-mcp@latest
    
  2. Configure mcp.json

    {
      "mcpServers": {
GitHub で README 全文を見る

インストール

docker run -i --rm --pull always --network=host -e DB_HOST=127.0.0.1 -e DB_PORT=3306 -e DB_USER=root -e DB_PASSWORD=your_password ghcr.io/shibayu36/mysql-schema-explorer-mcp:latest
MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

{ "mcpServers": { "mysql-schema-explorer-mcp": { "command": "docker", "args": ["run", "-i", "--rm", "--pull", "always", "--network=host", "-e", "DB_HOST=127.0.0.1", "-e", "DB_PORT=3306", "-e", "DB_USER=root", "-e", "DB_PASSWORD=your_password", "ghcr.io/shibayu36/mysql-schema-explorer-mcp:latest" ] } } }