home / mcp / mysql schema mcp server
Provides compressed MySQL schema data and on-demand table descriptions to help you explore large databases.
Configuration
View docs{
"mcpServers": {
"shibayu36-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"
],
"env": {
"DB_HOST": "127.0.0.1",
"DB_PORT": "3306",
"DB_USER": "root",
"DB_PASSWORD": "your_password"
}
}
}
}You run the MySQL Schema MCP Server to provide compressed schema information for large MySQL databases. This server helps you access table and column details when a full schema dump exceeds context size, making it practical to fetch just the pieces you need on demand.
You connect to the MCP server using a client that supports Model Context Protocol requests. Use the server’s available tools to explore your MySQL schemas without loading every detail at once. You can list all tables in a database to understand structure and metadata, then request detailed descriptions for specific tables to view columns, keys, and indexes. These operations help you build a compact, on-demand view of your database schema.
Prerequisites you need before installation: Docker or a Go development environment if you choose the binary route.
{
"mcpServers": {
"mysql_schema_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 you prefer to run the binary directly, install the Go binary and configure the MCP client accordingly.
go install github.com/shibayu36/mysql-schema-explorer-mcp@latest
```
```json
{
"mcpServers": {
"mysql_schema_mcp": {
"command": "/path/to/mysql-schema-explorer-mcp",
"env": {
"DB_HOST": "127.0.0.1",
"DB_PORT": "3306",
"DB_USER": "root",
"DB_PASSWORD": "your_password"
}
}
}
}The server expects environment variables to point to your MySQL instance. When using Docker, you pass these as -e flags (DB_HOST, DB_PORT, DB_USER, DB_PASSWORD). If you set DB_NAME for a single database, you can simplify client interactions by fixing the target database in the environment. Ensure your MySQL user has the necessary privileges to read schema information.
You have two main tools available to inspect your schema: - List Tables: retrieves a list of all tables in a database, including table name, comments, and key constraints (primary, unique, and foreign keys). - Describe Tables: returns detailed information for specific tables, including column definitions, keys, and indexes.
Protect your database credentials. Do not expose DB_PASSWORD in logs or in shared configuration files. Use secure environment variable handling and restrict container network access to trusted hosts.
Lists all table information for a specified database, including table name, comments, primary keys, unique keys, and foreign keys.
Provides detailed information for specific tables, including column definitions, keys, and indexes.