MySQL Schema Explorer MCP server

Enables AI to explore and interact with MySQL database schemas for documentation, query building, and schema analysis without direct database access.
Back to servers
Provider
shibayu36
Release date
Apr 21, 2025
Language
Go
Stats
15 stars

This MCP server provides compressed schema information for MySQL databases, making it useful when dealing with large database schemas that don't fit within context size limits. It offers tools to list tables and describe table structures from your MySQL databases.

Installation

To install the MySQL Schema MCP Server, follow these steps:

  1. Install the command using Go:

    go install github.com/shibayu36/mysql-schema-explorer-mcp@latest
    
  2. Configure the MCP server by creating an mcp.json file:

    {
      "mcpServers": {
        "mysql-schema-explorer-mcp": {
          "command": "/path/to/mysql-schema-explorer-mcp",
          "env": {
            "DB_HOST": "127.0.0.1",
            "DB_PORT": "3306",
            "DB_USER": "root",
            "DB_PASSWORD": "root"
          }
        }
      }
    }
    

    Make sure to replace /path/to/mysql-schema-explorer-mcp with the actual path to the installed executable, and update the database connection details as needed.

Using the MCP Server

The MySQL Schema MCP Server provides two main tools:

List Tables

The list_tables tool provides information about all tables in a specified database, including:

  • Table names
  • Comments
  • Primary key information
  • Unique key information
  • Foreign key information

Parameters:

  • dbName: The name of the database to retrieve information from

Example usage: When using with an MCP-compatible agent, you can request:

List all tables in the 'ecshop' database

Describe Tables

The describe_tables tool provides detailed information about specific tables in a database, including:

  • Column definitions
  • Key constraints
  • Indexes

Parameters:

  • dbName: The name of the database to retrieve information from
  • tableNames: An array of table names to retrieve detailed information for

Example usage: When using with an MCP-compatible agent, you can request:

Describe the structure of the 'users' and 'orders' tables in the 'ecshop' database

Example Workflow

Using this MCP server with a compatible agent, you can execute complex tasks like:

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

The MCP server will provide the necessary schema information to the agent, allowing it to generate appropriate SQL queries for your request.

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later